LinearSystemSim_1_1_1
- class wpilib.simulation.LinearSystemSim_1_1_1(system: wpimath._wpimath.LinearSystem_1_1_1, measurementStdDevs: Annotated[collections.abc.Sequence[SupportsFloat | SupportsIndex], 'FixedSize(1)'] = [0.0])
Bases:
pybind11_objectThis 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 Number of states of the system. @tparam Inputs Number of inputs to the system. @tparam Outputs 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.
- getInput(*args, **kwargs)
Overloaded function.
getInput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_1) -> typing.Annotated[numpy.typing.NDArray[numpy.float64], “[1, 1]”]
Returns the current input of the plant.
- Returns:
The current input of the plant.
getInput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_1, row: typing.SupportsInt | typing.SupportsIndex) -> float
Returns an element of the current input of the plant.
- Parameters:
row – The row to return.
- Returns:
An element of the current input of the plant.
- getOutput(*args, **kwargs)
Overloaded function.
getOutput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_1) -> typing.Annotated[numpy.typing.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_1_1_1, row: typing.SupportsInt | typing.SupportsIndex) -> 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_1, u: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, “[1, 1]”]) -> None
Sets the system inputs (usually voltages).
- Parameters:
u – The system inputs.
setInput(self: wpilib.simulation._simulation.LinearSystemSim_1_1_1, row: typing.SupportsInt | typing.SupportsIndex, value: typing.SupportsFloat | typing.SupportsIndex) -> None
Sets the system inputs.
- Parameters:
row – The row in the input matrix to set.
value – The value to set the row to.
- setState(state: Annotated[numpy.typing.ArrayLike, numpy.float64, '[1, 1]']) None
Sets the system state.
- Parameters:
state – The new state.
- update(dt: wpimath.units.seconds) None
Updates the simulation.
- Parameters:
dt – The time between updates.