navigation2 icon indicating copy to clipboard operation
navigation2 copied to clipboard

BT XML Idea: Stop replanning when near the goal if path is valid

Open SteveMacenski opened this issue 2 years ago • 10 comments

When using feasible planners, it might not be sensible to replan when things are clear within X meters of the goal. It can actually be detrimental to do so if the finite change in path tracking error makes exact goals not possible once within < 1m to the goal result in some "looping" behaviors. This is totally unnecessary to achieve the goal successfully given the positional and rotational tolerances that the exact planners don't know about. Or due to correctable finite error in state estimation.

So, it seems very reasonable to use the goal distance BT node to check if we're with x meters of the goal and if so, select not to replan if the path continues to be totally valid (e.g. no occopancy). This could be added as either a new BT or modify existing BTs to take advantage of this knowledge

SteveMacenski avatar Dec 07 '23 22:12 SteveMacenski

That's a very sensible thing to do. Was thinking about doing something like that to prevent loops when near goal myself - it may be possible to use GoalReached BT node with high (1-3m) threshold for that purpose. Although I suspect that having a "path length" condition would be more correct - but there's no node for that yet.

P.S. I find it a bit strange that GoalReached BT node doesn't leverage goal checker plugins from Controller

VArt3m avatar Jan 26 '24 09:01 VArt3m

@shannonwarren Lets discuss here:

Making it based on a timer seems excessive, we could simply add a control flow node under the current rate timer which uses a condition node isGoalReached -- or more accurately would be to make a new one using the nav2_util for getting the integrated path distance.

If we're within the distance to the goal spatially or by integrated path length, then we can use isPathValid to check if the path is collision free. If its in collision, then replan. If not, pass on replanning.

We should be able to do this with no changes to existing BT nodes and possibly just creating 1 new BT node which just wraps an existing nav2_util function. Then its just organizing those stages using the basic control flow nodes

SteveMacenski avatar Jan 30 '24 18:01 SteveMacenski

Sounds good. I'll work on it.

shannonwarren avatar Jan 31 '24 17:01 shannonwarren

Did something similar for another project..

however, when the robot is in the goal radius with an obstacle, I just wait and not go for replanning..

https://github.com/ros-planning/navigation2/assets/20242192/60a72ab1-0507-4162-b836-2e836dddf428

padhupradheep avatar Apr 11 '24 12:04 padhupradheep