public class SwerveKinematics
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.
public static SwerveKinematics INSTANCE
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.
@JvmStatic @JvmOverloads @NotNull public static java.util.List<com.acmerobotics.roadrunner.geometry.Vector2d> robotToModuleVelocityVectors(@NotNull Pose2d robotVel, double trackWidth, double wheelBase)
Computes the wheel velocity vectors corresponding to robotVel
given the provided trackWidth
and
wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<com.acmerobotics.roadrunner.geometry.Vector2d> robotToModuleVelocityVectors(@NotNull Pose2d robotVel, double trackWidth)
Computes the wheel velocity vectors corresponding to robotVel
given the provided trackWidth
and
wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToWheelVelocities(@NotNull Pose2d robotVel, double trackWidth, double wheelBase)
Computes the wheel velocities corresponding to robotVel
given the provided trackWidth
and
wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToWheelVelocities(@NotNull Pose2d robotVel, double trackWidth)
Computes the wheel velocities corresponding to robotVel
given the provided trackWidth
and
wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToModuleOrientations(@NotNull Pose2d robotVel, double trackWidth, double wheelBase)
Computes the module orientations (in radians) corresponding to robotVel
given the provided
trackWidth
and wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToModuleOrientations(@NotNull Pose2d robotVel, double trackWidth)
Computes the module orientations (in radians) corresponding to robotVel
given the provided
trackWidth
and wheelBase
.
robotVel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotVel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<com.acmerobotics.roadrunner.geometry.Vector2d> robotToModuleAccelerationVectors(@NotNull Pose2d robotAccel, double trackWidth, double wheelBase)
Computes the acceleration vectors corresponding to robotAccel
given the provided trackWidth
and
wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<com.acmerobotics.roadrunner.geometry.Vector2d> robotToModuleAccelerationVectors(@NotNull Pose2d robotAccel, double trackWidth)
Computes the acceleration vectors corresponding to robotAccel
given the provided trackWidth
and
wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToWheelAccelerations(@NotNull Pose2d robotVel, @NotNull Pose2d robotAccel, double trackWidth, double wheelBase)
Computes the wheel accelerations corresponding to robotAccel
given the provided trackWidth
and
wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToWheelAccelerations(@NotNull Pose2d robotVel, @NotNull Pose2d robotAccel, double trackWidth)
Computes the wheel accelerations corresponding to robotAccel
given the provided trackWidth
and
wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToModuleAngularVelocities(@NotNull Pose2d robotVel, @NotNull Pose2d robotAccel, double trackWidth, double wheelBase)
Computes the module angular velocities corresponding to robotAccel
given the provided trackWidth
and wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static java.util.List<java.lang.Double> robotToModuleAngularVelocities(@NotNull Pose2d robotVel, @NotNull Pose2d robotAccel, double trackWidth)
Computes the module angular velocities corresponding to robotAccel
given the provided trackWidth
and wheelBase
.
robotAccel
- velocity of the robot in its reference frametrackWidth
- lateral distance between pairs of wheels on different sides of the robotrobotAccel
,
trackWidth
,
wheelBase
@JvmStatic @JvmOverloads @NotNull public static Pose2d wheelToRobotVelocities(@NotNull java.util.List<java.lang.Double> wheelVelocities, @NotNull java.util.List<java.lang.Double> moduleOrientations, double trackWidth, double wheelBase)
Computes the robot velocities corresponding to wheelVelocities
, moduleOrientations
, and the drive parameters.
wheelVelocities
- wheel velocities (or wheel position deltas)moduleOrientations
- wheel orientations (in radians)trackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotwheelVelocities
,
moduleOrientations
@JvmStatic @JvmOverloads @NotNull public static Pose2d wheelToRobotVelocities(@NotNull java.util.List<java.lang.Double> wheelVelocities, @NotNull java.util.List<java.lang.Double> moduleOrientations, double trackWidth)
Computes the robot velocities corresponding to wheelVelocities
, moduleOrientations
, and the drive parameters.
wheelVelocities
- wheel velocities (or wheel position deltas)moduleOrientations
- wheel orientations (in radians)trackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelVelocities
,
moduleOrientations