Client executing call back function but not writing into cmd_vel topic

I created a service server that moves the robot in a circle but when i create a client c++ programme it prints the message at the end of the callback function but doesn’t publish to the cmd_vel topic.

When i launch the service server node separately and execute my client c++ programme it works perfectly. but when I include the launch file of the service server in the client launch file the velocity of the robot doesn’t change.


<include file="$(find service_server_pkg)/launch/move_bb8_in_circle.launch"/>

<node pkg ="service_server_pkg"

I have therefore concluded that the issue is in this line <include file="$(find service_server_pkg)/launch/move_bb8_in_circle.launch"/> but I can’t figure out why.

In order to debug your problem do the following:

  1. Launch everything using your launch program
  2. Then check if the service is running with the command rosservice list. Your service must appear there. If it doesn’t then, it means the problem is in either the launch of your server node or the node itself has a problem (very unlikely because you said it works when launched manueally).
  3. If the service is listed, then do an echo of the cmd_vel topic (rostopic echo /cmd_vel) in another terminal, and then launch again your program. If you don’t see the commands of velocity being printed in the echo terminal, then it means you have an error in the service server
  4. Otherwise, post here your results

Everything is showing up fine. It executes the server call back function because it prints out the message in that function. It just doesn’t publish to the cmd_vel topic and that is confusing me because i know the code is right.

When I run rostopic echo cmd_vel I get this error.

WARNING: no messages received and simulated time is active.
Is /clock being published?

That is strange that it works correctly when you separate them but now when they are together in the launch file. I’ve noticed that you ar missing a / to close your client node tag, after output="screen".

It should be

<node pkg ="service_server_pkg"