ElevatorSim¶
- class wpilib.simulation.ElevatorSim(*args, **kwargs)¶
Bases:
LinearSystemSim_2_1_1
Represents a simulated elevator mechanism.
Overloaded function.
__init__(self: wpilib.simulation._simulation.ElevatorSim, plant: wpimath._controls._controls.system.LinearSystem_2_1_1, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, drumRadius: meters, minHeight: meters, maxHeight: meters, simulateGravity: bool, measurementStdDevs: List[float[1]] = [0.0]) -> None
Constructs a simulated elevator mechanism.
- Parameters:
plant – The linear system that represents the elevator.
gearbox – The type of and number of motors in your elevator gearbox.
gearing – The gearing of the elevator (numbers greater than 1 represent reductions).
drumRadius – The radius of the drum that your cable is wrapped around.
minHeight – The minimum allowed height of the elevator.
maxHeight – The maximum allowed height of the elevator.
simulateGravity – Whether gravity should be simulated or not.
measurementStdDevs – The standard deviation of the measurements.
__init__(self: wpilib.simulation._simulation.ElevatorSim, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, carriageMass: kilograms, drumRadius: meters, minHeight: meters, maxHeight: meters, simulateGravity: bool, measurementStdDevs: List[float[1]] = [0.0]) -> None
Constructs a simulated elevator mechanism.
- Parameters:
gearbox – The type of and number of motors in your elevator gearbox.
gearing – The gearing of the elevator (numbers greater than 1 represent reductions).
carriageMass – The mass of the elevator carriage.
drumRadius – The radius of the drum that your cable is wrapped around.
minHeight – The minimum allowed height of the elevator.
maxHeight – The maximum allowed height of the elevator.
simulateGravity – Whether gravity should be simulated or not.
measurementStdDevs – The standard deviation of the measurements.
- getCurrentDraw() amperes ¶
Returns the elevator current draw.
- Returns:
The elevator current draw.
- getPosition() meters ¶
Returns the position of the elevator.
- Returns:
The position of the elevator.
- getPositionFeet() feet ¶
- getPositionInches() inches ¶
- getVelocity() meters_per_second ¶
Returns the velocity of the elevator.
- Returns:
The velocity of the elevator.
- getVelocityFps() feet_per_second ¶
- hasHitLowerLimit() bool ¶
Returns whether the elevator has hit the lower limit.
- Returns:
Whether the elevator has hit the lower limit.
- hasHitUpperLimit() bool ¶
Returns whether the elevator has hit the upper limit.
- Returns:
Whether the elevator has hit the upper limit.
- setInputVoltage(voltage: volts) None ¶
Sets the input voltage for the elevator.
- Parameters:
voltage – The input voltage.
- wouldHitLowerLimit(elevatorHeight: meters) bool ¶
Returns whether the elevator would hit the lower limit.
- Parameters:
elevatorHeight – The elevator height.
- Returns:
Whether the elevator would hit the lower limit.
- wouldHitUpperLimit(elevatorHeight: meters) bool ¶
Returns whether the elevator would hit the upper limit.
- Parameters:
elevatorHeight – The elevator height.
- Returns:
Whether the elevator would hit the upper limit.