Differential Drive
This experiment explores how encoder feedback and differential-drive kinematics can be used to execute predefined linear and rotational movements on a mobile robot.
Develop a motion-control system capable of executing specified travel distances and rotation angles using encoder measurements and known robot geometry.
The Romi was programmed to execute a predefined sequence of linear and rotational movements at a constant motor effort magnitude of 100.
During each movement, encoder counts were continuously collected and converted into individual wheel displacements. The robot's center travel distance and angular displacement were calculated using its wheel diameter, encoder resolution, and track width.
The motors were stopped once the calculated distance or rotation angle reached or exceeded the desired value. The encoder counts were then reset, followed by a five-second delay before executing the next movement.
The calculated distances and rotation angles were compared against physical measurements and the desired target values to evaluate motion accuracy.
The following code governs motor operation based on whether the requested movement is linear or rotational. The direction of motor effort is determined by the sign of the desired distance or rotation angle.
Encoder feedback is used to evaluate whether the robot has reached or exceeded the desired movement target, determining when the motors should stop and the next movement can begin.
if (value.is_linear)
{
motor_speed *= sign_dist;
motors.setSpeeds(motor_speed, motor_speed);
bool finished = (sign_dist > 0) ? (center_dist >= value.desired_distance) : (center_dist <= value.desired_distance);
...
else
{
sign_deg > 0 ? motors.setSpeeds(-motor_speed, motor_speed) : motors.setSpeeds(motor_speed, -motor_speed);
bool finished = sign_deg > 0 ? (degree >= value.degree) : (degree <= value.degree);
Differential drive demonstration (as a showcase so most of the 15 second delay between movements are cut out)
The robot was programmed to execute four consecutive movements:
Travel forward 30 cm.
Rotate counterclockwise +90°.
Rotate clockwise -90°.
Travel backward 30 cm.
In between the relative movements, during the delay, I would measure the linear distance with a tape measure and measure rotations using a printed 180 degree protractor.
The experimental results demonstrate that differential-drive kinematics and encoder feedback can be used to execute predefined linear and rotational movements.
For linear movements, the mean absolute estimation error was 0.92 cm, while the mean absolute control error was approximately 0.88 cm.
For rotational movements, the mean absolute estimation error was 0.84°, while the mean absolute control error was 3.50°.
The robot exceeded the desired rotation angle in both rotational movements. This may be attributed to the constant motor effort applied throughout each movement, resulting in insufficient deceleration as the robot approached its target.
The difference between estimation error and control error demonstrates that accurate motion estimation alone does not necessarily guarantee accurate motion execution.
The experiment demonstrates that encoder feedback and differential-drive kinematics can be combined to execute predefined linear distances and rotation angles.
Although the robot was able to execute the intended movements with relatively low error, the implementation still exhibited limitations. Motor effort remained constant throughout each movement, regardless of the remaining distance or angular error.
Additionally, the unequal motor response identified during the motor characterization experiment was not actively compensated for during linear movements.
These limitations highlight the need for a feedback controller capable of dynamically adjusting individual motor efforts based on the robot's remaining distance and heading errors.
The next experiment, Feedback Control, builds upon differential-drive motion control by introducing a controller that dynamically adjusts motor effort based on the difference between the desired and estimated robot states.
Rather than applying constant motor effort until a target is reached, the controller will use distance and heading errors to regulate individual motor efforts, reduce overshoot, and improve movement accuracy.