I am currently using the navigation stack to move around the robots in the map I created, in gazebo. I would like to apply my own algorithm for the update of the path. But in order this to happen, the navFn should stop publishing the new path when an obstacle is found. I have checked the parameters, but still I haven't made it. Does anyone know how to stop updating the global path ? Thanks a lot. I am using ros noetic. In this [google drive(https://drive.google.com/drive/folders/12kSo0-at20sOO92Nx2kuba7VNU2ruIgM?usp=drive_link). I have a video showing the code, and the source code
3 Answers
Assuming that "planner_frequency" is set to 0.0, it's not really that navFn is "publishing a new path when an obstacle is found" but rather that your local planner/controller is giving up too easily - which then causes move_base to fall back on the global planner (navFn).
Assuming the your algorithm is encapsulated in the local planner/controller you are running, then the goal should be to increase the amount of time that the controller gets before falling back to the global planner.
One approach would be to increase the "controller_patience" parameter in move_base - this is the amount of time (in seconds) that the controller is given to try and find a path. When that amount of time expires, a recovery behavior will be run (if defined) and then the controller will get another "controller_patience" amount of time to try again.
The amount of time your controller gets before navFn gets another chance to plan would be:
"controller_patience" x max("number of recovery behaviors defined", 1)
-
$\begingroup$ I could make that work, with this way. I did set the controller_patience: 10000000, but the same effect. In this [google drive] (drive.google.com/drive/folders/…) I have a video showing the code, and the source code $\endgroup$– MichalisCommented Oct 14, 2023 at 18:37
In move_base_params I changed the planner_frequency to 0. It doesn't update the route, but only when a collision with a dynamic object happens it is recalculated.
shutdown_costmaps: false
controller_frequency: 10.0
planner_patience: 5.0
controller_patience: 15.0
conservative_reset_dist: 3.0
planner_frequency: 0
oscillation_timeout: 10.0
oscillation_distance: 0.2
-
$\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$– Community BotCommented Oct 17, 2023 at 14:01
You can do this by selecting the Behavior Tree that let the path planner publish every X meters driven, in my case, the global path is updated every time the robot runs 100 m.
Just add in your confirmation file:
bt_navigator:
ros__parameters:
…
default_nav_to_pose_bt_xml: "<your_path>/ros2_ws/src/navigation2/nav2_bt_navigator/behavior_trees/navigate_w_replanning_distance.xml"
And in the xml file replace the 1 m set by default by the desired distance.
-
$\begingroup$ I use ros1 noetic, I believe what u suggest is for ros2 $\endgroup$– MichalisCommented Oct 18, 2023 at 7:55
-
$\begingroup$ Also, I am not quite sure what is the Behavior Tree that you descried. I don't know where it is. $\endgroup$– MichalisCommented Oct 18, 2023 at 7:57
-
$\begingroup$ You are right Michalis. I didn’t realize the question was for ROS1. Sorry for the confusion. $\endgroup$ Commented Oct 18, 2023 at 11:51