Differential Drive
What is Differential Drive?
A differential drive system is how robots and vehicles, like tanks, move around. Instead of using a steering wheel, they have two sets of wheels (generally 1-2 in each set on each side) (or tracks) that can spin at different speeds.
Think of a tank: if both tracks move forward at the same speed, the tank moves straight. If the left track moves faster than the right, the tank turns right. If one track moves forward and the other moves backward, the tank spins in place. This is how many robots, including Roombas and Mars rovers, navigate!
The Math For It
What are Inverse Kinematics?
The inverse kinematics formulas allow us to determine the necessary velocities to set for each wheel (or motor on an actual robot) to easily control the movement of the entire robot. This could include actions like rotating, moving forward, or moving backward.
Pass in: Forward/Angular velocities
Get: The velocities to set for each wheel/motor.
Variable Names
Forward Velocity (\(v_\text{forward}\)): The speed at which the robot goes straight ahead.
Angular Velocity (\(\omega\)): The speed at which the robot turns.
Track Radius (\(r_\text{track}\)): The distance between the center of the entire robot and the midpoint of a set of wheels(left or right).
Equations/Formulas
Velocities to set the right wheels: \(v_\text{right} = v_\text{forward} + r_\text{track} \cdot \omega\)
Velocities to set the left wheels: \(v_\text{left} = v_\text{forward} - r_\text{track} \cdot \omega\)
The Code
View Differential Drive code(simulation) on GitHub
KEY SNIPPETS OF CODE
The inverse kinematics is implemented in the inverse_kinematics
method of the Robot
class which includes the formulas covered in the previous part of the lesson:
1 2 3 |
|
This involves setting each set of wheels(left and right), with the velocity calculated from the inverse kinematics. This way we are able to make our robot move.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|