Skip to content
Snippets Groups Projects
Unverified Commit fcbf60f8 authored by Kaven Yau's avatar Kaven Yau Committed by GitHub
Browse files

checking if handle is active in handle_cancel (#2304)

parent 1a207fc2
No related branches found
No related tags found
No related merge requests found
......@@ -133,9 +133,17 @@ public:
* @return CancelResponse response of the goal cancelled
*/
rclcpp_action::CancelResponse handle_cancel(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<ActionT>>/*handle*/)
const std::shared_ptr<rclcpp_action::ServerGoalHandle<ActionT>> handle)
{
std::lock_guard<std::recursive_mutex> lock(update_mutex_);
if (!handle->is_active()) {
warn_msg(
"Received request for goal cancellation,"
"but the handle is inactive, so reject the request");
return rclcpp_action::CancelResponse::REJECT;
}
debug_msg("Received request for goal cancellation");
return rclcpp_action::CancelResponse::ACCEPT;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment