LinearSystemSim_2_1_1¶
- class wpilib.simulation.LinearSystemSim_2_1_1(system: wpimath._controls._controls.system.LinearSystem_2_1_1, measurementStdDevs: List[float[1]] = [0.0])¶
Bases:
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_2_1_1) -> numpy.ndarray[numpy.float64[1, 1]]
Returns the current output of the plant.
- Returns:
The current output of the plant.
getOutput(self: wpilib.simulation._simulation.LinearSystemSim_2_1_1, 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_2_1_1, 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_2_1_1, row: int, value: float) -> None
- setState(state: numpy.ndarray[numpy.float64[2, 1]]) None ¶
Sets the system state.
- Parameters:
state – The new state.
- update(dt: seconds) None ¶
Updates the simulation.
- Parameters:
dt – The time between updates.