Class FlywheelIOSim
java.lang.Object
frc.robot.subsystems.shooter.flywheel.FlywheelIOSim
- All Implemented Interfaces:
FlywheelIO
Simulation implementation of
FlywheelIO.
This class uses a SparkFlex with its SparkFlexSim wrapper to simulate the
flywheel motor controller, backed by a DCMotorSim physics model. The SparkFlex's built-in
MAXMotion velocity control is used, matching the real robot's FlywheelIOSpark.
Configuration is identical to the real implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface frc.robot.subsystems.shooter.flywheel.FlywheelIO
FlywheelIO.FlywheelIOInputs -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new FlywheelIOSim and configures the SparkFlex identically toFlywheelIOSpark. -
Method Summary
Modifier and TypeMethodDescriptionvoidrunCharacterization(Voltage voltage) Runs a characterization routine on the flywheel to determine its feedforward constants.voidsetAngularVelocity(AngularVelocity velocity) Commands the flywheel to spin at a specific angular velocity.voidstop()Stops the flywheel motor.voidUpdates the physics simulation and populates inputs from the SparkFlex sim state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface frc.robot.subsystems.shooter.flywheel.FlywheelIO
clearFaults
-
Constructor Details
-
FlywheelIOSim
public FlywheelIOSim()Creates a new FlywheelIOSim and configures the SparkFlex identically toFlywheelIOSpark.
-
-
Method Details
-
updateInputs
Updates the physics simulation and populates inputs from the SparkFlex sim state.- Specified by:
updateInputsin interfaceFlywheelIO- Parameters:
inputs- The inputs object to update.
-
runCharacterization
Description copied from interface:FlywheelIORuns a characterization routine on the flywheel to determine its feedforward constants.- Specified by:
runCharacterizationin interfaceFlywheelIO- Parameters:
voltage- The voltage to apply during characterization.
-
setAngularVelocity
Description copied from interface:FlywheelIOCommands the flywheel to spin at a specific angular velocity.- Specified by:
setAngularVelocityin interfaceFlywheelIO- Parameters:
velocity- The target angular velocity for the flywheel.
-
stop
public void stop()Description copied from interface:FlywheelIOStops the flywheel motor.- Specified by:
stopin interfaceFlywheelIO
-