For my Dad’s 50th birthday party, I upgraded my R2D2 to which I added a 2D lidar in 2019 with a serving plate. The target was to let R2 serve drinks to the guests of the party fully autonomously as apéro. For that, I was able to profit from the experience I gathered while programming a robot to serve a coffee fully autonomously during my semester thesis at ETH Zurich.
As always, I was using ROS for a beautiful code structure. Basically, I copied the navigation stack parameters used in my semester thesis and only added a new node which updates the target location on the fly.
Steps necessary to use Apero-D2 in a completely new environment
The usage is kept very simple:
1. Record a map
As a first step, I need to record a map of the environment which is used by R2 to localize. This procedure uses SLAM (to be specific, gmapping), an algorithm to simultaneously localize in an unknown environment and create a map. For that, gmapping uses the measurements of the 2D lidar as well as wheel odometry.
2. Record a mission
With the recorded map, R2 is able to localize in the environment using AMCL. Note that even if the environment changes (like for example humans walk around or chairs are moved), the localization remains quite accurate since AMCL is not only trying to match lidar scans to the map but also using the wheel odometry as a process model. I won’t go too much in detail, but AMCL uses a particle filter.
In this step, I am able to drive R2 to a location where I would like to add a waypoint and simply enter a command to add it to the mission. For each waypoint, I am able to specify the radius in which R2 recognizes the waypoint as reached and the time he should wait there. The radius is necessary such that R2 never stops at a location but keeps driving. The optional sleep time is used to load new drinks to the robot.
3. Store the mission and go!
As a last step, I save the mission in JSON format and start the execution. R2 then just follows the waypoints while avoiding obstacles such as chairs, tables and humans.