Package org.team1126.lib.swerve
Enum Class Perspective
- All Implemented Interfaces:
Serializable,Comparable<Perspective>,Constable
Describes a forward (X+ direction) perspective for
ChassisSpeeds.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract edu.wpi.first.math.geometry.Rotation2dGets the rotation to apply as the new zero when taring the robot's rotation to the perspective.abstract edu.wpi.first.math.kinematics.ChassisSpeedstoPerspectiveSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, edu.wpi.first.math.geometry.Rotation2d robotAngle) Converts robot relative speeds to the perspective relative speeds.abstract edu.wpi.first.math.kinematics.ChassisSpeedstoRobotSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, edu.wpi.first.math.geometry.Rotation2d robotAngle) Converts perspective relative speeds to robot relative speeds.static PerspectiveReturns the enum constant of this class with the specified name.static Perspective[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OPERATOR
The speeds are relative to the operator's perspective. If the robot is on the blue alliance, X+ drives towards the red alliance. If the robot is on the red alliance, X+ drives towards the blue alliance. -
BLUE
The speeds are relative to the blue alliance perspective. X+ drives towards the red alliance. -
RED
The speeds are relative to the red alliance perspective. X+ drives towards the blue alliance. -
ROBOT
The speeds are relative to the robot's perspective. X+ drives forwards relative to the chassis.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toRobotSpeeds
public abstract edu.wpi.first.math.kinematics.ChassisSpeeds toRobotSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, edu.wpi.first.math.geometry.Rotation2d robotAngle) Converts perspective relative speeds to robot relative speeds.- Parameters:
speeds- The perspective relative speeds to convert.robotAngle- The blue origin relative angle of the robot.
-
toPerspectiveSpeeds
public abstract edu.wpi.first.math.kinematics.ChassisSpeeds toPerspectiveSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, edu.wpi.first.math.geometry.Rotation2d robotAngle) Converts robot relative speeds to the perspective relative speeds.- Parameters:
speeds- The robot relative speeds to convert.robotAngle- The blue origin relative angle of the robot.
-
getTareRotation
public abstract edu.wpi.first.math.geometry.Rotation2d getTareRotation()Gets the rotation to apply as the new zero when taring the robot's rotation to the perspective.
-