ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.3k stars 1.2k forks source link

Unable to Change default_nav_to_pose_bt_xml From .yaml file #4488

Closed mich1342 closed 1 week ago

mich1342 commented 1 week ago

Bug report

Required Info:

Steps to reproduce issue

Edit Nav2 .yaml param file to use another default BT.xml file for navigate to pose based on the reference mentioned here

example:

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
    wait_for_service_timeout: 1000
    default_nav_to_pose_bt_xml: /absolute/path/to/yaml/file
    # 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
    # nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
    # nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
    # They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
    plugin_lib_names:
      - nav2_compute_path_to_pose_action_bt_node
      - nav2_compute_path_through_poses_action_bt_node

The new xml file is the default navigate_to_pose_w_replanning_and_recovery.xml file with small modification where I comment out the Spin and BackUp recovery behaviors as shown below:

<!--
  This Behavior Tree replans the global path periodically at 1 Hz and it also has
  recovery actions specific to planning / control as well as general system issues.
  This will be continuous if a kinematically valid planner is selected.
-->
<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/>
        <RoundRobin name="RecoveryActions">
          <Sequence name="ClearingActions">
            <ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
            <ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
          </Sequence>
          <!--<Spin spin_dist="1.57"/>-->
          <Wait wait_duration="5"/>
          <!--<BackUp backup_dist="0.30" backup_speed="0.05"/>-->
        </RoundRobin>
      </ReactiveFallback>
    </RecoveryNode>
  </BehaviorTree>
</root>

Expected behavior

The robot will just wait where it has nowhere to go

Actual behavior

The robot would not receive any navigate to pose command and just stay in place

Additional information

If I change the default navigate_to_pose_w_replanning_and_recovery.xml file, everything works fine


Feature request

Feature description

Implementation considerations

SteveMacenski commented 1 week ago

This seems to work. I just added a:

    default_nav_to_pose_bt_xml: "fake/path/to/navigate_to_pose_bt.xml"

And I see the BT Navigator failing and telling me it can't find the XML. That means that its taking what the parameter is throwing down.

[component_container_isolated-5] [ERROR] [1719337838.731281075] [bt_navigator]: Couldn't open input XML file: fake/path/to/navigate_to_pose_bt.xml
[component_container_isolated-5] [ERROR] [1719337838.731352487] [bt_navigator]: Error loading XML file: fake/path/to/navigate_to_pose_bt.xml

The robot would not receive any navigate to pose command and just stay in place

This probably means that your new BT file might just be invalid - either incorrect path or its not properly formed (like the error I posted above). Read the logs and file a ticket on Robotics Stack Exchange if its not obvious to you why it failed.


In the future if you file tickets, review it after you post, most of your ticket didn't render and I had to go in and modify to see the BT and read the yaml.