New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Graceful cancellation of follow_path
actions
#4033
Comments
Have you tried using the That should square you away :-) Its also enabled by default since Iron and newer If that's not workable, I'm sure we could expose the controller plugin another option for what to do on cancellation for reducing speed. But, I'll admit that seems overkill unless there's more you want to do than just decelerate by dynamic limits. |
The idea is to decelerate by dynamic limits whilst tracking the path. When following a turn, it would be undesired to slow down in a straight line upon a cancel action, which I think/guess is what the |
I also don't think that's actually a generically safe solution? Deceleration in turns could cause the kinds of "throwing loads off my robot top" that the instantaneous braking could due to centrifugal forces. I imagine as well there are techniques where reducing the velocity scale will actually make it deviate off the path due to its internal modeling (thinking MPC/MPPI which are maintaining some state) This isn't my opposition to your request - just throwing out some additional constraints perhaps that weren't considered giving me pause |
The Vel Smoother will ramp down from the last request to the zero velocity. It won't necessarily be a straight line. If there's some non-zero angular component, that will be ramped down too by its own deceleration constraints. The The eta scaling was written so that invalid acceleration profile jumps wouldn't create different than intended motion vectors (which previous ROS 1 velocity smoothers did). I don't think its the role of the velocity smoother to make the robot change direction, even if ever so slightly - its role is to scale the intent down to what's possible. It wasn't written with the intention of this stoppage case in mind, but I think that is also beneficial here. So if moving straight, it'll be a straight line. If turning, it'll continue with the turning maneuver's velocity from the last command sent. It is obviously not predictive for different path-tracking behavior beyond that last non-zero command, but perhaps that's sufficient? I'd say so for many applications, but I don't know what your stopping distances are with your set deceleration constraints. If you're stopping distance is 5m in dense shelving, then yeah, probably not 😆 |
When the robot is paused during operation (no emergency stop) it'll slow down with these parameters:
That means it takes ~15 seconds to fully slow down. The braking distance is (if I remember correctly)
Driving 30 meters without following the path will not work for us. Image being on a straight line just before a turn, the robot would continue driving straight and drive 30 meters off the path. I think our requirements are a bit different than a lot of other users, but it would be nice if we could stick to a common standard. Does that command velocity smoother have access to the path? That would solve the problem. Otherwise the controller could signal when a cancel was handled so we can have ~15 seconds of extra control time. |
Ah ok. I understand the need then better. The velocity smoother doesn't have access to the path, but I suppose it could be made to have it. The main question I'd have there is how to follow the path in that cancel ramp down? I think a path forward here would be for you to propose a design to enable this for us to discuss. Once we agree, I'm also agreeing to merge that in once you put up a PR. A gut instinct would be to have a new Controller plugin API for handling cancellations. I'm not 100% sure what that would entail internally off hand, but this is clearly something you've thought about so I'll leave that to your experience :-). The Controller Server can call that cancel API when a cancel request is formed. Or, I suppose it could flip a state and call the cancel API instead of the compute API in the The only request I'd have beyond what you'd naturally do anyway would be to implement such a cancellation ramp down for +1 of the existing controllers so that there is an example of it to build from with the others. If you're already going to modify one of them for your needs that you use currently, I'd ask that you do a second just to help what otherwise I'll have to come back and do (or if you want to be very generous, do them all, which I would appreciate :-) ) |
Thank you for your answer. I'll come back with a proposal |
@Rayman any update? :-) |
I'm trying to figure out which API we could use. I have nav2 building from souce and I'm trying to modify the pure pursuit planner to handle cancellation. But I'm bumping against some issues with the simulator (and another project which wants my attention) At the moment I have // Signal the controller that a cancellation is requested. By default returns true to indicate an immediate cancellation is OK.
bool cancel() If you return false you get an extended gracefull cancel. But I'm not really happy with raising an expection to indicate a successful cancellation, so I'm thinking some other methods. |
Maybe setting something in the is_cancel_requested conditional? I think there are 2 places that jump out to me:
The second seems like the most reasonable to share as much as possible and keep the cancel control have the same loop rate and behavior as main control and have just some |
Feature request
Ability to let controllers handle cancelations gracefully
Feature description
At the moment when the
follow_path
action is cancelled, a zero velocity is immediately published (see the code and the figure below).We have a big heavy robot that needs a lot of time to slow down so we want to keep following the current path while decelerating within the deceleration limits.
With move base flex, we could override the
cancel
method and return when the cancellation was performed (seemagazino/move_base_flex#171)
Is there a way to achieve this graceful cancel or can we add the same API to Navigation2?
The text was updated successfully, but these errors were encountered: