Class FlyWheelConfig
Configuration Example
// 1. Build the motor config with kV and kS feedforward (critical for velocity mechanisms)
SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig()
.withFeedforward(new SimpleMotorFeedforward(0.15, 0.12)) // kS=0.15, kV=0.12 kV dominates
at steady-state RPM .withClosedLoopController(0.0005, 0.0, 0.0) // kP .withTelemetry("Shooter",
TelemetryVerbosity.HIGH);
// 2. Create a TalonFXWrapper for a Kraken X60 on CAN ID 1
SmartMotorController motor = new TalonFXWrapper(new TalonFX(1), DCMotor.getKrakenX60(1),
motorConfig);
// 3. Assemble the FlyWheelConfig and mechanism
FlyWheelConfig config = new FlyWheelConfig()
.withDiameter(Inches.of(4))
.withSpeedometerSimulation(RPM.of(6000)) // optional: sim speedometer up to 6000 RPM
.withTelemetry("Shooter", TelemetryVerbosity.HIGH);
FlyWheel flywheel = new FlyWheel(config, motor);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Disable the use of the speedometer simulation for the shooter.org.wpilib.units.measure.AngularVelocitygetAngularVelocity(org.wpilib.units.measure.LinearVelocity velocity) org.wpilib.units.measure.DistanceGet the circumference of theFlyWheel.Optional<org.wpilib.units.measure.Distance> Get the Length of theFlyWheelorg.wpilib.units.measure.LinearVelocitygetLinearVelocity(org.wpilib.units.measure.AngularVelocity velocity) Get theMechanismPositionConfigassociated with thisFlyWheelConfig.org.wpilib.util.Color8BitGet sim colorOptional<org.wpilib.units.measure.AngularVelocity> Get the maximum velocity of the speedometer simulation.Network Tables name for theFlyWheelGet the telemetry verbosity of theFlyWheelbooleanCheck if the shooter is using the speedometer simulation.withDiameter(org.wpilib.units.measure.Distance distance) Configure theFlyWheels diameter for simulation.withMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig) Set the shooter mechanism position configuration.withSimColor(org.wpilib.util.Color8Bit simColor) Publish the color in sim as this.Enables the use of the speedometer simulation for the shooter.withSpeedometerSimulation(org.wpilib.units.measure.AngularVelocity maxVelocity) Enables the use of the speedometer simulation for the shooter.withTelemetry(String telemetryName, TelemetryVerbosity telemetryVerbosity) Configure telemetry for theFlyWheelmechanism.
-
Constructor Details
-
FlyWheelConfig
public FlyWheelConfig()FlyWheel Configuration class
-
-
Method Details
-
clone
-
withSpeedometerSimulation
public FlyWheelConfig withSpeedometerSimulation(org.wpilib.units.measure.AngularVelocity maxVelocity) Enables the use of the speedometer simulation for the shooter.The speedometer simulation is a simulation of a speedometer that is used to simulate the behavior of the shooter. This is useful for testing and debugging the shooter without having to physically move it.
- Parameters:
maxVelocity- The maximum velocity of the shooter.- Returns:
FlyWheelConfigfor chaining.
-
withSpeedometerSimulation
Enables the use of the speedometer simulation for the shooter.The speedometer simulation is a simulation of a speedometer that is used to simulate the behavior of the shooter. This is useful for testing and debugging the shooter without having to physically move it.
- Returns:
FlyWheelConfigfor chaining.- Throws:
FlyWheelConfigurationException- if the speedometer max velocity has not been set withwithSpeedometerSimulation(AngularVelocity).
-
disableSpeedometerSimulation
Disable the use of the speedometer simulation for the shooter.The speedometer simulation is a simulation of a speedometer that is used to simulate the behavior of the shooter. This is useful for testing and debugging the shooter without having to physically move it.
- Returns:
FlyWheelConfigfor chaining.
-
isUsingSpeedometerSimulation
public boolean isUsingSpeedometerSimulation()Check if the shooter is using the speedometer simulation.The speedometer simulation is a simulation of the speedometer that is used to simulate the behavior of the shooter. This is useful for testing and debugging the shooter without having to physically move it.
- Returns:
- True if the shooter is using the speedometer simulation.
-
getSpeedometerMaxVelocity
Get the maximum velocity of the speedometer simulation.If the speedometer simulation is not enabled, this will return an empty Optional.
- Returns:
- The maximum velocity of the speedometer simulation, or an empty Optional if the speedometer simulation is not enabled.
-
withSimColor
Publish the color in sim as this.- Parameters:
simColor-Color8Bitto show.- Returns:
FlyWheelConfigfor chaining.
-
withDiameter
Configure theFlyWheels diameter for simulation.- Parameters:
distance- Length of theFlyWheel.- Returns:
FlyWheelConfigfor chaining.
-
withMechanismPositionConfig
Set the shooter mechanism position configuration.- Parameters:
mechanismPositionConfig-MechanismPositionConfigfor theFlyWheel- Returns:
FlyWheelConfigfor chaining
-
withTelemetry
Configure telemetry for theFlyWheelmechanism.- Parameters:
telemetryName- Telemetry NetworkTable name to appear under "SmartDashboard/"telemetryVerbosity- Telemetry verbosity to apply.- Returns:
FlyWheelConfigfor chaining.
-
getDiameter
-
getTelemetryVerbosity
Get the telemetry verbosity of theFlyWheel- Returns:
TelemetryVerbosityof theFlyWheel
-
getTelemetryName
-
getSimColor
public org.wpilib.util.Color8Bit getSimColor()Get sim color- Returns:
- sim color.
-
getMechanismPositionConfig
Get theMechanismPositionConfigassociated with thisFlyWheelConfig.- Returns:
- An
Optionalcontaining theMechanismPositionConfigif present, otherwise an emptyOptional.
-
getCircumference
public org.wpilib.units.measure.Distance getCircumference()Get the circumference of theFlyWheel.- Returns:
Distancerepresenting the circumference of the FlyWheel.- Throws:
FlyWheelConfigurationException- if the diameter is not set withwithDiameter(Distance).
-
getLinearVelocity
public org.wpilib.units.measure.LinearVelocity getLinearVelocity(org.wpilib.units.measure.AngularVelocity velocity) - Parameters:
velocity-AngularVelocityto convert toLinearVelocity- Returns:
LinearVelocityof theFlyWheel- Throws:
FlyWheelConfigurationException- if the diameter is not set withwithDiameter(Distance).
-
getAngularVelocity
public org.wpilib.units.measure.AngularVelocity getAngularVelocity(org.wpilib.units.measure.LinearVelocity velocity) - Parameters:
velocity-LinearVelocityto convert toAngularVelocity- Returns:
AngularVelocityof theFlyWheel- Throws:
FlyWheelConfigurationException- if the diameter is not set withwithDiameter(Distance).
-