Class FlyWheelConfigurationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
yams.core.exceptions.FlyWheelConfigurationException
All Implemented Interfaces:
Serializable

public class FlyWheelConfigurationException extends RuntimeException
Thrown by FlyWheel or FlyWheelConfig when a required field in FlyWheelConfig is missing or invalid.

Common triggers include:

  • withSmartMotorController(SmartMotorController) called more than once on the same config
  • Speedometer max velocity not set when speedometer simulation is requested ( withSpeedometerSimulation(AngularVelocity))
  • Flywheel diameter not set when surface speed calculations are needed (withDiameter(Distance))
  • MOI (moment of inertia) not derivable neither diameter+mass nor an explicit MOI was provided

Resolution: Ensure FlyWheelConfig.withSmartMotorController(SmartMotorController) is called exactly once, FlyWheelConfig.withDiameter(Distance) and FlyWheelConfig.withMass(Mass) are set (or provide an explicit MOI via FlyWheelConfig.withMOI()), and when using speedometer simulation FlyWheelConfig.withSpeedometerSimulation(AngularVelocity) is called with a nonzero max velocity.

Example minimal configuration:

FlyWheelConfig config = new FlyWheelConfig()
    .withSmartMotorController(SmartMotorController.create(SPARK_MAX, DCMotor.getNEO(1)))
    .withDiameter(Inches.of(4))
    .withMass(Pounds.of(0.5));
FlyWheel flyWheel = new FlyWheel(config);
See Also:
  • Constructor Details

    • FlyWheelConfigurationException

      public FlyWheelConfigurationException(String message, String result, String remedyFunction)
      FlyWheel configuration exception.
      Parameters:
      message - Message to display.
      result - Result of the configuration.
      remedyFunction - Remedy function to use.