I don't know how to create an xml file using PlannerSelector

asked 2023-05-11 04:21:30 -0600

hamada gravatar image

updated 2023-05-11 04:23:50 -0600

I don't know how to create an xml file using PlannerSelector

OS:Ubuntu 20.04
ROS: ros2 galactic
I want to use PlannerSelector for Navigation2.
I found that I can enable the function by appending planner_selector to the xml file.
However, I do not know how to add the xml.
Where should I insert it?

<!--
  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="999" name="NavigateRecovery">
      <PipelineSequence name="NavigateWithReplanning">
        <RateController hz="1.0">
          <RecoveryNode number_of_retries="999" name="ComputePathToPose">
            <PlannerSelector selected_planner="{selected_planner}" default_planner="GridBased" topic_name="planner_selector"/>
            <ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
            <ReactiveFallback name="ComputePathToPoseRecoveryFallback">
              <GoalUpdated/>
              <ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
            </ReactiveFallback>
          </RecoveryNode>
        </RateController>
        <RecoveryNode number_of_retries="999" name="FollowPath">
          <FollowPath path="{path}" controller_id="FollowPath"/>
          <ReactiveFallback name="FollowPathRecoveryFallback">
            <GoalUpdated/>
            <ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
          </ReactiveFallback>
        </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="0.0"/>
          <Wait wait_duration="3"/>
          <BackUp backup_dist="0.0" backup_speed="0.025"/>
        </RoundRobin>
      </ReactiveFallback>
    </RecoveryNode>
  </BehaviorTree>
</root>
edit retag flag offensive close merge delete

Comments

image description
now Groot

output

[

amcl-2] [INFO] [1683798897.930917248] [amcl]: Setting pose (4351.394373): 0.072 0.058 -0.033
[bt_navigator-7] [INFO] [1683798900.358313968] [bt_navigator]: Begin navigating from current location to (-5.29, 3.56)
[bt_navigator-7] [ERROR] [1683798900.358597878] [BehaviorTreeEngine]: Behavior tree threw exception: Recovery Node 'NavigateRecovery' must only have 2 children.. Exiting with failure.
[bt_navigator-7] [ERROR] [1683798900.358658694] [bt_navigator]: Goal failed
[bt_navigator-7] [WARN] [1683798900.358693059] [bt_navigator]: [navigate_to_pose] [ActionServer] Aborting handle.
hamada gravatar image hamada  ( 2023-05-11 04:57:59 -0600 )edit