Package edu.wpi.first.wpilibj.kinematics
Class SwerveModuleState
- java.lang.Object
-
- edu.wpi.first.wpilibj.kinematics.SwerveModuleState
-
- All Implemented Interfaces:
Comparable<SwerveModuleState>
public class SwerveModuleState extends Object implements Comparable<SwerveModuleState>
Represents the state of one swerve module.
-
-
Field Summary
Fields Modifier and Type Field Description Rotation2dangleAngle of the module.doublespeedMetersPerSecondSpeed of the wheel of the module.
-
Constructor Summary
Constructors Constructor Description SwerveModuleState()Constructs a SwerveModuleState with zeros for speed and angle.SwerveModuleState(double speedMetersPerSecond, Rotation2d angle)Constructs a SwerveModuleState.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SwerveModuleState o)Compares two swerve module states.StringtoString()
-
-
-
Field Detail
-
speedMetersPerSecond
public double speedMetersPerSecond
Speed of the wheel of the module.
-
angle
public Rotation2d angle
Angle of the module.
-
-
Constructor Detail
-
SwerveModuleState
public SwerveModuleState()
Constructs a SwerveModuleState with zeros for speed and angle.
-
SwerveModuleState
public SwerveModuleState(double speedMetersPerSecond, Rotation2d angle)Constructs a SwerveModuleState.- Parameters:
speedMetersPerSecond- The speed of the wheel of the module.angle- The angle of the module.
-
-
Method Detail
-
compareTo
public int compareTo(SwerveModuleState o)
Compares two swerve module states. One swerve module is "greater" than the other if its speed is higher than the other.- Specified by:
compareToin interfaceComparable<SwerveModuleState>- Parameters:
o- The other swerve module.- Returns:
- 1 if this is greater, 0 if both are equal, -1 if other is greater.
-
-