ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I see a few problems in your implementation of the client:
waitForServer doesn't terminate. The reason is that you call it before you called spin. That means no ros messages are handled. You need to start up a spinner before waiting for the server.
As far as I can see, the server cancels your goal correctly. I see a result message on the result topic and the goal transitions to state PREEMPTED on the status topic. The problem lies in the client. You do not explicitly cancel the goal but just send another one. One implication of this is that the client stops tracking the old goal before the preemption could be received and starts tracking the new goal. If you explicitly cancel the goal and wait for a result before sending the new goal, the client's done callback is executed with status preempted.
2 | No.2 Revision |
I see a few problems in your implementation of the client:
waitForServer doesn't terminate. The reason is that you call it before you called spin. That means no ros messages are handled. You need to start up a spinner before waiting for the server.
As far as I can see, the server cancels your goal correctly. I see a result message on the result topic and the goal transitions to state PREEMPTED on the status topic. The problem lies in the client. You do not explicitly cancel the goal but just send another one. One implication of this is that the client stops tracking the old goal before the preemption could be received and starts tracking the new goal. If you explicitly cancel the goal and wait for a result before sending the new goal, the client's done callback is executed with status preempted.