第 12.3 節
Differences in Navigation between Humble and Jazzy
0瀏覽次數0訪問次數--跳出率--平均停留
Refer to the official Jazzy example
/opt/ros/jazzy/share/nav2_bringup/params/nav2_params.yaml/opt/ros/jazzy/share/nav2_bt_navigator/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml/opt/ros/jazzy/share/nav2_bt_navigator/behavior_trees/navigate_through_poses_w_replanning_and_recovery.xml
Modified content
Copy a humble package, name it mycar_navigation2_jazzy, and then modify it.
- Keep the package name as
mycar_navigation2_jazzy, and add or modify boundary comments in the relevant locations.package.xmlCMakeLists.txt
- Keep the package path query for the launch file inside the
_jazzypackage asmycar_navigation2_jazzy, and add boundary comments for the modifications.launch/nav2.launch.pylaunch/bringup.launch.pylaunch/auto_slam.launch.py
- Updated
params/bt.yamlto align with the official Jazzybt_navigatorexample.- Delete the list of Nav2 built-in BT plugins listed in the Humble era.
- Jazzy will automatically load Nav2's built-in BT plugins,
plugin_lib_namesonly keep custom BT plugins. - Do not pass
plugin_lib_nameswhen there is no custom BT plugin, to prevent an empty list from being parsed as an untyped parameter. - Added
navigators,navigate_to_pose,navigate_through_poses. - Added
error_code_namesto work with the error code blackboard variable in the official Jazzy behavior tree.
- Update the planner and behavior plugins to match the Jazzy official pluginlib class names.
nav2_navfn_planner/NavfnPlannerchanged tonav2_navfn_planner::NavfnPlanner- Change
nav2_behaviors/Spinetc. tonav2_behaviors::Spinetc.
- Update custom BT XML according to the official Jazzy behavior tree.
- Add
BTCPP_format="4". - Add
PlannerSelectorandControllerSelector. ComputePathToPose,ComputePathThroughPoses, andFollowPathaddederror_code_id.- Add
WouldAPlannerRecoveryHelpandWouldAControllerRecoveryHelp.
- Add
- Updated the progress checker parameters to match the Jazzy official controller parameter names.
progress_checker_pluginchanged toprogress_checker_plugins: ["progress_checker"]
- Organize the YAML structure of the planner/controller parameter file.
- Merge the duplicate
/**top-level keys into one. global_costmapandlocal_costmapare placed under the same/**root key to avoid overwriting the server parameters during parameter parsing.
- Merge the duplicate
Main issues fixed
Startup error:
Failed to create navigator id navigate_to_pose. Exception: ID [ComputePathToPose] already registered
The reason is that the Humble configuration manually listed the built-in Nav2 BT plugins in plugin_lib_names, while Jazzy automatically loads these built-in plugins, causing ComputePathToPose to be registered twice.
Usage Instructions
Rebuild and source:
colcon build --symlink-install --packages-select mycar_navigation2_jazzy
source install/setup.bash
Launching the Jazzy version:
ros2 launch mycar_navigation2_jazzy bringup.launch.py use_sim_time:=True
Verified
Executed
colcon build --symlink-install --packages-select mycar_navigation2_jazzy
ros2 launch mycar_navigation2_jazzy nav2.launch.py --show-args
ros2 launch mycar_navigation2_jazzy bringup.launch.py --show-args
Additionally, a short startup check was performed using timeout.
ros2 launch mycar_navigation2_jazzy bringup.launch.py use_sim_time:=True
Result:
bt_navigatorsuccessfully creatednavigate_to_poseandnavigate_through_poses.planner_serversuccessfully loadednav2_navfn_planner::NavfnPlanner.controller_serversuccessfully loaded DWB and all critics.behavior_serversuccessfully loaded thenav2_behaviors::...plugin.- In a short startup environment without Gazebo/robot_state_publisher/TF, it eventually stops waiting for
base_link -> mapTF. This is an expected missing runtime environment, not a configuration fatal error.