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 a couple of examples you can look at. First, assuming you can publish the encoder ticks in some way, the differential_drive package has nodes to both publish odometry from encoder ticks and to convert from Twist to motor speeds. All the source is in Python, so it's reasonably easy to read.

Second, if you are using a microcontroller like an Arduino to talk to the hardware, you could use a package like ros_arduino_bridge. It has a ROS node (Python) and an Arduino sketch that communicate to share the work. The Python side does the conversion from ticks to odometry and from Twist to motor control. It also includes a PID controller on the Arduino side. (In my robot I'm using a Pololu A-Star board that fits on top of a Raspberry Pi, for example.)

I think most commercial robots using ROS (PR2, Husky, etc.) use the C++-based hardware interfaces instead. If you're going to follow the same path, you might look at how one of those commercial robots are handling this problem. The examples on the ClearPath site might be a good starting point.