ros-navigation / navigation2

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

Feature Request: Enhanced Filter with Rescue Mode for Accidental Entries into 'Keep Out' Zones #4085

Closed BCKSELFDRIVEWORLD closed 8 months ago

BCKSELFDRIVEWORLD commented 8 months ago

Required Info:

Feature description

Current Situation:

-The 'keepout' filter effectively prevents the robot from entering certain areas, influencing the path planner. However, minor localization discrepancies can sometimes lead to accidental entries into 'keep out' zones. This issue is particularly prevalent in variable environments. -The 'speed filter' slows down the robot upon entering specific areas, but it does not influence the global planner as it does not create additional cost around these areas.

Proposed Solution:

I propose a new filter that will function as a rescue mode during accidental entries into 'keep out' zones. This filter will gradually slow down the robot and provide time to correct localization discrepancies. Specifically, this new filter will:

Implementation considerations

This improved filter will enhance both the safety and navigation capability of the robot, especially in complex or variable environments, by mitigating risks associated with unintended entries into restricted areas.

SteveMacenski commented 8 months ago

Nice feature request! The keepout / other filters all have disable/enable parameters or services that can be dynamically turned off and on. While that is a pretty good first order solution, if you have to disable it to get out, then it can navigate freely within that keepout zone until it leaves.

I don't think your suggested solution is a great fix though. Slowing the robot if its in a keepout zone doesn't seem like it'll help much. Something better to do would be to check the robot's pose and do something based on that. For instance, if the robot is detected to be within a keepout zone, change the keepout cost from LETHAL to 252 (1 below inscribed) to make it very high cost so that the robot tries to navigate out of it. Once the robot's pose is detected to be out of the zone, it resumes being set to lethal.

Another way of handling this that's a bigger development effort would be to change the get cost API to consider the previous pose and the current pose of the robot. In that case, we set it to lethal if the previous step is non-keepout and the current is keepout. But once current is keepout, the next would be 252. I don't have a fully baked idea there yet though, but I think more something to consider in the long-term. I'll fully acknowledge that relative to the great strides made in the last 5 years in Nav2 in planning, control, behaviors, and flexibility, the costmaps are an area that haven't yet received the same level of attention. But more of these kinds of feature requests and applications help in the eventual design (and motivate me to increase the priority if I hear alot of complaints)

If you simply want to slow your robot when in keepouts, you could just set your keepouts and speed zones to be the same, and set the keepouts to be 252 always. You could get the behavior you mention right now where it would still virtually be a keepout