ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The class actionlib::SimpleActionClient<>
has this function cancelGoal()
. In this Writing a Simple Action Client example, the time limit is set to 30 seconds. After that, the client just quits. unfortunately, the author didn't send cancel request and the server keeps running even though the client is no longer exist. You can check the server is running by rostopic echo /fibonacci/feedback
which allows you to see the feedback.
if (finished_before_timeout){
actionlib::SimpleClientGoalState state = ac.getState();
ROS_INFO("Action finished: %s",state.toString().c_str());
}else{
ROS_INFO("Action did not finish before the time out.");
// add this line
ac.cancelGoal();
ROS_INFO("Goal has been cancelled");
}