FlywheelSim
- class wpilib.simulation.FlywheelSim(plant: wpimath._wpimath.LinearSystem_1_1_1, gearbox: wpimath._wpimath.DCMotor, measurement_std_devs: 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.
measurement_std_devs – The standard deviation of the measurement noise.
- gearbox() wpimath._wpimath.DCMotor
Returns the gearbox.
- gearing() float
Returns the gearing;
- get_angular_acceleration() wpimath.units.radians_per_second_squared
Returns the flywheel’s acceleration.
- Returns:
The flywheel’s acceleration
- get_angular_velocity() wpimath.units.radians_per_second
Returns the flywheel’s velocity.
- Returns:
The flywheel’s velocity.
- get_current_draw() wpimath.units.amperes
Returns the flywheel’s current draw.
- Returns:
The flywheel’s current draw.
- get_input_voltage() wpimath.units.volts
Gets the input voltage for the flywheel.
- Returns:
The flywheel input voltage.
- get_torque() wpimath.units.newton_meters
Returns the flywheel’s torque.
- Returns:
The flywheel’s torque
- j() wpimath.units.kilogram_square_meters
Returns the moment of inertia
- set_input_voltage(voltage: wpimath.units.volts) None
Sets the input voltage for the flywheel.
- Parameters:
voltage – The input voltage.
- set_velocity(velocity: wpimath.units.radians_per_second) None
Sets the flywheel’s angular velocity.
- Parameters:
velocity – The new velocity