Intro

Arduino Motor Controller joshnewans/ros_arduino_bridge

This code turns an Arduino into a motor controller! It provides a simple serial interface to communicate with a high-level computer (e.g. running ROS), and generates the appropriate PWM signals for a motor driver, to drive two motors.

Functionality

The main functionality provided is to receive motor speed requests over a serial connection, and provide encoder feedback. The original code has provisions for other features - e.g. read/write of digital/analog pins, servo control, but I’ve never used them.

The main commands to know are

  • e - Motor responds with current encoder counts for each motor
  • r - Reset encoder values
  • o - Set the raw PWM speed of each motor (-255 to 255)
  • m - Set the closed-loop speed of each motor in counts per loop (Default loop rate is 30, so (counts per sec)/30
  • p - Update the PID parameters