Package frc.robot.subsystems.turret
Class TurretSim
java.lang.Object
frc.robot.subsystems.turret.TurretSim
- All Implemented Interfaces:
TurretIO
Simulation implementation of
TurretIO.
This class provides a lightweight software model of the turret hardware for use in simulation, unit testing, and log replay. It maintains an internal turret angle state and generates synthetic absolute encoder readings based on the configured gear ratios and offsets.
To better approximate real sensor behavior, small amounts of random noise are added to each simulated encoder measurement. This helps exercise the turret angle estimation and filtering logic under non-ideal conditions.
This simulation does not model turret dynamics such as inertia, acceleration limits, or closed-loop control behavior. Target angles are applied instantaneously.
-
Nested Class Summary
Nested classes/interfaces inherited from interface frc.robot.subsystems.turret.TurretIO
TurretIO.TurretInputs -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidresetPosition(Angle angle) voidsetTargetAngle(Angle angle) Commands the turret to move toward the specified target angle.voidsetTurretVoltage(Voltage volts) voidupdateInputs(TurretIO.TurretInputs inputs) Updates the providedTurretIO.TurretInputsstructure with the latest sensor values.
-
Field Details
-
turrentAngle
-
-
Constructor Details
-
TurretSim
-
-
Method Details
-
updateInputs
Description copied from interface:TurretIOUpdates the providedTurretIO.TurretInputsstructure with the latest sensor values.- Specified by:
updateInputsin interfaceTurretIO
-
setTurretVoltage
- Specified by:
setTurretVoltagein interfaceTurretIO
-
setTargetAngle
Description copied from interface:TurretIOCommands the turret to move toward the specified target angle.- Specified by:
setTargetAnglein interfaceTurretIO
-
resetPosition
- Specified by:
resetPositionin interfaceTurretIO
-