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

I've used the differential_drive ROS package successfully (http://wiki.ros.org/differential_drive). However, since then I've written my own package for one robot and used the built-in code in ros_arduino_bridge for another robot that is Arduino based. The differential_drive package expects to send commands to the motors in meters/second of travel. You will have to use feedback from encoders in a PID controller (or some empirical method) to determine the PWM values.

As for setting PID constants, @spmaniato is right, start simple. Increase Kp until you get quite a bit of overshoot and then back off until the overshoot is reduced to a more reasonable value. Kd can allow a higher Kp while damping overshoot. Ki is often not needed unless there is some external force that will keep you from achieving the setpoint using Kp alone. (In incline, or high friction terrain, or wind, for example.) Ki can also be used to decrease the response time, similar to increasing Kp. Some way of graphing the actual speeds – from the encoders – is good to have, real-time is best. (On an Arduino-based controller you can print the calculated speed to Serial and use the built-in Tools > Serial Plotter to show the plot.)