FlywheelSim
- class wpilib.simulation.FlywheelSim(plant: wpimath._wpimath.LinearSystem_1_1_1, gearbox: wpimath._wpimath.DCMotor, measurementStdDevs: Annotated[collections.abc.Sequence[SupportsFloat | SupportsIndex], 'FixedSize(1)'] = [0.0])
Bases:
LinearSystemSim_1_1_1Represents a simulated flywheel mechanism.
Creates a simulated flywheel mechanism.
- Parameters:
plant – The linear system representing the flywheel. This system can be created with wpi::math::Models::FlywheelFromPhysicalConstants() or wpi::math::Models::FlywheelFromSysId().
gearbox – The type of and number of motors in the flywheel gearbox.
measurementStdDevs – The standard deviation of the measurement noise.
- J() wpimath.units.kilogram_square_meters
Returns the moment of inertia
- gearbox() wpimath._wpimath.DCMotor
Returns the gearbox.
- gearing() float
Returns the gearing;
- getAngularAcceleration() wpimath.units.radians_per_second_squared
Returns the flywheel’s acceleration.
- Returns:
The flywheel’s acceleration
- getAngularVelocity() wpimath.units.radians_per_second
Returns the flywheel’s velocity.
- Returns:
The flywheel’s velocity.
- getCurrentDraw() wpimath.units.amperes
Returns the flywheel’s current draw.
- Returns:
The flywheel’s current draw.
- getInputVoltage() wpimath.units.volts
Gets the input voltage for the flywheel.
- Returns:
The flywheel input voltage.
- getTorque() wpimath.units.newton_meters
Returns the flywheel’s torque.
- Returns:
The flywheel’s torque
- setInputVoltage(voltage: wpimath.units.volts) None
Sets the input voltage for the flywheel.
- Parameters:
voltage – The input voltage.
- setVelocity(velocity: wpimath.units.radians_per_second) None
Sets the flywheel’s angular velocity.
- Parameters:
velocity – The new velocity