core / com.acmerobotics.roadrunner.drive / Kinematics

Kinematics

object Kinematics

A collection of methods for various kinematics-related tasks.

Functions

calculateMotorFeedforward

fun calculateMotorFeedforward(velocities: List<Double>, accelerations: List<Double>, kV: Double, kA: Double, kStatic: Double): List<Double>

Computes the motor feedforwards (i.e., open loop powers) for the given set of coefficients.

fun calculateMotorFeedforward(velocity: Double, acceleration: Double, kV: Double, kA: Double, kStatic: Double): Double

Computes the motor feedforward (i.e., open loop power) for the given set of coefficients.

calculatePoseError

fun calculatePoseError(targetFieldPose: Pose2d, actualFieldPose: Pose2d): Pose2d

Returns the error between targetFieldPose and actualFieldPose.

fieldToRobotPose

fun fieldToRobotPose(fieldPose: Pose2d): Pose2d

Returns the robot pose corresponding to fieldPose.

fieldToRobotPoseAcceleration

fun fieldToRobotPoseAcceleration(fieldPose: Pose2d, fieldPoseVelocity: Pose2d, fieldPoseAcceleration: Pose2d): Pose2d

Returns the robot pose acceleration corresponding to fieldPose, fieldPoseVelocity, and fieldPoseAcceleration.

fieldToRobotPoseVelocity

fun fieldToRobotPoseVelocity(fieldPose: Pose2d, fieldPoseVelocity: Pose2d): Pose2d

Returns the robot pose velocity corresponding to fieldPose and fieldPoseVelocity.

relativeOdometryUpdate

fun relativeOdometryUpdate(fieldPose: Pose2d, robotPoseDelta: Pose2d): Pose2d

Performs a relative odometry update. Note: this assumes that the robot moves with constant velocity over the measurement interval.