FlywheelSim
- class wpilib.simulation.FlywheelSim(*args, **kwargs)
Bases:
LinearSystemSim_1_1_1
Represents a simulated flywheel mechanism.
Overloaded function.
__init__(self: wpilib.simulation._simulation.FlywheelSim, plant: wpimath._controls._controls.system.LinearSystem_1_1_1, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, measurementStdDevs: Annotated[list[float], FixedSize(1)] = [0.0]) -> None
Creates a simulated flywheel mechanism.
- Parameters:
plant – The linear system representing the flywheel. This system can be created with LinearSystemId::FlywheelSystem().
gearbox – The type of and number of motors in the flywheel gearbox.
gearing – The gearing of the flywheel (numbers greater than 1 represent reductions).
measurementStdDevs – The standard deviation of the measurement noise.
__init__(self: wpilib.simulation._simulation.FlywheelSim, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, moi: wpimath.units.kilogram_square_meters, measurementStdDevs: Annotated[list[float], FixedSize(1)] = [0.0]) -> None
Creates a simulated flywheel mechanism.
- Parameters:
gearbox – The type of and number of motors in the flywheel gearbox.
gearing – The gearing of the flywheel (numbers greater than 1 represent reductions).
moi – The moment of inertia of the flywheel.
measurementStdDevs – The standard deviation of the measurement noise.
- getAngularVelocity() wpimath.units.radians_per_second
Returns the flywheel velocity.
- Returns:
The flywheel velocity.
- getCurrentDraw() wpimath.units.amperes
Returns the flywheel current draw.
- Returns:
The flywheel current draw.
- setInputVoltage(voltage: wpimath.units.volts) None
Sets the input voltage for the flywheel.
- Parameters:
voltage – The input voltage.
- setState(velocity: wpimath.units.radians_per_second) None
Sets the flywheel’s state.
- Parameters:
velocity – The new velocity