class wpilib.simulation.LinearSystemSim_2_1_2(system: wpimath._controls._controls.system.LinearSystem_2_1_2, measurementStdDevs: List[float[2]] = [0.0, 0.0])

Bases: pybind11_builtins.pybind11_object

This class helps simulate linear systems. To use this class, do the following in the simulationPeriodic() method.

Call the SetInput() method with the inputs to your system (generally voltage). Call the Update() method to update the simulation. Set simulated sensor readings with the simulated positions in the GetOutput() method.

@tparam States The number of states of the system. @tparam Inputs The number of inputs to the system. @tparam Outputs The number of outputs of the system.

Creates a simulated generic linear system.

  • system – The system to simulate.

  • measurementStdDevs – The standard deviations of the measurements.

getCurrentDraw() amperes

Returns the current drawn by this simulated system. Override this method to add a custom current calculation.


The current drawn by this simulated mechanism.

getOutput(*args, **kwargs)

Overloaded function.

  1. getOutput(self: wpilib.simulation._simulation.LinearSystemSim_2_1_2) -> numpy.ndarray[numpy.float64[2, 1]]

Returns the current output of the plant.


The current output of the plant.

  1. getOutput(self: wpilib.simulation._simulation.LinearSystemSim_2_1_2, row: int) -> float

Returns an element of the current output of the plant.


row – The row to return.


An element of the current output of the plant.

setInput(*args, **kwargs)

Overloaded function.

  1. setInput(self: wpilib.simulation._simulation.LinearSystemSim_2_1_2, u: numpy.ndarray[numpy.float64[1, 1]]) -> None

Sets the system inputs (usually voltages).


u – The system inputs.

  1. setInput(self: wpilib.simulation._simulation.LinearSystemSim_2_1_2, row: int, value: float) -> None

setState(state: numpy.ndarray[numpy.float64[2, 1]]) None

Sets the system state.


state – The new state.

update(dt: seconds) None

Updates the simulation.


dt – The time between updates.