ROS2 Tutorial: Waypoint Follower

Things to keep in mind

This section applies to ROS2 Foxy and Galactic: I never investigated it on other versions of ROS2. Note that the code this section is based on (created by Steve Macenski and used by ROS2 official tutorials) uses the ROS2 Galactic or later. It never declares that, so if you copy the official tutorial's code and try running it, you will find that some modules do not exist. Particularly, Foxy doesn't have NavigateThroughPoses and ComputePathThroughPoses. Yes, you can find this info in official documentation, but not anywhere near the code samples.

Lucky us, the demo doesn't use these modules, so code that mentions them can be safely commented out. After that, ROS2 Foxy works just fine (I use Galactic, but yes, navigation_bot_06 can run on Foxy)... But, wait! There is more.

The ROS2 forums are full of frustrated comments, stating that something is wrong with bringing up the recoveries_server. Some people claim that name of one of recovery plugins should be backup, while others insist that their code works if it is back_up (note the underscore). Here is the code fragment:

                            recoveries_server:
                            ros__parameters:
                            costmap_topic: local_costmap/costmap_raw
                            footprint_topic: local_costmap/published_footprint
                            cycle_frequency: 10.0
                            recovery_plugins: ["spin", "backup", "wait"]
                            spin:
                                plugin: "nav2_recoveries/Spin"
                            backup:
                                plugin: "nav2_recoveries/BackUp"
                            wait:
                                plugin: "nav2_recoveries/Wait"
                

For Foxy and Galactic (and yes, it can change for future versions without warnings, this is just the way ROS2 is being documented), the problem is not in this name. The difference is... Ok, take a look:

Official tuturial (robot_navigator.py):

                    self.follow_waypoints_client = ActionClient(self, FollowWaypoints, 'follow_waypoints')
                

Code that works, at least for Foxy and Galactic:

                    self.follow_waypoints_client = ActionClient(self, FollowWaypoints, 'FollowWaypoints')
                

I do not know how to comment that, so I probably wouldn't. Let's call it a typo.

(C) snowcron.com, all rights reserved

Please read the disclaimer