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

Release other mutexes if robot started charging #334

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

xiyuoh
Copy link
Member

@xiyuoh xiyuoh commented Mar 15, 2024

This PR aims to release any mutex groups a robot may be holding once it starts charging at its dedicated charging waypoint. This is to ensure that mutex groups won't be stuck with a stationary robot for an indefinite period of time, blocking other robots from moving into these mutexes.

Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
@xiyuoh xiyuoh requested a review from mxgrey March 15, 2024 07:19
retain_mutexes.insert(
graph.get_waypoint(charging_waypoint).in_mutex_group());
_context->retain_mutex_groups(retain_mutexes);
RCLCPP_INFO(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick to make this message more useful. Let's change it to something like this:

if (retain_mutexes.front().empty())
{
  RCLCPP_INFO(
    _context->node()->get_logger(),
    "Robot [%s] is waiting to charge. All its mutex groups will be released.",
    _context->name().c_str());
}
else
{
  RCLCPP_INFO(
    _context->node()->get_logger(),
    "Robot [%s] is waiting to charge. It will retain only the mutex group [%s].",
    _context->name().c_str(),
    retain_mutexes.front().c_str());
}

Giving more specific information can make confusing situations easier to debug.

mxgrey and others added 2 commits March 19, 2024 23:09
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
@xiyuoh xiyuoh requested a review from mxgrey March 20, 2024 01:40
@mxgrey mxgrey merged commit 0ba447f into main Mar 25, 2024
3 of 4 checks passed
@mxgrey mxgrey deleted the xiyu/retain_charger_mutex branch March 25, 2024 05:22
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