-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
BTActionNode does not abort #1652
Comments
That is a valid point. When I designed this, I was thinking that the action servers only abort when preempted. This check is added because when a server is preempted (like when a controller gets a new path from the global planner at 1hz) the return code is abort. I think this is a good bug to consider. How do you propose dealing with preemption to also differ from aborted because the server itself decided to fail? |
Well I think the server has to tell why it aborted, otherwise it's just guessing and assuming on the client side. |
PR and discussions for implementation are welcome. |
Looking a bit into this and it could be a bigger change than expected. So by customizing this call, one could at least distinguish between a preempted goal and an erroneous server. Another possibility would be to pass a specific result to the The client has to assume a preemption by checking for an empty result msg though. |
What would that solution look like? That actually sounds very reasonable and I've long felt that was necessary. We didn't do it before because we didn't have action server return types before. This PR #1586 adds feedback to all the action servers (which I've been lazy have haven't closed up, I need to do that soon). Having a PR to implement result types is totally reasonable and should be I'd argue should be done. Does that resolve the preemption vs failure conditions for returning the For argument's sake, if we did make them all use the I'm not sure I understand the first suggestion you mentioned. Can you clarify if you feel if its a better solution than the terminate one? The best that I can tell, this suggests making the |
@maxlein any update? |
Hi all, I met the same issue in #1683, and I found the ResultCode is ABORTED when not only the controller_server receives a new goal but also the planner_server fails to create a new path. |
Sorry, lot of work atm ...
That's what I meant. Just that we only have to adapt at one place and let all the clients as is. It's less work to do and something like a quick fix but without error codes doesn't make sense looking at the nav stack in a more general way.
We have two options I think:
Personally I don't like to have any assumptions or constraints one has to look for but depends if it could save a lot of refactoring. As an example, if we have just one status msg, we would need to change only: to check for the preempted state. In my test I have a NavigationResult.msg which looks like that for the moment:
The question is also if there is a need for customized result states, or if we just have a bunch of states in there? And if someone needs an extra state, add it and make a PR or build nav2_msgs from source. |
I'm a little unplugged from this issue for the moment. Forgive me if below is obvious. The ending take a That would be general and minimal changes required
I imagine this status just says something like: FAILED, PREEMPTED, SUCCEEDED, CANCELLED (pulling from ROS1 http://docs.ros.org/kinetic/api/actionlib_msgs/html/msg/GoalStatus.html). different from your suggested GENERIC_ERROR, etc. I think these convey the message well. It's not immediately clear to me why it appears to work for the controller, though. I see in the controller server when the algorithm fails it does a That makes me wonder why there is no rclcpp_action preemption distinction, I filed a ticket for that in rclcpp and we'll see what they say (ros2/rclcpp#1104). That's the "best" solution in my mind, because then we just switch the Edit: On your comment about removing the |
Good point, didn't look that deep. That's the way to go.
Yes, preemptions are not working ;). But in my case it can't happen so this is not an issue for my "custom" controller right now. |
I think the path forward is
The alternative to modifying rclcpp_actions is to:
Either way, your mentioning of having the result message tell the caller why it failed is valuable. If you're open to submitting PR to implement that for the planner / controller, that would be valuable. On its own, the BT navigator would ignore them, but at least they're there for use later or if called by other clients. The alternative is obviously less ideal since we have redundant information in the ResultCode from the action server and the result statuses. Also adds more complexity for the BT designers. Also isn't a generic fix. But the +1 is that its all in our repos we control and can push through. Thoughts? |
Hi all, Here #1683 (comment) is what I've tested. Currently, I don't have any ideas about how to improve this because I'm not familiar enough about rclcpp_action. By the way,
Is it the reason my global plan cannot avoid a dynamic obstacle because preemptions are not working? |
I may have time to look into rclcpp_actions next week. @QQting I don‘t think that has something to do with your problem. |
@QQting I don't think you actually need to know very much about rclcpp_actions. I've taken some looks at it in the past, but really all you're doing is adding an extra option to the API for I think that's actually a really good intro-to-rclcpp task.
I'm not exactly sure what you mean by that. Can you give us a gif or something in your ticket? |
@SteveMacenski |
@QQting I can't tell for sure without more analysis but what that looks like to me is that your planner is preempting your controller and since you removed the abort, the controller will exit and you're just driving with the last residual command (unsafely). Your problem would be solved by the solutions in this discussion. |
Looking at rclcpp it may not be only "adding" the preempt function like the abort is done. Otherwise we need to take the alternative to modifying rclcpp... |
Don't expect OR to do this for us. We will likely need to take the initiative and do it. It really shouldn't take all that much time. |
ros2/rclcpp#1117 implements the suggested preempt API |
@maxlein @SteveMacenski |
I think this will take some time. We have to wait for the PR's in rclcpp and rcl_interfaces to go through which will be after the foxy release I think. |
It is going to take a bit of time. We need to:
@QQting @maxlein the design part as described here (ros2/rclcpp#1104 (comment)) is another place to help out. If you can help with that, then @naiveHobo's job is much easier. |
I am running into this issue now on eloquent and foxy, I reproduce like this: Set another navigation goal through rviz, and confirm there is no log output from the controller server. Sample log output, abort is caused due to a tf timeout:
|
Signed-off-by: Daisuke Sato <[email protected]>
Signed-off-by: Daisuke Sato <[email protected]>
I'm running into this issue and have been playing with this. How about this patch while waiting for the interface change? Set the result anyway in the callback, and then in the next master...CMU-cabot:bt-action-node-fix (updated) |
What is the goal status when it was given a new goal? This patch looks if the goal handle is aborted and therefore not updated (because if it were updated, it would be not in that state). Is that correct? Another option would be to compare the goal IDs with Not a great solution, but I think it probably gets us temporarily past our issues that I can live with. |
Signed-off-by: Daisuke Sato <[email protected]>
@SteveMacenski |
Signed-off-by: Daisuke Sato <[email protected]>
Signed-off-by: Daisuke Sato <[email protected]>
Signed-off-by: Daisuke Sato <[email protected]>
This is technically fixed in a way that I don't see any medium term shortcomings. I'm going to close this ticket but that's not to say we shouldn't also work on actually implementing preemption in rclcpp_actions. We have several tickets open for that already and once complete we can update our state machine to use it. |
I am wondering about these lines here:
https://github.com/ros-planning/navigation2/blob/b01810bcf5da97620afa53ec047f54f34c80c3e1/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp#L221-L223
If the goal is aborted, the result is veiled as it would have never reached the client and thus abort() won't get called:
https://github.com/ros-planning/navigation2/blob/b01810bcf5da97620afa53ec047f54f34c80c3e1/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp#L160-L165
Maybe someone can explain the logic behind that, I don't get it.
It took me a while to see that, because I was thinking the action service itself is somehow misbehaving on network layer.
If I remove the if clause, everything works as expected when for example the controller is aborting.
The text was updated successfully, but these errors were encountered: