How to cancel ros2 action with ros2 cpp action client
Pleas provide ros2 cpp example client to cancel actions
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Pleas provide ros2 cpp example client to cancel actions
As you wish https://github.com/ros-planning/navig...
auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
if (callback_group_executor_.spin_until_future_complete(future_cancel, server_timeout_) !=
rclcpp::FutureReturnCode::SUCCESS)
{
RCLCPP_ERROR(
node_->get_logger(),
"Failed to cancel action server for %s", action_name_.c_str());
}
}
I think there is something weird around. According with your code we need the goal_handle_ to cancel the action. Ok, sounds good. But it turns out that you get that goal_handle_ value only after the future of the response of the original request is resolved.
I even wonder if you can cancel some specific action goal using the rclcpp_action API nowadays (Sept 2022).
The problem is that the "async_cancel_goal" requires a goal handle, but the "send_goal" function only provides a "future goal handle". You will get the required "goal handle" only after the response from the server is received. Too late to cancel.
see: https://github.com/ros2/rclcpp/blob/3...
I would say that is still an open issue in the rclcpp repo: https://github.com/ros2/rclcpp/issues...
By the moment, cancelling everything is an alternative:
client_ptr->async_cancel_all_goals();
Asked: 2022-03-09 10:15:58 -0600
Seen: 1,375 times
Last updated: Sep 07 '22
rewriting python program in cpp, how to fill in the header field in msg
pr2controller tutorial, quaternion not the same for same program in python and cpp
Undefined reference on Ubuntu 11.04
Using skeleton_markers package for action recognition. Streaming data in csv format [closed]
Is actionlib/msg directory deprecated in Fuerte?
question: how to make an action request to ompl_planning
Fuerte sensor_msgs::Joy Changed?