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

Only allow one spin_until_future_complete at a time #804

Merged
merged 1 commit into from
Jun 5, 2019
Merged

Only allow one spin_until_future_complete at a time #804

merged 1 commit into from
Jun 5, 2019

Conversation

mjeronimo
Copy link

Description

  • Now that the BT nodes are derived from AsyncActionNode instead of CoroActionNode, it is possible for halt() to be called from a different thread while tick() is active. This PR ensures that only one spin_until_future_complete is active at a time. Without this, there is a race condition that can result in an "already on an executor" error.
  • This should fix the error we're seeing occasionally with the rviz action-based goal pose tool (since it's intermittent, it's hard to test. I've run many times without encountering the error again).

@mjeronimo mjeronimo added the nav2_lifecycle Related to the manged/lifecycle node implementation label Jun 4, 2019
@mjeronimo mjeronimo added this to the D Turtle Release milestone Jun 4, 2019
@mjeronimo mjeronimo self-assigned this Jun 4, 2019
@mjeronimo mjeronimo added this to In progress in Navigation 2 Kanban via automation Jun 4, 2019
Copy link
Contributor

@orduno orduno left a comment

Choose a reason for hiding this comment

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

The error can be reproduced most of the time by making DWB fail. The DWB fail was not propagated successfully and the behaviour tree was still ticking ComputePathToPose.

I tested the PR and solves this problem. The DWB fail is propagated correctly and navigation fails as it should.

Navigation 2 Kanban automation moved this from In progress to Reviewer approved Jun 4, 2019
@orduno
Copy link
Contributor

orduno commented Jun 4, 2019

Correction: did some more testing and got error reproduced with this PR.

Screenshot from 2019-06-04 16-06-35

Copy link

@bpwilcox bpwilcox left a comment

Choose a reason for hiding this comment

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

I also tested this PR. It seem to resolve the previous crash upon cancel that @mhpanah had mentioned and the dwb_controller failure propogation issue @orduno discussed.

@mjeronimo mjeronimo merged commit 69e7962 into ros-navigation:lifecycle Jun 5, 2019
Navigation 2 Kanban automation moved this from Reviewer approved to Done Jun 5, 2019
@@ -165,7 +171,10 @@ class BtActionNode : public BT::AsyncActionNode
if (status() == BT::NodeStatus::RUNNING) {
action_client_->async_cancel_goal(goal_handle_);
auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
rclcpp::spin_until_future_complete(node_, future_cancel);
{
Copy link
Member

Choose a reason for hiding this comment

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

Semantics, but this is right before leaving the scope of the if, so the additional scoping for the lock isn't required

@mjeronimo mjeronimo deleted the serialize-spin-in-bt-action branch July 5, 2019 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nav2_lifecycle Related to the manged/lifecycle node implementation
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants