core / com.acmerobotics.roadrunner.kinematics / MecanumKinematics

MecanumKinematics

object MecanumKinematics (source)

Mecanum drive kinematic equations. All wheel positions and velocities are given starting with front left and proceeding counter-clockwise (i.e., front left, rear left, rear right, front right). Robot poses are specified in a coordinate system with positive x pointing forward, positive y pointing left, and positive heading measured counter-clockwise from the x-axis.

This paper provides a motivated derivation.

Functions

robotToWheelAccelerations

Computes the wheel accelerations corresponding to robotAccel given the provided trackWidth and wheelBase.

fun robotToWheelAccelerations(robotAccel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth, lateralMultiplier: Double = 1.0): List<Double>

robotToWheelVelocities

Computes the wheel velocities corresponding to robotVel given the provided trackWidth and wheelBase.

fun robotToWheelVelocities(robotVel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth, lateralMultiplier: Double = 1.0): List<Double>

wheelToRobotVelocities

Computes the robot velocity corresponding to wheelVelocities and the given drive parameters.

fun wheelToRobotVelocities(wheelVelocities: List<Double>, trackWidth: Double, wheelBase: Double = trackWidth, lateralMultiplier: Double = 1.0): Pose2d