The first test's goal is to find relationship between motors speed input (a number between 0 and 255 where 128 is the center) and final angular speed at the end shaft.
In order to perform this test a simple program was uploaded on SAMx8. Exploring the speed range incrementing speed by 8 this program perform following steps:
- reset MD25 encoders value;
- set speed to given value;
- wait 10 seconds;
- measure the MD25 encoders;
- set speed to 0 (i.e. 128).
The same test was performed on both motor (1 and 2). The following chart show the results for motor 1 (green line) and motor 2 (blu line). On the x axis there are speed input to MD25, on the y axis the rotation speed at the end shaft.
The behavior is really good: excluding the extremes of the range the response is linear and there are not significant errors between two motors. This is a result of the motor feedback handled by MD25 board.
Using this result we can calculate relationship between MD25 input and final speed of the robot. Motors rotation speed can be related to robot speed and robot angular speed using following formulas:
1) v = (w1 + w2) * d / 4
2) w = (w2 - w1) d / (2 *b)
v - tangent speed
w - angular speed
w1, w2 - rotation speed of motor 1 and 2
d - the wheel diameter
b - the wheel base
Calculation are done using Geduino dimensions.
Applying linear regression to this data we can found a linear relationship between the tangent and angular speed we want to drive to the robot and the right speeds value to set on MD25 to reach those speeds.