Overview
Kinematics models enable:- Pose estimation - Calculate position from wheel encoders
- Velocity control - Convert desired motion to wheel speeds
- Path following - Navigate using GPS or visual odometry
- Differential drive - Control two-wheeled robots
- Ackermann steering - Model car-like vehicles
Coordinate Systems
Pose Representation
donkeycar/parts/kinematics.py:24-28.
Angle Normalization
donkeycar/parts/kinematics.py:11-15.
Unicycle Model
The unicycle model represents differential drive robots with two independently driven wheels.Forward Kinematics
Convert wheel distances to pose:donkeycar/parts/kinematics.py:303-408.
Implementation Details
The update equations fromdonkeycar/parts/kinematics.py:361-376:
Inverse Kinematics
Convert desired velocity to wheel speeds:donkeycar/parts/kinematics.py:415-458.
The conversion formula from donkeycar/parts/kinematics.py:451-452:
Bicycle Model
The bicycle model represents car-like vehicles with Ackermann steering.Forward Kinematics
donkeycar/parts/kinematics.py:31-163.
Angular Velocity
For car-like vehicles:donkeycar/parts/kinematics.py:262-274.
Inverse Kinematics
Convert desired motion to steering angle:donkeycar/parts/kinematics.py:169-208.
The conversion from donkeycar/parts/kinematics.py:246-259:
Differential Drive Control
Convert steering and throttle to left/right wheel speeds:donkeycar/parts/kinematics.py:656-677.
The algorithm from donkeycar/parts/kinematics.py:645-653:
Normalization
Steering Angle Normalization
Convert between radians and normalized -1 to 1:donkeycar/parts/kinematics.py:521-597.
Angular Velocity Normalization
For bicycle (car-like) vehicles:donkeycar/parts/kinematics.py:277-518.
Configuration
Measure your robot’s physical parameters:donkeycar/templates/cfg_path_follow.py:66-75.
Example: Path Following
Combine kinematics with path following:Utility Functions
Wheel Rotational Velocity
donkeycar/parts/kinematics.py:600-610.
Unicycle Angular Velocity
donkeycar/parts/kinematics.py:463-492.
Best Practices
- Measure carefully - Accurate physical parameters are critical
- Calibrate encoders - Roll car exactly 1 meter, measure ticks
- Test in place - Verify rotation before translating
- Handle singularities - Check for division by zero
- Use small timesteps - Assumes linear motion between updates
Troubleshooting
Pose Drift
- Verify encoder tick counts match actual distance
- Check wheel slippage
- Calibrate wheel radius and axle length
Incorrect Rotation
- Verify axle_length measurement
- Check encoder wiring (left/right swap)
- Test steering angle sign convention
Unstable Control
- Add deadzone for small velocities
- Smooth encoder readings
- Limit maximum angular velocity
Next Steps
- Implement path following with kinematics
- Add telemetry to monitor pose
- Use simulator to test kinematics models
