0
$\begingroup$

Rosanswers logo

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


Originally posted by C3MX on ROS Answers with karma: 150 on 2016-01-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ahendrix with karma: 47576 on 2016-01-06

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.