-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add reassign task allocation API #348
Conversation
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
//============================================================================== | ||
FleetUpdateHandle& FleetUpdateHandle::reassign_dispatched_tasks() | ||
{ | ||
_pimpl->reassign_dispatched_tasks([]() {}, [](auto) {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be scheduled inside of the fleet handle's worker, similar to what's done for the RobotUpdateHandle version of this function. Neglecting to do that can lead to segmentation faults and undefined behavior.
@@ -2538,6 +2538,13 @@ FleetUpdateHandle& FleetUpdateHandle::set_retreat_to_charger_interval( | |||
return *this; | |||
} | |||
|
|||
//============================================================================== | |||
FleetUpdateHandle& FleetUpdateHandle::reassign_dispatched_tasks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning FleetUpdateHandle&
is generally done in situations where users may want to chain a series of function calls. Usually that's when you're changing some settings for a class.
This function is triggering a distinct action, so I don't think it makes sense stylistically to chain any more function calls after it. Let's just return void
from this function.
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org> Signed-off-by: Arjo Chakravarty <arjoc@google.com>
This PR exposes the
reassign_dispatched_tasks
API to be usable from fleet adapter implementations. This allows users to request for a replan of task allocation at runtime in scenarios, especially in scenarios where a robot may be stuck on a task longer than expected with a queued task.