/movr-driver-arduino

Arduino driver for movr.

Primary LanguageC++Apache License 2.0Apache-2.0

MOVR's Arduino Driver

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).

Table of Contents

Dependencies

Installation

# 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

How to use

# 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

Development

Robot odometry

Encoder

LPD3806 600BM G5 24C Rotary Encoder

Wire Mappings:
Wire Color     Connections   
RED            5 - 24V DC   
BLACK          Ground   
GREEN          A Phase   
WHITE          B Phase   
Spefications:
  • 600 pulses/revolution for a single phase.
  • Therefore, two-phase output leads to 24000
  • Maximum mechanical speed: 5000 Revolutions / minute
  • Response Frequence: 0 - 20KHz
Basic math
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

References