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

[ros2]: Fixed preempting of execution #363

Open
wants to merge 3 commits into
base: ros2
Choose a base branch
from

Conversation

JafarAbdi
Copy link
Member

Same as JafarAbdi#6

@JafarAbdi
Copy link
Member Author

@mechwiz Please review

@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #363 (fcdce1e) into ros2 (0128cd9) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             ros2     #363      +/-   ##
==========================================
- Coverage   38.85%   38.82%   -0.03%     
==========================================
  Files          78       78              
  Lines        7520     7526       +6     
==========================================
  Hits         2921     2921              
- Misses       4599     4605       +6     
Impacted Files Coverage Δ
core/src/task.cpp 61.36% <0.00%> (-1.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0128cd9...fcdce1e. Read the comment docs.

@mechwiz
Copy link
Contributor

mechwiz commented May 17, 2022

I tested these changes on a project I'm working on and can verify they work. LGTM!

@@ -95,7 +97,8 @@ void ExecuteTaskSolutionCapability::initialize() {
ActionServerType::CancelCallback(
std::bind(&ExecuteTaskSolutionCapability::preemptCallback, this, std::placeholders::_1)),
ActionServerType::AcceptedCallback(
std::bind(&ExecuteTaskSolutionCapability::goalCallback, this, std::placeholders::_1)));
std::bind(&ExecuteTaskSolutionCapability::goalCallback, this, std::placeholders::_1)),
Copy link
Member

Choose a reason for hiding this comment

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

I believe the std::bind isn't needed here since 1 argument is expected

wyattrees and others added 3 commits May 26, 2022 16:32
…ting the goal so it does not block the server from accepting a cancel request. While client is waiting for the result future, repeatedly check if preempting was requested and send a cancel request if it was
Copy link
Contributor

@v4hn v4hn left a comment

Choose a reason for hiding this comment

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

preempt was added to allow the user to stop planning.
As execution is just a thin wrapper around the action server it seems like a clumsy interface to repurpose preempt for execution instead.

Wouldn't it be better and more flexible to expose the action client to the user to cancel execution there?

error_code.val = moveit_msgs::msg::MoveItErrorCodes::PREEMPTED;
return error_code;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that really the best we can do for this kind of feature? 10ms waits are quite bad style :(

@henningkayser henningkayser self-requested a review April 20, 2023 16:08
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.

5 participants