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

Suggestion on Serial Communication Robot Driving

asked 2016-01-05 22:59:00 -0500

Hi there !

I have the custom made differential drive Robot Base which connect through USB ( /dev/ttyACM0 )

and i want to control it via joystick teleop.


THE PROBLEM IS

  1. the robot base , which have no driver at all. i need to write the special driver for it. (please look below for the protocol) any example or suggestion ?
  2. How to send message from the ROS to serial ?( maybe the cmd_vel is the good msg to send )

Serial Protocol Example

to drive Robot forward = Serial Send byte Stream in this format

255 255 001 007 003 020 001 255 001 255 224

Stream Explained

255 255 001 - Header

007 - Length of byte following this byte

003 020 - error on the protocol (it doesn't matter in this context)

001 - Direction of Right Wheel

255 - Velocity on Right Wheel (Full Throttle)

001 - Direction of Left Wheel

255 - Velocity on Left Wheel (Full Throttle)

224 - Inverted Checksum


Things that i've done :

I can use the joystick teleop to control turtlebot_sim.

For the base : i can completely drive ,control and read value manually on ordinary C++ code ( respect to the WJWWOOD Serial Library ).

So, I want to know that there're any node example, suggestions or tutorials to achieve this ?

Many Thanks, Tew

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-01-06 00:01:13 -0500

ahendrix gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-05 22:59:00 -0500

Seen: 293 times

Last updated: Jan 06 '16