File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
nav2_behaviors/include/nav2_behaviors Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -237,15 +237,6 @@ class TimedBehavior : public nav2_core::Behavior
237237
238238 while (rclcpp::ok ()) {
239239 elasped_time_ = clock_->now () - start_time;
240- if (action_server_->is_cancel_requested ()) {
241- RCLCPP_INFO (logger_, " Canceling %s" , behavior_name_.c_str ());
242- stopRobot ();
243- result->total_elapsed_time = elasped_time_;
244- onActionCompletion (result);
245- action_server_->terminate_all (result);
246- return ;
247- }
248-
249240 // TODO(orduno) #868 Enable preempting a Behavior on-the-fly without stopping
250241 if (action_server_->is_preempt_requested ()) {
251242 RCLCPP_ERROR (
@@ -259,6 +250,15 @@ class TimedBehavior : public nav2_core::Behavior
259250 return ;
260251 }
261252
253+ if (action_server_->is_cancel_requested ()) {
254+ RCLCPP_INFO (logger_, " Canceling %s" , behavior_name_.c_str ());
255+ stopRobot ();
256+ result->total_elapsed_time = elasped_time_;
257+ onActionCompletion (result);
258+ action_server_->terminate_all (result);
259+ return ;
260+ }
261+
262262 ResultStatus on_cycle_update_result = onCycleUpdate ();
263263 switch (on_cycle_update_result.status ) {
264264 case Status::SUCCEEDED:
You can’t perform that action at this time.
0 commit comments