Skip to content
learnFRC.org
programmingreference

Kinematics, Odometry & Exponential Pose Integration

Mathematical transformations between chassis velocities and swerve module states, and integrating robot position on the field.

To control an omnidirectional swerve drivetrain or differential tank robot, software must translate between two coordinate systems:

  1. Chassis Speeds: The robot’s overall forward speed (vxv_x), strafe speed (vyv_y), and angular rotation rate (ω).
  2. Module States: The specific drive speed (viv_i) and steering angle (θiθ_i) of each individual wheel module.

  • Inverse Kinematics: Takes desired robot velocity vectors (vx,vy,ω)(v_x, v_y, ω) and calculates the required wheel speeds and angles for each of the 4 swerve modules: [vx, vy, ω]^T -> [v_FL, v_FR, v_BL, v_BR]
  • Forward Kinematics: Takes measured wheel velocities and angles from motor encoders and calculates actual chassis velocity.
// ChassisSpeeds to SwerveModuleState array
ChassisSpeeds speeds = ChassisSpeeds.fromFieldRelativeSpeeds(
vx, vy, omega, m_gyro.getRotation2d()
);
SwerveModuleState[] states = m_kinematics.toSwerveModuleStates(speeds);
SwerveDriveKinematics.desaturateWheelSpeeds(states, MAX_SPEED);
Wheel Speed Desaturation

If you command full forward throttle and full angular rotation simultaneously, the kinematics calculation may demand 6 m/s from the outer wheels when your motors can only achieve 4.5 m/s. Calling desaturateWheelSpeeds() scales all module speeds down proportionally, preserving your heading without motor saturation.


Robot odometry estimates field position by continuously integrating wheel distance deltas and gyro angles:

Δp = Twist2d(Δx, Δy, Δθ)

Modern WPILib uses exponential pose integration (Lie groups) rather than naive Euler integration, accurately accounting for circular arc paths traveled during the 20ms robot loop cycle.

Verified Sources & Standards

Evergreen Standard Verified: Sep 24, 2026