Class SwerveModule
- java.lang.Object
-
- com.lightningrobotics.common.subsystem.drivetrain.swerve.SwerveModule
-
public class SwerveModule extends java.lang.Object
Represents 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.MotorController
getAzimuthMotor()
edu.wpi.first.wpilibj.motorcontrol.MotorController
getDriveMotor()
edu.wpi.first.math.geometry.Rotation2d
getModuleAngle()
SwerveModuleState
getState()
double
getVelocity()
void
setRawAzimuthPower(double pwr)
void
setRawDrivePower(double pwr)
void
setState(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()
-
-