core / com.acmerobotics.roadrunner.kinematics / SwerveKinematics

SwerveKinematics

object SwerveKinematics (source)

Swerve 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.

Functions

robotToModuleAccelerationVectors

Computes the acceleration vectors corresponding to robotAccel given the provided trackWidth and wheelBase.

fun robotToModuleAccelerationVectors(robotAccel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth): List<Vector2d>

robotToModuleAngularVelocities

Computes the module angular velocities corresponding to robotAccel given the provided trackWidth and wheelBase.

fun robotToModuleAngularVelocities(robotVel: Pose2d, robotAccel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth): List<Double>

robotToModuleOrientations

Computes the module orientations (in radians) corresponding to robotVel given the provided trackWidth and wheelBase.

fun robotToModuleOrientations(robotVel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth): List<Double>

robotToModuleVelocityVectors

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

fun robotToModuleVelocityVectors(robotVel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth): List<Vector2d>

robotToWheelAccelerations

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

fun robotToWheelAccelerations(robotVel: Pose2d, robotAccel: Pose2d, trackWidth: Double, wheelBase: Double = trackWidth): 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): List<Double>

wheelToRobotVelocities

Computes the robot velocities corresponding to wheelVelocities, moduleOrientations, and the drive parameters.

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