@@ -436,31 +436,36 @@ void ControllerServer::computeControl()
436
436
RCLCPP_INFO (get_logger (), " Received a goal, begin computing control effort." );
437
437
438
438
try {
439
- std::string c_name = action_server_->get_current_goal ()->controller_id ;
439
+ auto goal = action_server_->get_current_goal ();
440
+ if (!goal) {
441
+ return ; // goal would be nullptr if action_server_ is inactivate.
442
+ }
443
+
444
+ std::string c_name = goal->controller_id ;
440
445
std::string current_controller;
441
446
if (findControllerId (c_name, current_controller)) {
442
447
current_controller_ = current_controller;
443
448
} else {
444
449
throw nav2_core::InvalidController (" Failed to find controller name: " + c_name);
445
450
}
446
451
447
- std::string gc_name = action_server_-> get_current_goal () ->goal_checker_id ;
452
+ std::string gc_name = goal ->goal_checker_id ;
448
453
std::string current_goal_checker;
449
454
if (findGoalCheckerId (gc_name, current_goal_checker)) {
450
455
current_goal_checker_ = current_goal_checker;
451
456
} else {
452
457
throw nav2_core::ControllerException (" Failed to find goal checker name: " + gc_name);
453
458
}
454
459
455
- std::string pc_name = action_server_-> get_current_goal () ->progress_checker_id ;
460
+ std::string pc_name = goal ->progress_checker_id ;
456
461
std::string current_progress_checker;
457
462
if (findProgressCheckerId (pc_name, current_progress_checker)) {
458
463
current_progress_checker_ = current_progress_checker;
459
464
} else {
460
465
throw nav2_core::ControllerException (" Failed to find progress checker name: " + pc_name);
461
466
}
462
467
463
- setPlannerPath (action_server_-> get_current_goal () ->path );
468
+ setPlannerPath (goal ->path );
464
469
progress_checkers_[current_progress_checker_]->reset ();
465
470
466
471
last_valid_cmd_time_ = now ();
0 commit comments