Class Module
java.lang.Object
org.teamvan.robot.mechanisms.drive.Module
-
Constructor Summary
ConstructorsConstructorDescriptionModule(ModuleIO io, int index, SwerveModuleConstants<TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> constants) -
Method Summary
Modifier and TypeMethodDescriptiongetAngle()Returns the current turn angle of the module.doubleReturns the module velocity in rotations/sec (Phoenix native units).Returns the module positions received this cycle.double[]Returns the timestamps of the samples received this cycle.Returns the module position (turn angle and drive position).doubleReturns the current drive position of the module in meters.getState()Returns the module state (turn angle and drive velocity).doubleReturns the current drive velocity of the module in meters per second.doubleReturns the module position in radians.voidrunCharacterization(double output) Runs the module with the specified output while controlling to zero degrees.runSetpoint(SwerveModuleVelocity state) Runs the module with the specified setpoint state.voidstop()Disables all outputs to motors.voidReads the module's hardware inputs and publishes them to telemetry.
-
Constructor Details
-
Module
public Module(ModuleIO io, int index, SwerveModuleConstants<TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> constants)
-
-
Method Details
-
updateInputs
public void updateInputs()Reads the module's hardware inputs and publishes them to telemetry. -
runSetpoint
Runs the module with the specified setpoint state.- Returns:
- the optimized state that was applied to the module
-
runCharacterization
public void runCharacterization(double output) Runs the module with the specified output while controlling to zero degrees. -
stop
public void stop()Disables all outputs to motors. -
getAngle
Returns the current turn angle of the module. -
getPositionMeters
public double getPositionMeters()Returns the current drive position of the module in meters. -
getVelocityMetersPerSec
public double getVelocityMetersPerSec()Returns the current drive velocity of the module in meters per second. -
getPosition
Returns the module position (turn angle and drive position). -
getState
Returns the module state (turn angle and drive velocity). -
getOdometryPositions
Returns the module positions received this cycle. -
getOdometryTimestamps
public double[] getOdometryTimestamps()Returns the timestamps of the samples received this cycle. -
getWheelRadiusCharacterizationPosition
public double getWheelRadiusCharacterizationPosition()Returns the module position in radians. -
getFFCharacterizationVelocity
public double getFFCharacterizationVelocity()Returns the module velocity in rotations/sec (Phoenix native units).
-