ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are few mistakes in your code :

  • You shouldn't initialize the publisher inside the callback it can create errors. Initialize it in the main function.

  • You don't have to subscribe to any topic if you only want to publish a speed command.

  • You are trying to publish data on the topic "/gazebo" but it's actually the name of the gazebo node so it cannot work.

  • Since you have a cmd_vel multiplexer you can publish data on the topic /cmd_vel OR /mobile_base/commands/velocity

  • You should set vel_msg.linear.x to some value (1 for example) to directly see your robot moving (it will be easier for you to debug)

It should work fine with those change.