ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

I want to disable spin and backup in nav22.

asked 2022-04-30 01:06:28 -0500

hamada gravatar image

updated 2022-05-01 16:05:29 -0500

ljaniec gravatar image

I only want to use the wait on the RECOVERIES_SERVER when I am stuck. I changed recovery_plugins to "wait" only, but it fails to start. in ros2 galactic

recoveries_server:   
  ros__parameters:
    costmap_topic: local_costmap/costmap_raw
    footprint_topic: local_costmap/published_footprint
    cycle_frequency: 10.0
    # recovery_plugins: ["wait"]
    recovery_plugins: ["wait", "spin", "backup"]
    spin:
      plugin: "nav2_recoveries/Spin"
    backup:
      plugin: "nav2_recoveries/BackUp"
    wait:
      plugin: "nav2_recoveries/Wait"
    global_frame: odom
    robot_base_frame: base_link
    transform_timeout: 0.1
    use_sim_time: False
    simulate_ahead_time: 2.0
    max_rotational_vel: 1.0
    min_rotational_vel: 0.4
    rotational_acc_lim: 3.2
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2022-05-02 02:26:03 -0500

Joe28965 gravatar image

The behavior tree decides what to do. The default behavior tree has a spin and backup in the RecoveryFallback.

What you're doing isn't changing the behavior tree, but changing what plugin is linked to what name. You're removing the plugins without removing the reference to them in the behavior tree.

You'll need to make your own behavior tree without the spin and backup plugins and use that in Nav2.

edit flag offensive delete link more
0

answered 2022-05-01 16:15:27 -0500

ljaniec gravatar image

updated 2022-05-02 19:08:38 -0500

EDIT: This isn't enough, you need to modify Behavior Tree too. Sorry for misleading before.


Did you try with something like:

recoveries_server:
  ros__parameters:
    costmap_topic: local_costmap/costmap_raw
    footprint_topic: local_costmap/published_footprint
    cycle_frequency: 10.0
    recovery_plugins: ["wait"]
    wait:
      plugin: "nav2_recoveries/Wait"
    global_frame: odom
    robot_base_frame: base_link
    transform_timeout: 0.1
    use_sim_time: true

based on:

https://navigation.ros.org/configurat... ?


Modification of the Behavior Tree - you can use the Groot. For the ROS2 Galactic use:

   cd ~/dev_ws/src
   git clone https://github.com/BehaviorTree/Groot.git
   cd ..
   rosdep install --from-paths src --ignore-src
   colcon build --symlink-install --packages-select groot

I have sudo apt install ros-galactic-behaviortree-cpp-v3 before too.

You have to source install/setup.bash and ./build/groot/Groot.

You can load BT XMLs from the Nav2 repository and modify it, e.g. like this:

root main_tree_to_execute="MainTree">
    <BehaviorTree ID="MainTree">
        <Control ID="RecoveryNode" name="NavigateRecovery" number_of_retries="6">
            <Control ID="PipelineSequence" name="NavigateWithReplanning">
                <Decorator ID="RateController" hz="0.333">
                    <Control ID="RecoveryNode" name="ComputePathThroughPoses" number_of_retries="1">
                        <ReactiveSequence>
                            <Action ID="RemovePassedGoals" input_goals="{goals}" output_goals="{goals}" radius="0.7"/>
                            <Action ID="ComputePathThroughPoses" goals="{goals}" path="{path}" planner_id="GridBased" start=""/>
                        </ReactiveSequence>
                        <ReactiveFallback name="ComputePathThroughPosesRecoveryFallback">
                            <Condition ID="GoalUpdated"/>
                            <Action ID="ClearEntireCostmap" name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
                        </ReactiveFallback>
                    </Control>
                </Decorator>
                <Control ID="RecoveryNode" name="FollowPath" number_of_retries="1">
                    <Action ID="FollowPath" controller_id="FollowPath" goal_checker_id="GoalChecker" path="{path}"/>
                    <ReactiveFallback name="FollowPathRecoveryFallback">
                        <Condition ID="GoalUpdated"/>
                        <Action ID="ClearEntireCostmap" name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
                    </ReactiveFallback>
                </Control>
            </Control>
            <ReactiveFallback name="RecoveryFallback">
                <Condition ID="GoalUpdated"/>
                <Control ID="RoundRobin" name="RecoveryActions">
                    <Sequence name="ClearingActions">
                        <Action ID="ClearEntireCostmap" name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
                        <Action ID="ClearEntireCostmap" name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
                    </Sequence>
                    <Action ID="Wait" wait_duration="5"/>
                </Control>
            </ReactiveFallback>
        </Control>
    </BehaviorTree>
</root>
edit flag offensive delete link more

Comments

2

That wouldn't be sufficient, you need to remove spin / backup from the behavior tree XML file you're using as well so its not trying to call those behaviors. The Behavior Tree is what actually defines the navigation logic.

stevemacenski gravatar image stevemacenski  ( 2022-05-02 16:07:18 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-04-30 01:06:28 -0500

Seen: 440 times

Last updated: May 02 '22