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

The short answer is that you should take your "ordinary C++ code" that can already control the robot, and turn it into a ROS node:

  • Add the appropriate ros setup (ros::init(), etc)
  • Add a subscriber on the cmd_vel topic. This will use the same message type and fields that turltlebot_sim and the turltesim tutorials use.
    • In your cmd_vel callback, convert the linear and angular velocity into wheel speeds and direction (you probably already have code for this). Then take these speeds and directions and send them out the serial port using your existing code.

I'm not aware of a tutorial that walks through the process explicitly, but you should be able to piece it together between the roscpp listener tutorial, and maybe some playing around with the turtlebot simulator or turtlesim.