Error while launching bt_navigator

Hi,

I am launching the bt_navigator node for section III of the rosject according to the tutorial. I get the following error:

[lifecycle_manager-5] [INFO] [1679357904.450561202] [lifecycle_manager_path_planning]: Configuring bt_navigator
[bt_navigator-3] [INFO] [1679357904.451416882] [bt_navigator]: Configuring
[bt_navigator-3] [ERROR] [1679357905.066196172] []: Caught exception in callback for transition 10
[bt_navigator-3] [ERROR] [1679357905.066240686] []: Original error: Could not load library: libnav2_single_trigger_bt_node.so: cannot open shared object file: No such file or directory
[bt_navigator-3] [WARN] [1679357905.066285944] []: Error occurred while doing error handling.
[bt_navigator-3] [FATAL] [1679357905.066303212] [bt_navigator]: Lifecycle node bt_navigator does not have error state implemented
[lifecycle_manager-5] [ERROR] [1679357905.067130382] [lifecycle_manager_path_planning]: Failed to change state for node: bt_navigator
[lifecycle_manager-5] [ERROR] [1679357905.067181139] [lifecycle_manager_path_planning]: Failed to bring up all requested nodes. Aborting bringup.

I was reading about similar problems in google and it could be related with ROS2 version but I don’t know how to solve it.

Best Regards
Ronaldo

Hi @w.ronaldo.cd ,

I think I have a small clue as to why you are getting the error.
This is because the rosject uses Foxy version, whereas the course uses Galactic version.

Some things that you copy-paste from Galactic version into Foxy version will not work.

From my experience, the only files having the problem is the bt_navigator.yaml file and the behavior.xml file.

Please post the following as code-block:

  1. Launch file containing the bt_navigator node.
  2. bt_navigator.yaml file
  3. behavior.xml file

I know which ones to remove after seeing your contents of the above files.

Regards,
Girish

Hi @girishkumar.kannan

behavior.xml:

<root main_tree_to_execute="MainTree">
  <BehaviorTree ID="MainTree">
    <RecoveryNode number_of_retries="6" name="NavigateRecovery">
      <PipelineSequence name="NavigateWithReplanning">
        <RateController hz="1.0">
          <RecoveryNode number_of_retries="1" name="ComputePathToPose">
            <ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
            <ClearEntireCostmap service_name="global_costmap/clear_entirely_global_costmap"/>
          </RecoveryNode>
        </RateController>
        <RecoveryNode number_of_retries="1" name="FollowPath">
          <FollowPath path="{path}" controller_id="FollowPath"/>
          <ClearEntireCostmap service_name="local_costmap/clear_entirely_local_costmap"/>
        </RecoveryNode>
      </PipelineSequence>
      <SequenceStar name="RecoveryActions">
        <ClearEntireCostmap service_name="local_costmap/clear_entirely_local_costmap"/>
        <ClearEntireCostmap service_name="global_costmap/clear_entirely_global_costmap"/>
        <Spin spin_dist="1.57"/>
        <Wait wait_duration="5"/>
      </SequenceStar>
    </RecoveryNode>
  </BehaviorTree>
</root>

bt_navigator.yaml

bt_navigator:
  ros__parameters:
    use_sim_time: True
    global_frame: map
    robot_base_frame: base_link
    odom_topic: /odom
    bt_loop_duration: 10
    default_server_timeout: 20
    default_nav_to_pose_bt_xml: "/home/user/ros2_ws/src/Navigation_rosject/project_path_planning/config/behavior.xml"
    plugin_lib_names:
    - nav2_compute_path_to_pose_action_bt_node
    - nav2_compute_path_through_poses_action_bt_node
    - nav2_follow_path_action_bt_node
    - nav2_back_up_action_bt_node
    - nav2_spin_action_bt_node
    - nav2_wait_action_bt_node
    - nav2_clear_costmap_service_bt_node
    - nav2_is_stuck_condition_bt_node
    - nav2_goal_reached_condition_bt_node
    - nav2_goal_updated_condition_bt_node
    - nav2_initial_pose_received_condition_bt_node
    - nav2_reinitialize_global_localization_service_bt_node
    - nav2_rate_controller_bt_node
    - nav2_distance_controller_bt_node
    - nav2_speed_controller_bt_node
    - nav2_truncate_path_action_bt_node
    - nav2_goal_updater_node_bt_node
    - nav2_recovery_node_bt_node
    - nav2_pipeline_sequence_bt_node
    - nav2_round_robin_node_bt_node
    - nav2_transform_available_condition_bt_node
    - nav2_time_expired_condition_bt_node
    - nav2_distance_traveled_condition_bt_node
    - nav2_single_trigger_bt_node
    - nav2_is_battery_low_condition_bt_node
    - nav2_navigate_through_poses_action_bt_node
    - nav2_navigate_to_pose_action_bt_node
    - nav2_remove_passed_goals_action_bt_node

Launch file:

def generate_launch_description():
    config_dir = os.path.join(get_package_share_directory('project_path_planning'), 'config')
    bt_navigator_yaml = os.path.join(config_dir, 'bt_navigator.yaml')
    return LaunchDescription([
        Node(
                package='nav2_bt_navigator',
                executable='bt_navigator',
                name='bt_navigator',
                output='screen',
                parameters=[bt_navigator_yaml]),

These are the files, thanks for your help.
Best regards,
Ronaldo

Hi @w.ronaldo.cd ,

Just as I thought, your behavior.xml and bt_navigator.yaml requires changes.
bt_navigator.yaml did not have certain plugin libraries for Foxy during its release, which includes nav2_compute_through_poses.

Below you can find the correct files for Foxy version - the ROS2 version used in rosject currently.

= = = = = = = = = =

behavior.xml:

<!--
  This Behavior Tree replans the global path periodically at 1 Hz, and has
  recovery actions. Obtained from the official Nav2 package
-->

<!-- Foxy Version -->
<root main_tree_to_execute="MainTree">
  <BehaviorTree ID="MainTree">
    <RecoveryNode number_of_retries="6" name="NavigateRecovery">
      <PipelineSequence name="NavigateWithReplanning">
        <RateController hz="1.0">
          <RecoveryNode number_of_retries="1" name="ComputePathToPose">
            <ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
            <ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
          </RecoveryNode>
        </RateController>
        <RecoveryNode number_of_retries="1" name="FollowPath">
          <FollowPath path="{path}" controller_id="FollowPath"/>
          <ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
        </RecoveryNode>
      </PipelineSequence>
      <ReactiveFallback name="RecoveryFallback">
        <GoalUpdated/>
        <SequenceStar name="RecoveryActions">
          <ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
          <ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
          <Spin spin_dist="1.57"/>
          <Wait wait_duration="5"/>
        </SequenceStar>
      </ReactiveFallback>
    </RecoveryNode>
  </BehaviorTree>
</root>

= = = = = = = = = =

bt_navigator.yaml (notice that a few plugins are removed):
NOTE / WARNING / ATTENTION:
Please replace <your_package_name> to your package containing the bt_navigator.yaml config file - in the parameter default_bt_xml_filename.
= = = = = = = = = =

# Foxy Version
bt_navigator:
  ros__parameters:
    use_sim_time: True
    global_frame: map
    robot_base_frame: base_footprint # base_link
    odom_topic: /odom
    enable_groot_monitoring: True
    groot_zmq_publisher_port: 1666
    groot_zmq_server_port: 1667
    default_bt_xml_filename: "/home/user/ros2_ws/src/<your_package_name>/config/behavior.xml"
    plugin_lib_names:
    - nav2_compute_path_to_pose_action_bt_node
    - nav2_follow_path_action_bt_node
    - nav2_back_up_action_bt_node
    - nav2_spin_action_bt_node
    - nav2_wait_action_bt_node
    - nav2_clear_costmap_service_bt_node
    - nav2_is_stuck_condition_bt_node
    - nav2_goal_reached_condition_bt_node
    - nav2_goal_updated_condition_bt_node
    - nav2_initial_pose_received_condition_bt_node
    - nav2_reinitialize_global_localization_service_bt_node
    - nav2_rate_controller_bt_node
    - nav2_distance_controller_bt_node
    - nav2_speed_controller_bt_node
    - nav2_truncate_path_action_bt_node
    - nav2_goal_updater_node_bt_node
    - nav2_recovery_node_bt_node
    - nav2_pipeline_sequence_bt_node
    - nav2_round_robin_node_bt_node
    - nav2_transform_available_condition_bt_node
    - nav2_time_expired_condition_bt_node
    - nav2_distance_traveled_condition_bt_node

= = = = = = = = = =

Also, when I asked you to share your launch file, I wanted the complete file contents, not just the Node declaration of bt_navigator. Please re-post the complete launch file.

Regards,
Girish

PS: The above referenced contents for the behavior.xml and bt_navigator.yaml were obtained from this post: Path planning error - ROS2 Navigation course - #3 by rtellez

1 Like