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

Update running controller goal also when we are preempting it #345

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class AbstractActionBase
// if there is already a plugin running on the same slot, cancel it
slot_it->second.execution->cancel();

// TODO + WARNING: this will block the main thread for an arbitrary time during which we won't execute callbacks
// WARNING: this will block the main thread for an arbitrary time during which we won't execute callbacks
Copy link
Collaborator Author

@corot corot Aug 21, 2024

Choose a reason for hiding this comment

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

Still true, e.g. if the old and new goals have different controller.

if (slot_it->second.thread_ptr->joinable()) {
slot_it->second.thread_ptr->join();
}
Expand Down
3 changes: 2 additions & 1 deletion mbf_abstract_nav/src/controller_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ void ControllerAction::start(
if(slot_it != concurrency_slots_.end() && slot_it->second.in_use)
{
boost::lock_guard<boost::mutex> goal_guard(goal_mtx_);
const auto slot_status = slot_it->second.goal_handle.getGoalStatus().status;
if ((slot_it->second.execution->getName() == goal_handle.getGoal()->controller ||
goal_handle.getGoal()->controller.empty()) &&
slot_it->second.goal_handle.getGoalStatus().status == actionlib_msgs::GoalStatus::ACTIVE)
(slot_status == actionlib_msgs::GoalStatus::ACTIVE || slot_status == actionlib_msgs::GoalStatus::PREEMPTING))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

{
ROS_DEBUG_STREAM_NAMED(name_, "Updating running controller goal of slot " << static_cast<int>(slot));
update_plan = true;
Expand Down
Loading