Class SwerveModule
- java.lang.Object
-
- com.lightningrobotics.common.subsystem.drivetrain.swerve.SwerveModule
-
public class SwerveModule extends java.lang.ObjectRepresents a single swerve module with both drive and azimuth control.
-
-
Constructor Summary
Constructors Constructor Description SwerveModule(SwerveGains gains, edu.wpi.first.wpilibj.motorcontrol.MotorController driveMotor, edu.wpi.first.wpilibj.motorcontrol.MotorController angleMotor, java.util.function.Supplier<edu.wpi.first.math.geometry.Rotation2d> moduleAngle, java.util.function.DoubleSupplier driveMotorVelocity, PIDFController driveController, PIDFController angleController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.wpi.first.wpilibj.motorcontrol.MotorControllergetAzimuthMotor()edu.wpi.first.wpilibj.motorcontrol.MotorControllergetDriveMotor()edu.wpi.first.math.geometry.Rotation2dgetModuleAngle()SwerveModuleStategetState()doublegetVelocity()voidsetRawAzimuthPower(double pwr)voidsetRawDrivePower(double pwr)voidsetState(SwerveModuleState target)
-
-
-
Constructor Detail
-
SwerveModule
public SwerveModule(SwerveGains gains, edu.wpi.first.wpilibj.motorcontrol.MotorController driveMotor, edu.wpi.first.wpilibj.motorcontrol.MotorController angleMotor, java.util.function.Supplier<edu.wpi.first.math.geometry.Rotation2d> moduleAngle, java.util.function.DoubleSupplier driveMotorVelocity, PIDFController driveController, PIDFController angleController)
-
-
Method Detail
-
getModuleAngle
public edu.wpi.first.math.geometry.Rotation2d getModuleAngle()
-
getVelocity
public double getVelocity()
-
getDriveMotor
public edu.wpi.first.wpilibj.motorcontrol.MotorController getDriveMotor()
-
getAzimuthMotor
public edu.wpi.first.wpilibj.motorcontrol.MotorController getAzimuthMotor()
-
setState
public void setState(SwerveModuleState target)
-
setRawAzimuthPower
public void setRawAzimuthPower(double pwr)
-
setRawDrivePower
public void setRawDrivePower(double pwr)
-
getState
public SwerveModuleState getState()
-
-