Package edu.wpi.first.math.kinematics
Class MecanumDriveWheelSpeeds
java.lang.Object
edu.wpi.first.math.kinematics.MecanumDriveWheelSpeeds
public class MecanumDriveWheelSpeeds extends Object
-
Field Summary
Fields Modifier and Type Field Description double
frontLeftMetersPerSecond
Speed of the front left wheel.double
frontRightMetersPerSecond
Speed of the front right wheel.double
rearLeftMetersPerSecond
Speed of the rear left wheel.double
rearRightMetersPerSecond
Speed of the rear right wheel. -
Constructor Summary
Constructors Constructor Description MecanumDriveWheelSpeeds()
Constructs a MecanumDriveWheelSpeeds with zeros for all member fields.MecanumDriveWheelSpeeds(double frontLeftMetersPerSecond, double frontRightMetersPerSecond, double rearLeftMetersPerSecond, double rearRightMetersPerSecond)
Constructs a MecanumDriveWheelSpeeds. -
Method Summary
Modifier and Type Method Description void
desaturate(double attainableMaxSpeedMetersPerSecond)
Renormalizes the wheel speeds if any individual speed is above the specified maximum.String
toString()
-
Field Details
-
frontLeftMetersPerSecond
Speed of the front left wheel. -
frontRightMetersPerSecond
Speed of the front right wheel. -
rearLeftMetersPerSecond
Speed of the rear left wheel. -
rearRightMetersPerSecond
Speed of the rear right wheel.
-
-
Constructor Details
-
MecanumDriveWheelSpeeds
public MecanumDriveWheelSpeeds()Constructs a MecanumDriveWheelSpeeds with zeros for all member fields. -
MecanumDriveWheelSpeeds
public MecanumDriveWheelSpeeds(double frontLeftMetersPerSecond, double frontRightMetersPerSecond, double rearLeftMetersPerSecond, double rearRightMetersPerSecond)Constructs a MecanumDriveWheelSpeeds.- Parameters:
frontLeftMetersPerSecond
- Speed of the front left wheel.frontRightMetersPerSecond
- Speed of the front right wheel.rearLeftMetersPerSecond
- Speed of the rear left wheel.rearRightMetersPerSecond
- Speed of the rear right wheel.
-
-
Method Details
-
desaturate
Renormalizes the wheel speeds if any individual speed is above the specified maximum.Sometimes, after inverse kinematics, the requested speed from one or more wheels may be above the max attainable speed for the driving motor on that wheel. To fix this issue, one can reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the absolute threshold, while maintaining the ratio of speeds between wheels.
- Parameters:
attainableMaxSpeedMetersPerSecond
- The absolute max speed that a wheel can reach.
-
toString
-