2023-02-13 17:21:24 -06:00
|
|
|
package swervelib.math;
|
2023-02-13 14:37:05 -06:00
|
|
|
|
|
|
|
|
import edu.wpi.first.math.geometry.Rotation2d;
|
|
|
|
|
import edu.wpi.first.math.kinematics.SwerveModuleState;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Second order kinematics swerve module state.
|
|
|
|
|
*/
|
|
|
|
|
public class SwerveModuleState2 extends SwerveModuleState
|
|
|
|
|
{
|
|
|
|
|
|
2023-02-14 22:03:02 -06:00
|
|
|
/**
|
|
|
|
|
* Swerve module speed in meters per second.
|
|
|
|
|
*/
|
|
|
|
|
public double speedMetersPerSecond;
|
2023-02-13 14:37:05 -06:00
|
|
|
/**
|
|
|
|
|
* Rad per sec
|
|
|
|
|
*/
|
2023-02-14 22:03:02 -06:00
|
|
|
public double omegaRadPerSecond = 0;
|
|
|
|
|
/**
|
|
|
|
|
* Swerve module angle as a {@link Rotation2d}.
|
|
|
|
|
*/
|
|
|
|
|
public Rotation2d angle = Rotation2d.fromDegrees(0);
|
2023-02-13 14:37:05 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a SwerveModuleState with zeros for speed and angle.
|
|
|
|
|
*/
|
|
|
|
|
public SwerveModuleState2()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a SwerveModuleState.
|
|
|
|
|
*
|
|
|
|
|
* @param speedMetersPerSecond The speed of the wheel of the module.
|
|
|
|
|
* @param angle The angle of the module.
|
|
|
|
|
* @param omegaRadPerSecond The angular velocity of the module.
|
|
|
|
|
*/
|
2023-02-20 20:59:31 -06:00
|
|
|
public SwerveModuleState2(
|
|
|
|
|
double speedMetersPerSecond, Rotation2d angle, double omegaRadPerSecond)
|
2023-02-13 14:37:05 -06:00
|
|
|
{
|
|
|
|
|
this.speedMetersPerSecond = speedMetersPerSecond;
|
|
|
|
|
this.angle = angle;
|
|
|
|
|
this.omegaRadPerSecond = omegaRadPerSecond;
|
|
|
|
|
}
|
|
|
|
|
}
|