第 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.

  1. Keep the package name as mycar_navigation2_jazzy, and add or modify boundary comments in the relevant locations.
    • package.xml
    • CMakeLists.txt
  2. Keep the package path query for the launch file inside the _jazzy package as mycar_navigation2_jazzy, and add boundary comments for the modifications.
    • launch/nav2.launch.py
    • launch/bringup.launch.py
    • launch/auto_slam.launch.py
  3. Updated params/bt.yaml to align with the official Jazzy bt_navigator example.
    • 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_names only keep custom BT plugins.
    • Do not pass plugin_lib_names when 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_names to work with the error code blackboard variable in the official Jazzy behavior tree.
  4. Update the planner and behavior plugins to match the Jazzy official pluginlib class names.
    • nav2_navfn_planner/NavfnPlanner changed to nav2_navfn_planner::NavfnPlanner
    • Change nav2_behaviors/Spin etc. to nav2_behaviors::Spin etc.
  5. Update custom BT XML according to the official Jazzy behavior tree.
    • Add BTCPP_format="4".
    • Add PlannerSelector and ControllerSelector.
    • ComputePathToPose, ComputePathThroughPoses, and FollowPath added error_code_id.
    • Add WouldAPlannerRecoveryHelp and WouldAControllerRecoveryHelp.
  6. Updated the progress checker parameters to match the Jazzy official controller parameter names.
    • progress_checker_plugin changed to progress_checker_plugins: ["progress_checker"]
  7. Organize the YAML structure of the planner/controller parameter file.
    • Merge the duplicate /** top-level keys into one.
    • global_costmap and local_costmap are placed under the same /** root key to avoid overwriting the server parameters during parameter parsing.

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_navigator successfully created navigate_to_pose and navigate_through_poses.
  • planner_server successfully loaded nav2_navfn_planner::NavfnPlanner.
  • controller_server successfully loaded DWB and all critics.
  • behavior_server successfully loaded the nav2_behaviors::... plugin.
  • In a short startup environment without Gazebo/robot_state_publisher/TF, it eventually stops waiting for base_link -> map TF. This is an expected missing runtime environment, not a configuration fatal error.
音乐页