Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Configure-path-planning-tp10430p10433.html
Hi,
You could make sure to keep rtabmap and nav2 disconnected (e.g., setting use_action_for_goal to false). When using set_goal or sending a pose on "goal" topic, rtabmap will plan in its graph a path to reach that goal. The goal cannot be farther than "RGBD/LocalRadius" (default 10 meters) from the map's graph, otherwise, send the goal directly to nav2.
So for why does rtabmap implement its own path planning? it is explained in this
paper. In summary, if memory management is enabled and/or we do navigation while doing SLAM (not just localization on a static map) and/or RGBD/OptimizeFromGraphEnd=true, the pose we send to nav2 may change when a loop closure happens, causing the whole map to deform, so the pose should be updated to match the new map. When sending a goal pose through rtabmap, it will take care of that, by republishing the corrected pose of the goal when the map is updated.
As you said, rtabmap doesn't publish only the last pose of the plan, but publishes waypoints to reach the final pose. That is on purpose, it forces the robot to follow the mapping path, to increase the chance of re-localization. Those waypoints can be found in the published topic "global_path". To publish only the last pose to nav2, you could have an intermediate node subscribing to global_path, and republishing to nav2 the last pose when it detects it has changed.
By the way, just found there is maybe a
bug with integration of nav2's action server with rtabmap, because as soon rtabmap sends a second goal (to overwrite the first one while following the path), it receives "ABORTED" state from the previous goal, and thus cancelling all the other poses on the path. Maybe related to that
post, though maybe this has been fixed by now or I am not using nav2 action server right.
cheers,
Mathieu