One more thing that is missing in the official tutorial.
When setting the initial pose of a robot in ROS2, you need to update the robot's state in both RViz and Gazebo separately. This is because RViz is a visualization tool and does not have control over the robot's state, while Gazebo is a physics simulator and controls the robot's state.
So if we call navigator.setInitialPose(initial_pose) as it is done in the official tutorial, or if we publish
$ ros2 topic pub -1 /initialpose geometry_msgs/PoseWithCovarianceStamped '{ header: {stamp: {sec: 0, nanosec: 0}, frame_id: "map"}, pose: { pose: {position: {x: 0.1, y: 0.0, z: 0.0}, orientation: {w: 0.1}}, } }'
... the robot will move in RViz, but not in Gazebo. So, when we start our simulation, the robot will be in a correct initial position (as set in nav2_params.yaml), and then, as our waypoint_follower.py script tries to set the initial position, it will de-synchronize robot positions in RViz and Gazebo.
I have some (commented) chunks of code in my scripts that (when I complete them) will handle the problem. In few words: we need to get access to Gazebo (probably, using SetModelState, GetModelState modules) and set robot position in Gazebo using those. This part will be covered in future tutorials.