DCMotorSim

class wpilib.simulation.DCMotorSim(*args, **kwargs)

Bases: wpilib.simulation._simulation.LinearSystemSim_2_1_2

Represents a simulated DC motor mechanism.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.DCMotorSim, plant: wpimath._controls._controls.system.LinearSystem_2_1_2, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, measurementStdDevs: List[float[2]] = [0.0, 0.0]) -> None

Creates a simulated DC motor mechanism.

Parameters
  • plant – The linear system representing the DC motor.

  • gearbox – The type of and number of motors in the DC motor gearbox.

  • gearing – The gearing of the DC motor (numbers greater than 1 represent reductions).

  • measurementStdDevs – The standard deviation of the measurement noise.

  1. __init__(self: wpilib.simulation._simulation.DCMotorSim, gearbox: wpimath._controls._controls.plant.DCMotor, gearing: float, moi: kilogram_square_meters, measurementStdDevs: List[float[2]] = [0.0, 0.0]) -> None

Creates a simulated DC motor mechanism.

Parameters
  • gearbox – The type of and number of motors in the DC motor gearbox.

  • gearing – The gearing of the DC motor (numbers greater than 1 represent reductions).

  • moi – The moment of inertia of the DC motor.

  • measurementStdDevs – The standard deviation of the measurement noise.

getAngularPosition() radians

Returns the DC motor position.

Returns

The DC motor position.

getAngularVelocity() radians_per_second

Returns the DC motor velocity.

Returns

The DC motor velocity.

getCurrentDraw() amperes

Returns the DC motor current draw.

Returns

The DC motor current draw.

setInputVoltage(voltage: volts) None

Sets the input voltage for the DC motor.

Parameters

voltage – The input voltage.