-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Check if goal_status_ is valid. #2305
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
Changes from 5 commits
e95a229
d77e5b9
09d2ea9
cdcebf9
7877a12
d7beb71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,6 +177,10 @@ class BtActionNode : public BT::ActionNodeBase | |
| on_new_goal_received(); | ||
| } | ||
|
|
||
| if (!goal_handle_) { | ||
| throw std::logic_error("BtActionNode::Tick: invalid goal handle"); | ||
|
||
| } | ||
|
|
||
| // The following code corresponds to the "RUNNING" loop | ||
| if (rclcpp::ok() && !goal_result_available_) { | ||
| // user defined callback. May modify the value of "goal_updated_" | ||
|
|
@@ -232,6 +236,9 @@ class BtActionNode : public BT::ActionNodeBase | |
| } | ||
|
|
||
| setStatus(BT::NodeStatus::IDLE); | ||
| if (goal_handle_) { | ||
| goal_handle_.reset(); | ||
tzskp1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| protected: | ||
|
|
@@ -242,7 +249,7 @@ class BtActionNode : public BT::ActionNodeBase | |
| bool should_cancel_goal() | ||
| { | ||
| // Shut the node down if it is currently running | ||
| if (status() != BT::NodeStatus::RUNNING) { | ||
| if (status() != BT::NodeStatus::RUNNING || !goal_handle_) { | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -266,7 +273,7 @@ class BtActionNode : public BT::ActionNodeBase | |
| // TODO(#1652): a work around until rcl_action interface is updated | ||
| // if goal ids are not matched, the older goal call this callback so ignore the result | ||
| // if matched, it must be processed (including aborted) | ||
| if (this->goal_handle_->get_goal_id() == result.goal_id) { | ||
| if (this->goal_handle_ && (this->goal_handle_->get_goal_id() == result.goal_id)) { | ||
|
||
| goal_result_available_ = true; | ||
| result_ = result; | ||
| } | ||
|
|
@@ -280,6 +287,9 @@ class BtActionNode : public BT::ActionNodeBase | |
| throw std::runtime_error("send_goal failed"); | ||
| } | ||
|
|
||
| if (goal_handle_) { | ||
| goal_handle_.reset(); | ||
SteveMacenski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
SteveMacenski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| goal_handle_ = future_goal_handle.get(); | ||
| if (!goal_handle_) { | ||
| throw std::runtime_error("Goal was rejected by the action server"); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.