SingleJointedArmSim¶
- class wpilib.simulation.SingleJointedArmSim(*args, **kwargs)¶
Bases:
LinearSystemSim_2_1_1
Represents a simulated arm mechanism.
Overloaded function.
__init__(self: wpilib.simulation._simulation.SingleJointedArmSim, system: wpimath._controls._controls.system.LinearSystem_2_1_1, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, armLength: meters, minAngle: radians, maxAngle: radians, simulateGravity: bool, measurementStdDevs: List[float[1]] = [0.0]) -> None
Creates a simulated arm mechanism.
- Parameters:
system – The system representing this arm.
gearbox – The type and number of motors on the arm gearbox.
gearing – The gear ratio of the arm (numbers greater than 1 represent reductions).
armLength – The length of the arm.
minAngle – The minimum angle that the arm is capable of.
maxAngle – The maximum angle that the arm is capable of.
simulateGravity – Whether gravity should be simulated or not.
measurementStdDevs – The standard deviations of the measurements.
__init__(self: wpilib.simulation._simulation.SingleJointedArmSim, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, moi: kilogram_square_meters, armLength: meters, minAngle: radians, maxAngle: radians, simulateGravity: bool, measurementStdDevs: List[float[1]] = [0.0]) -> None
Creates a simulated arm mechanism.
- Parameters:
gearbox – The type and number of motors on the arm gearbox.
gearing – The gear ratio of the arm (numbers greater than 1 represent reductions).
moi – The moment of inertia of the arm. This can be calculated from CAD software.
armLength – The length of the arm.
minAngle – The minimum angle that the arm is capable of.
maxAngle – The maximum angle that the arm is capable of.
simulateGravity – Whether gravity should be simulated or not.
measurementStdDevs – The standard deviation of the measurement noise.
- static estimateMOI(length: meters, mass: kilograms) kilogram_square_meters ¶
Calculates a rough estimate of the moment of inertia of an arm given its length and mass.
- Parameters:
length – The length of the arm.
mass – The mass of the arm.
- Returns:
The calculated moment of inertia.
- getAngle() radians ¶
Returns the current arm angle.
- Returns:
The current arm angle.
- getAngleDegrees() degrees ¶
- getCurrentDraw() amperes ¶
Returns the arm current draw.
- Returns:
The arm current draw.
- getVelocity() radians_per_second ¶
Returns the current arm velocity.
- Returns:
The current arm velocity.
- getVelocityDps() degrees_per_second ¶
- hasHitLowerLimit() bool ¶
Returns whether the arm has hit the lower limit.
- Returns:
Whether the arm has hit the lower limit.
- hasHitUpperLimit() bool ¶
Returns whether the arm has hit the upper limit.
- Returns:
Whether the arm has hit the upper limit.
- setInputVoltage(voltage: volts) None ¶
Sets the input voltage for the arm.
- Parameters:
voltage – The input voltage.
- wouldHitLowerLimit(armAngle: radians) bool ¶
Returns whether the arm would hit the lower limit.
- Parameters:
armAngle – The arm height.
- Returns:
Whether the arm would hit the lower limit.
- wouldHitUpperLimit(armAngle: radians) bool ¶
Returns whether the arm would hit the upper limit.
- Parameters:
armAngle – The arm height.
- Returns:
Whether the arm would hit the upper limit.