Package frc.robot.subsystems.swervedrive.swerve.kinematics

## Class SwerveModuleState2

- java.lang.Object
- - edu.wpi.first.math.kinematics.SwerveModuleState
  - - frc.robot.subsystems.swervedrive.swerve.kinematics.SwerveModuleState2

All Implemented Interfaces:
  `java.lang.Comparable<edu.wpi.first.math.kinematics.SwerveModuleState>`

    public class SwerveModuleState2
    extends edu.wpi.first.math.kinematics.SwerveModuleState

### Field Summary

Fields
`double` `angularVelocityRadPerSecond` Angular velocity in radians per second.

### Fields inherited from class edu.wpi.first.math.kinematics.SwerveModuleState

`angle, speedMetersPerSecond`

### Constructor Summary

Constructors
`SwerveModuleState2()` Constructs a SwerveModuleState with zeros for speed and angle.
`SwerveModuleState2​(double speedMetersPerSecond, edu.wpi.first.math.geometry.Rotation2d angle)` Constructs a SwerveModuleState.
`SwerveModuleState2​(double speedMetersPerSecond, edu.wpi.first.math.geometry.Rotation2d angle, double angularVelocityRadPerSecond)` Constructs a SwerveModuleState.
`SwerveModuleState2​(edu.wpi.first.math.kinematics.SwerveModuleState self)` Constructs a SwerveModuleState with zeros for speed and angle.

### Method Summary

All Methods Static Methods Concrete Methods
`static SwerveModuleState2` `optimize​(SwerveModuleState2 desiredState, edu.wpi.first.math.geometry.Rotation2d currentAngle)` Minimize the change in heading the desired swerve module state would require by potentially reversing the direction the wheel spins.
`static double` `placeInAppropriate0To360Scope​(double scopeReference, double newAngle)`

### Methods inherited from class edu.wpi.first.math.kinematics.SwerveModuleState

`compareTo, equals, hashCode, optimize, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### angularVelocityRadPerSecond

    public double angularVelocityRadPerSecond

Angular velocity in radians per second. Angular Velocity = omega.

### Constructor Detail

#### SwerveModuleState2

    public SwerveModuleState2()

Constructs a SwerveModuleState with zeros for speed and angle.

#### SwerveModuleState2

    public SwerveModuleState2​(edu.wpi.first.math.kinematics.SwerveModuleState self)

Constructs a SwerveModuleState with zeros for speed and angle.

#### SwerveModuleState2

    public SwerveModuleState2​(double speedMetersPerSecond,
                              edu.wpi.first.math.geometry.Rotation2d angle)

Constructs a SwerveModuleState.

Parameters:
  `speedMetersPerSecond` - The speed of the wheel of the module.
  `angle` - The angle of the module.

#### SwerveModuleState2

    public SwerveModuleState2​(double speedMetersPerSecond,
                              edu.wpi.first.math.geometry.Rotation2d angle,
                              double angularVelocityRadPerSecond)

Constructs a SwerveModuleState.

Parameters:
  `speedMetersPerSecond` - The speed of the wheel of the module.
  `angle` - The angle of the module.
  `angularVelocityRadPerSecond` - The angular velocity of the module.

### Method Detail

#### optimize

    public static SwerveModuleState2 optimize​(SwerveModuleState2 desiredState,
                                              edu.wpi.first.math.geometry.Rotation2d currentAngle)

Minimize the change in heading the desired swerve module state would require by potentially reversing the direction the wheel spins. Customized from WPILib's version to include placing in appropriate scope for CTRE and REV onboard control as both controllers as of writing don't have support for continuous input.

Parameters:
  `desiredState` - The desired state.
  `currentAngle` - The current module angle.

#### placeInAppropriate0To360Scope

    public static double placeInAppropriate0To360Scope​(double scopeReference,
                                                       double newAngle)

Parameters:
  `scopeReference` - Current Angle
  `newAngle` - Target Angle
Returns:
  Closest angle within scope