Skip to content
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

Merged
merged 2 commits into from
May 6, 2024
Merged

Add reassign task allocation API #348

merged 2 commits into from
May 6, 2024

Conversation

xiyuoh
Copy link
Member

@xiyuoh xiyuoh commented May 6, 2024

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.

Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
@xiyuoh xiyuoh requested a review from mxgrey May 6, 2024 09:27
//==============================================================================
FleetUpdateHandle& FleetUpdateHandle::reassign_dispatched_tasks()
{
_pimpl->reassign_dispatched_tasks([]() {}, [](auto) {});
Copy link
Contributor

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()
Copy link
Contributor

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>
@xiyuoh
Copy link
Member Author

xiyuoh commented May 6, 2024

Thanks for the review @mxgrey , comments are addressed in 7a1b24c

@mxgrey mxgrey merged commit 915f9c5 into main May 6, 2024
3 of 4 checks passed
@mxgrey mxgrey deleted the xiyu/reassign_tasks branch May 6, 2024 12:20
arjo129 pushed a commit that referenced this pull request Jun 7, 2024
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
Signed-off-by: Arjo Chakravarty <arjoc@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants