pypose.module.System¶
- class pypose.module.System[source]¶
The base class for a system dynamics model.
In most of the cases, users only need to subclass a specific dynamic system, such as linear time invariant system
LTI()
, Linear Time-VariantLTV()
, and a non-linear systemNLS()
.- forward(state, input)[source]¶
Defines the computation performed at every call that advances the system by one time step.
Note
The
forward
method implicitly increments the time step viaforward_hook
.state_transition
andobservation
still accept time for the flexiblity such as time-varying system. One can directly access the current system time via the propertysystime
or_t
.Note
To introduce noise in a model, redefine this method via subclassing. See example in
examples/module/ekf/tank_robot.py
.
- observation(state, input, t=None)[source]¶
- Parameters:
state (
Tensor
) – The state of the dynamical systeminput (
Tensor
) – The input to the dynamical systemt (
Tensor
) – The time step of the dynamical system. Default:None
.
- Returns:
The observation of the system at the current step
- Return type:
Tensor
Note
The users need to define this method and can access the current system time via the property
systime
. Don’t introduce system transision noise in this function, as it will be used for linearizing the system automaticalluy.
- set_refpoint(state=None, input=None, t=None)[source]¶
Function to set the reference point for linearization.
- Parameters:
state (
Tensor
) – The reference state of the dynamical system. IfNone
, the the most recent state is taken. Default:None
.input (
Tensor
) – The reference input to the dynamical system. IfNone
, the the most recent input is taken. Default:None
.t (
Tensor
) – The reference time step of the dynamical system. IfNone
, the the most recent timestamp is taken. Default:None
.
- Returns:
The
self
module.
Warning
For nonlinear systems, the users have to call this function before getting the linearized system.
- state_transition(state, input, t=None)[source]¶
- Parameters:
state (
Tensor
) – The state of the dynamical systeminput (
Tensor
) – The input to the dynamical systemt (
Tensor
) – The time step of the dynamical system. Default:None
.
- Returns:
The state of the system at next time step
- Return type:
Tensor
Note
The users need to define this method and can access the current time via the property
systime
. Don’t introduce system transision noise in this function, as it will be used for linearizing the system automaticalluy.
- property systime¶
System time, automatically advanced by
forward_hook
.