Hello, I am currently going through the Service client/server chapter. I managed to do exercise 6.2 asking us to create a service server and a client that, when called, makes the BB8 do a circle.
However, once the client is successfully got terminated after the call, the BB8 keeps moving in a circle. I might have missed something about the chapter, but is it normal behaviour?
Does it come from the fact we send an EmptyRequest, thus there is no time limit to the service, leading to the BB8 keep turning in circle? If I understood well the chapter, once the service is called and successfully done, the main program becomes available again (synchronous behaviour). So does it just mean that in theory, I could then launch another service? Or is there a bug making the robot looping ?
Thanks
Hello @ClemZer ,
This happens because the /cmd_vel
topic will keep listening to the last message that was published to it, which in your case it is saying to move the robot (this topic behavior is known as latched topic). So, to stop the robot, you have to publish a Twist message with all the velocities set to 0.
Hope this helps,
Good morning @albertoezquerro ,
Thank you for the reply. So I guess that services limits lie in these special characteristics? If the user doesn’t specify an ending (e.g here sending a twist 0 at the end), the robot does not stop although the service is finished.
I have not yet started the second part with a custom .srv message, but I guess this helps to solve the “issue” (instead of creating a specific service to stop the robot) ?
Well, this is more a topic configuration issue than something related to services limitations. Topics can be configured like this or not. Then, depending on how the topic behaves, you should code your service in one way or another. In this case, since you are working with a latched topic, you should make sure to send this final message to stop the robot.