Overview
Kinematics describes the relationship between wheel velocities and robot motion, without considering forces or torques. For a Mecanum robot, we need two transformations:- Forward Kinematics: Given wheel velocities → Calculate robot velocity
- Inverse Kinematics: Given desired robot velocity → Calculate required wheel velocities
Goal: Understand and implement the mathematics that makes omnidirectional motion possible.
Coordinate Frames and Notation
Robot Body Frame
- Origin: Center of robot chassis
- X-axis: Forward direction of robot
- Y-axis: Left direction (perpendicular to X)
- θ (theta): Robot heading angle (counterclockwise from global X)
Robot Velocity Components
The robot’s velocity in its body frame has three components:- Vₓ - Linear velocity in X direction (forward/backward) [m/s]
- Vᵧ - Linear velocity in Y direction (left/right strafing) [m/s]
- ω (omega) - Angular velocity (rotation rate) [rad/s]
Wheel Configuration
Standard 4-wheel Mecanum configuration:- L - Wheelbase (front-to-rear distance) [m]
- W - Track width (left-to-right distance) [m]
- r - Wheel radius [m]
- l = (L + W) / 2 - Distance from center to wheel [m]
Roller Force Analysis
Each Mecanum wheel has rollers at 45° angle. When the wheel rotates, the roller contact produces force components:
For a wheel rotating at angular velocity ωᵢ:
- Roller surface velocity: vᵢ = r × ωᵢ
- Force acts at 45° angle
- X-component: vₓ = vᵢ × cos(45°) = vᵢ / √2
- Y-component: vᵧ = vᵢ × sin(45°) = vᵢ / √2
Forward Kinematics Derivation
Step 1: Individual Wheel Contributions
For each wheel, determine its contribution to robot motion: Wheel 1 (Front-Left, FL):- X contribution: +vᵢ / √2 (rollers push forward)
- Y contribution: +vᵢ / √2 (rollers push left)
- Rotation contribution: +l × ωᵢ (counterclockwise rotation)
- X contribution: +vᵢ / √2 (rollers push forward)
- Y contribution: -vᵢ / √2 (rollers push right)
- Rotation contribution: -l × ωᵢ (clockwise rotation)
- X contribution: +vᵢ / √2
- Y contribution: -vᵢ / √2
- Rotation contribution: +l × ωᵢ
- X contribution: +vᵢ / √2
- Y contribution: +vᵢ / √2
- Rotation contribution: -l × ωᵢ
Step 2: Sum Contributions
Robot velocities are the average of all wheel contributions: Forward velocity (Vₓ):Step 3: Matrix Form
The forward kinematics can be written as:Inverse Kinematics Derivation
Inverse kinematics finds wheel velocities needed for desired robot motion. We invert the forward kinematics matrix.Matrix Inversion Approach
Starting from:Result: Inverse Kinematics Equations
Matrix Form
MATLAB Implementation
Robot Parameters
Create a parameter filerobot_params.m:
Forward Kinematics Function
Createforward_kinematics.m:
Inverse Kinematics Function
Createinverse_kinematics.m:
Validation and Testing
Test Script
Createtest_kinematics.m:
Expected Results
Test 1 - Forward Motion:- All wheels same speed → Robot moves forward
- Vₓ > 0, Vᵧ ≈ 0, ω ≈ 0
- Diagonal pairs opposite → Robot strafes
- Vₓ ≈ 0, Vᵧ ≠ 0, ω ≈ 0
- Left/right opposite → Robot spins in place
- Vₓ ≈ 0, Vᵧ ≈ 0, ω ≠ 0
- Inverse → Forward should give original velocity
- Error < 1e-10 (numerical precision)
Common Issues and Debugging
Wrong signs in equations
Wrong signs in equations
Symptom: Robot moves opposite direction or rotates wrong wayDebug:
- Check wheel numbering convention (FL, FR, RL, RR)
- Verify roller angle signs (+45° vs -45°)
- Test each motion mode independently
Units mismatch
Units mismatch
Symptom: Unrealistic velocities (e.g., 100 m/s)Debug:
- Verify all parameters in consistent units (meters, radians)
- Check wheel_radius is in meters, not mm
- Print intermediate values
Singular configuration
Singular configuration
Symptom: Inverse kinematics gives infinite wheel speedsDebug:
- Check if desired velocity exceeds physical limits
- Verify robot parameters (L, W, r) are positive
Drift in simulation
Drift in simulation
Symptom: Robot doesn’t follow path exactlyDebug:
- Check integration time step (too large causes error)
- Verify kinematics equations are correctly implemented
- Test with simple motions first
Advanced Topics
Velocity Limits
Real motors have maximum speeds. Add limits to inverse kinematics:Singularity Analysis
Check if kinematics matrix is invertible:Next Steps
Trajectory Planning
Use kinematics to simulate robot following paths
Motor Specifications
Get realistic motor parameters for simulation