ros-navigation / navigation2

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

controller_server `computeControl()` blocks simple_action_server `work()` #4443

Closed ClaudiuDan closed 2 weeks ago

ClaudiuDan commented 2 weeks ago

I've been recently getting Timed out while waiting for action server to acknowledge goal request errors. I noticed that work() from simple_action_server.cpp calls computeControl().

computeControl() is blocking, so the rest of the work() function won't be executed. I also noticed that accept_pending_goal() is called both from computeControl() and from work().

The reason for my timeout errors is that, sometimes, the controller server is not fast enough to acknowledge the new goal request. This can be fixed by simply increasing the timeout, however, I am a bit confused about whether this is the way to go. I can see there is some functionality here for handling new goals async, but this does not seem to be used (computeControl is entered only once, then it handles the goal updates by itself). Is there any reasoning behind this or am I getting things wrong?

SteveMacenski commented 2 weeks ago

This is all the expected workflow. work is called after the goal is acked and is supposed to block for the callback to do its work. You can see this action wrapped used in all Nav2 task servers successfully!

accept_pending_goal within the task server is to handle preemption requested goals, not initial goals. It is possible however if you haven't properly implemented your action server, then you're not querying if there are pending preemption goals waiting to accept. Then you might see this error, but that is w.r.t. your implementation of the action server's callbacks and workflows. This works for all Nav2 task servers and might be a good source of learning for you in implementing your own. If you're having issues with the initial goals, then its probably a typo on your action server or other issues that isn't hooking up your client to your server so the client cannot communicate with it.

If you have any additional followups, please ask on Robotics Stack Exchange, this is not the right place for Q&A but I appreciate that you thought that there might a bug when you filed this.