This part of the project constructs a representation of the convex shaped
boundary in local shape space, and uses this information to determine whether
objects are in the correct region or not. We first use the map build request to
generate a local map of all the lines / ellipses, then use a convex algorithm
to build a polygon shape of the boundary. Since we are only dealing with the
shapes not sketches, tekkotsu's built-in convex hull function is not very
convenient. Thus we wrote a separate convex hull function that takes in vector
of points, instead of a sketch.
We also generate the next way point for patrolling during this part.
If we need to manipulate any object, a pair of its position / target position
will be calculated too.
Note that since the boundary is convex, the robot doesn't need to see all of it
at once. The reason is if some objects are in the wrong part of the region
given the partial convex hull, they are guaranteed to be in the wrong part in
the complete convex hull. Since the robot is patrolling the boundary, it just
need to see the parts that are close to it.
Here is a screen shot of the local map