LinearSystemSim_1_1_2¶
- class wpilib.simulation.LinearSystemSim_1_1_2(system: wpimath._controls._controls.system.LinearSystem_1_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.
- Parameters
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.
- Returns
The current drawn by this simulated mechanism.
- getOutput(*args, **kwargs)¶
Overloaded function.
getOutput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_2) -> numpy.ndarray[numpy.float64[2, 1]]
Returns the current output of the plant.
- Returns
The current output of the plant.
getOutput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_2, row: int) -> float
Returns an element of the current output of the plant.
- Parameters
row – The row to return.
- Returns
An element of the current output of the plant.
- setInput(*args, **kwargs)¶
Overloaded function.
setInput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_2, u: numpy.ndarray[numpy.float64[1, 1]]) -> None
Sets the system inputs (usually voltages).
- Parameters
u – The system inputs.
setInput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_2, row: int, value: float) -> None
- setState(state: numpy.ndarray[numpy.float64[1, 1]]) None ¶
Sets the system state.
- Parameters
state – The new state.
- update(dt: seconds) None ¶
Updates the simulation.
- Parameters
dt – The time between updates.