Lab 02: Arduino Robot Kinematics
Contents
Objectives
The objectives of this lab is to consolidate the understanding of mobile robots kinematics we have covered in the lecture by implementing, testing and validating the theoretical kinematic equations into the Arduino Robot. In particular, you will perform the following activities:
1 Implement the mapping between unicycle kinematics representation to differential drive kinematics and viceversa.
2 Estimate the linear velocity and angular velocity and the robot in meter/sec and radian/sec.
3 Implement the odomerty for the Arduino robot so that it can estimate its current position.
This lab is a preparation for developing controllers for the Arduino robots, as it is necessary to have the functions you will develop in this lab to be able to design and implement your own controller for the robot.
Prerequisite
 Make to download Arduino. Although you can work in any environment, it is recommended that you work in the Ubuntu Virtual Machine provided to you. Download and install Arduino 1.0.6. For other versions, refer to Arduino Download page.
 You need first to review the concepts of differential drive kinematics and write down the equations that related linear and angular velocities to left and right speed of the motor.
 Get used to Arduino Robot and its API.
References
Arduino Language API Documentation
Arduino Robot Library
Arduino Robot Specification Page
Getting Started with Arduino Robot
Tasks
Task 1: Unicyle Model to Differential Drive Model Transformation
 Create a new Arduino file called
ArduinoRobotKinematics
. Save the file in your Arduino work space.  First, measure the distance between the two wheels of the Arduino Robot. Define it as a constant in your code
const double wheel_distance=your_value;
.  Implement the transformation from unicycle model to differential drive model, which means find
(v, ω)
from the right and left angular wheel speeds(vr, vl)
. For this implement these functions:
double getLinearVelocity(double leftSpeed, double rightSpeed)
that returns the linear velocity based on left speed and right speed 
double getAngularVelocity(double leftSpeed, double rightSpeed, double L)
that returns the angular velocity based on left/right speed and the distance between wheels. 
double getICCRadius(double leftSpeed, double rightSpeed, double L)
that returns the ICC Radius based on left/right speed and the distance between wheels. 
double getLeftSpeed(double linear, double angular, double L)
that returns the left speed of the motor based on linear and angular velocities and the distance between the two wheels. You can easily find the left speed value from the equations we derived in the lecture. 
double getRightSpeed(double linear, double angular, double L)
that returns the right speed of the motor based on linear and angular velocities and the distance between the two wheels 
double moveRobot(double linear, double angular)
that makes the robot move according to the linear velocity and angular velocities specified. You must call the functionRobot.motorsWrite(let, right)
to send command to actuators. Use your above functions.  In the
void loop()
function, write the code to make the robot move according to the certain values of linear and angular velocities of your choice, such as the robot moves forward, backward, rotate in place left and right, move in smoothly rotate.

Task 2: Estimate the linear and angular velocities
You can notice from previous experiments that the left speed and right speed are not expressed in meter/sec, and as consequence, the previously calculated linear and angular velocities are also not expressed in meter/sec, so the values do not a real sense of the meaning of these velocities.
In this task, we would like to estimate the real linear and angular velocities for different left and right speed set between 0 and 255.
NOTE: use an excel file to store the experimental values you will get, so that you can calculate the average.
Estimate the linear velocity
 First, the values of the left and right speed (e.g. 255). Run several experiments where you make the robot move for a certain time duration (e.g 10 seconds) and then calculate the distance moved. The velocity can be estimated to the distance divided by the time. Repeat the process for several time and compute the average linear velocity. Try also with other durations (small duration 2 sec, larger duration 25 sec). Do you obtain the same average for all duration?
 Second, run the same experiment above on a different ground (carpet for example). Do you find the same average values as in the other ground type? Explain your observation.
 Third, investigate the impact of the left and right speed by fixing them to a different value (try with 200, 150, 100 and 50). Are the averages proportional to the left and right speed? Draw the curve of right/left speed in xaxis and linear speed in yaxis.
Estimate the angular velocity
In this experiment, we will estimate the rotational velocity following a similar process as with linear velocity estimation. For that purpose, make the robot turn in place for a certain duration that you fix (2 second for example) and find the angle that is rotated. You can use the function RobotCompassRead to measure the angle rotated by the robot. For more information about Compass, refer to this link.
Repeat the experiment several times and give an estimation of the angular velocities using the average value.
Apply this
Now, modify your code of Task 1 so that the robot moves according to real values and linear and angular velocities.
Task 3. Odometry implementation
In this task, you will implement a function to estimate the position of the robot using its odometry. At the end of this task, you should give a conclusion on the accuracy of this localization technique based on odometry information.
Details will be provided later.