Class FlywheelIOSim

java.lang.Object
frc.robot.subsystems.shooter.flywheel.FlywheelIOSim
All Implemented Interfaces:
FlywheelIO

public class FlywheelIOSim extends Object implements 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.

  • Constructor Details

    • FlywheelIOSim

      public FlywheelIOSim()
      Creates a new FlywheelIOSim and configures the SparkFlex identically to FlywheelIOSpark.
  • Method Details

    • updateInputs

      public void updateInputs(FlywheelIO.FlywheelIOInputs inputs)
      Updates the physics simulation and populates inputs from the SparkFlex sim state.
      Specified by:
      updateInputs in interface FlywheelIO
      Parameters:
      inputs - The inputs object to update.
    • runCharacterization

      public void runCharacterization(Voltage voltage)
      Description copied from interface: FlywheelIO
      Runs a characterization routine on the flywheel to determine its feedforward constants.
      Specified by:
      runCharacterization in interface FlywheelIO
      Parameters:
      voltage - The voltage to apply during characterization.
    • setAngularVelocity

      public void setAngularVelocity(AngularVelocity velocity)
      Description copied from interface: FlywheelIO
      Commands the flywheel to spin at a specific angular velocity.
      Specified by:
      setAngularVelocity in interface FlywheelIO
      Parameters:
      velocity - The target angular velocity for the flywheel.
    • stop

      public void stop()
      Description copied from interface: FlywheelIO
      Stops the flywheel motor.
      Specified by:
      stop in interface FlywheelIO