Skip to content

Check goal handle status before canceling - #917

Merged
bpwilcox merged 3 commits into
ros-navigation:masterfrom
bpwilcox:debug_bt_navigator_crash
Jul 10, 2019
Merged

bpwilcox merged 3 commits into
ros-navigation:masterfrom
bpwilcox:debug_bt_navigator_crash

Conversation

@bpwilcox

@bpwilcox bpwilcox commented Jul 9, 2019

Copy link
Copy Markdown

Basic Info

Info Please fill out this column
Ticket(s) this addresses #904

Description of contribution in a few bullet points

  • Checks that a goal is either action_msgs::msg::GoalStatus::STATUS_ACCEPTED or action_msgs::msg::GoalStatus::STATUS_EXECUTING before attempting to cancel when halt() is called for BtActionNode
  • fixes crash seen in BT Navigator Crash #904 due to race condition between aborting a goal on server side and sending a cancel on client
  • removes redundant cancel goal

@bpwilcox
bpwilcox requested review from a user and orduno July 9, 2019 19:14
@bpwilcox bpwilcox added the 1 - High High Priority label Jul 9, 2019

@orduno orduno left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a minor style suggestion.

auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
if (rclcpp::spin_until_future_complete(node_, future_cancel) !=
rclcpp::executor::FutureReturnCode::SUCCESS)
rclcpp::spin_some(node_);

@orduno orduno Jul 10, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we can simplify the check, something like:

if (should_cancel_goal()) {
    ...
}

bool should_cancel_goal()
{
    if (status() != BT::NodeStatus::RUNNING) {
        return false;
    }

    rclcpp::spin_some(node_)

    auto status = goal_handle_->get_status();

    if (status == action_msgs::msg::GoalStatus::STATUS_ACCEPTED ||
      status == action_msgs::msg::GoalStatus::STATUS_EXECUTING)
    {
        return true;
    }

    return false;
}

@orduno orduno added this to the D Turtle Release milestone Jul 10, 2019
@ghost

ghost commented Jul 10, 2019

Copy link
Copy Markdown

@bpwilcox Keep an eye on the Travis failure. The djikstra test seems to have failed twice now, and there are new, unexpected messages in the log. I'm not sure if they are related, but let's see if it happens again

1: [amcl-6] [INFO] [amcl]: Destroying
11: [world_model-5] [INFO] [rclcpp]: signal_handler(signal_value=2)
11: [world_model-5] [INFO] [global_costmap.global_costmap]: Timed out waiting for transform from base_link to map to become available, tf error: . canTransform returned after 0 timeout was 1.
11: [world_model-5] [INFO] [global_costmap.global_costmap]: start
11: [world_model-5] [INFO] [world_model]: Destroying
11: [world_model-5] 
11: [world_model-5] >>> [rcutils|error_handling.c:107] rcutils_set_error_state()
11: [world_model-5] This error state is being overwritten:
11: [world_model-5] 
11: [world_model-5]   'publisher's context is invalid, at /home/jenkins-agent/workspace/packaging_linux/ws/src/ros2/rcl/rcl/src/rcl/publisher.c:343'
11: [world_model-5] 
11: [world_model-5] with this new error message:
11: [world_model-5] 
11: [world_model-5]   'Could not publish transition, at /home/jenkins-agent/workspace/packaging_linux/ws/src/ros2/rcl/rcl_lifecycle/src/rcl_lifecycle.c:336'
11: [world_model-5] 
11: [world_model-5] rcutils_reset_error() should be called after error handling to avoid this.
11: [world_model-5] <<<
11: [world_model-5] [ERROR] []: Failed to finish transition 3. Current state is now: active
11: [map_server-4] [INFO] [rclcpp]: signal_handler(signal_value=2)

@bpwilcox

Copy link
Copy Markdown
Author

The Travis CI is passing now, probably unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 - High High Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants