You might be wondering how the robot determines which part of
the plane is inside and which part is outside of the convex
hull. The most natural way to tackle this problem is using
some sort of global map, so that the robot knows the exactly
location. But as we gradually discover that a global map
relies on a lot of conditions, for instance it needs good
localization, and requires the motion to be exact. This way
is also more complicated.
So we decided to do everything with just local maps. Since
the boundary we are working with is convex hull shaped, we
can determine the inside / outside problem fairly easily
even without seeing the entire region. Eggs that are inside
the partial boundary will be inside the complete for sure, and
vice versa.
Thus our approach can be outlined as these steps:
1. Build a local map of the environment which will
contain at least part of the convex hull shaped boundary.
2. Generate the next way point using the boundary from
step 1.
3. Use that boundary to check if any blue egg is inside,
if there isn't any, jump to step 8.
4. Calculate the position of the blue egg, generate a
target position and a direction of hitting for it.
5. Use the egg position and target position from step 4
to generate a desired pose for the robot, and walk there.
6. Build a local map for the egg we are manipulating,
use RRT to correct the arm's relative position if necessary,
then hit the egg towards the target.
7. Restore the robot's pose.
8. Turn towards the next way point.
9. Build a partial boundary, and check if any green
eggs are outside. If there is any, use steps 4 to 7 to hit
it inside.
10. Move to the way point, and turn towards the
centroid of the convex hull generated in step 1.
11. Repeat step 1.