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

Fixed preempting of execution #6

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

Conversation

JafarAbdi
Copy link
Owner

Rebased #3 on ros2 and small clean-up to minimize diff for later sync between master & ros2 branches

@JafarAbdi
Copy link
Owner Author

JafarAbdi commented Aug 6, 2021

@wyattrees @henningkayser Could you please review this .?

while (result_future.wait_for(std::chrono::milliseconds(10)) != std::future_status::ready) {
if (pimpl()->preempt_requested_) {
auto cancel_future = ac->async_cancel_goal(goal_handle);
if (rclcpp::spin_until_future_complete(node, cancel_future) != rclcpp::FutureReturnCode::SUCCESS) {

Choose a reason for hiding this comment

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

why do we need to spin here? I thought that there would be an executor spinning the node already, no?

Copy link
Owner Author

Choose a reason for hiding this comment

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

As you can see here it's created locally only for execution

Choose a reason for hiding this comment

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

I guess that makes sense for now... But aren't there some stages that depend on ROS interfaces? Those will need an executor as well, no?

@@ -87,6 +87,8 @@ namespace move_group {
ExecuteTaskSolutionCapability::ExecuteTaskSolutionCapability() : MoveGroupCapability("ExecuteTaskSolution") {}

void ExecuteTaskSolutionCapability::initialize() {
action_callback_group_ =
context_->moveit_cpp_->getNode()->create_callback_group(rclcpp::CallbackGroupType::Reentrant);

Choose a reason for hiding this comment

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

What's the reason to use Reentrant here? This seems inherently unsafe if not handled appropriately.

Copy link
Owner Author

Choose a reason for hiding this comment

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

To make it possible to call the cancel callback while executing the goal callback

Choose a reason for hiding this comment

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

I see, I thought at first that "Reentrant" would only apply to the same callback and not to other's in the same group. To me it seems like there is a type missing. What I don't really like about this is that you have to take care about redundant calls to the same callback manually, even though that's definitely an edge case.

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
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.

3 participants