Arduino driver for MOVR - a small-size autonomous vehicle
This Arduino sketch subscribes to a "drive command" topic. The messages received are used to control the vehicle's (front) steering motor and (rear) drive-motor. The sketch also creates a ROS publisher to publish odometry data generated from the wheel encoders (and IMU).
- rosserial_arduino
- Arduino ROS extensions to run rosserial_clients.
- ackermann_msgs
- ROS messages for vehicles using ackermann steering.
- PID Library
- An easy to use Arduino PID library.
# If the ROS 'ackermann_msgs/AckermannDrive' has not been installed
$ sudo apt install ros-kinetic-ackermann-msgs
# Install ROS rosserial, rosserial-arduino, rosserial-python
$sudo apt install ros-kinetic-rosserial ros-kinetic-rosserial-arduino ros-kinetic-rosserial-python
# Generate Arduino ros_lib
http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup
# STEP 1: Run roscore
$ roscore
# STEP 2: Run rosserial node
$ rosrun rosserial_python serial_node.py /dev/ttyACM1
# STEP 3: Run the node that will publish the drive commands
# For example the movr_teleop hello_movr.py
# Note that you must 'source' the movr_ws for the movr_teleop package to be visible
$ rosrun movr_teleop hello_mvr.py
LPD3806 600BM G5 24C Rotary Encoder
Wire Color Connections
RED 5 - 24V DC
BLACK Ground
GREEN A Phase
WHITE B Phase
- 600 pulses/revolution for a single phase.
- Therefore, two-phase output leads to 24000
- Maximum mechanical speed: 5000 Revolutions / minute
- Response Frequence: 0 - 20KHz
CALIBRATION_FACTOR (Distance Traveled Per Click)
= PI * Wheel Diameter / Number of Clicks per Revolution
DISTANCE TRAVELED BY A WHEEL
= Calibration Factor * Number of Clicks Traveled by Wheel
AVERAGE DISPLACEMENT BY BOTH WHEELS
= (Distance Traveled by Left Wheel + Distance Traveled by Right Wheel) / Wheel Baseline
# Wheel Baseline = The Distance Between the Left Wheel and Right Wheel Contact Point
- Brett Bearegard's PID Introduction
- Henry's Bench Digital to Analog Tutorial
- Tori's Electronics Lab Rotary Encoder Tutorial
- ROS Serial
- ROS Serial Arduino
- TTU Advanced Robotics Odometry Tutorial
- Correl Lab's Forward Kinematics of Car-Like Mechanisms
- Steven LaValle's Kinematics of a Simple Car
- ROS Q&A on Twist to Ackermann-type Conversion
- Ackermann Messages Defined by the ROS Ackermann Interest Group