dair_pll.system
System abstract type definition.
This file contains the fundamental System interface for dynamical
systems. Systems are defined by their underlying dynamics; integration
scheme; and an initial condition sampler for both states and hidden
states/carry.
Unlike Integrator, System requires a temporal sequence of initial
condition states; this is done to accommodate systems with hidden states that
behave differently when “preloaded” with an initialization trajectory,
such as a UKF estimator or an RNN.
System is used to interface with external simulators, e.g. Drake and MuJoCo.
- class dair_pll.system.MeshSummary(vertices=tensor([], dtype=torch.float32), faces=tensor([], dtype=torch.float32))[source]
Bases:
objectdataclasses.dataclass()for mesh visualization.-
vertices:
torch.Tensor= tensor([], dtype=torch.float32) Vertices in mesh,
(n_vert, 3).
-
faces:
torch.Tensor= tensor([], dtype=torch.float32) 3-tuple indices of vertices that form faces,
(n_face, 3).
-
vertices:
- class dair_pll.system.SystemSummary(scalars=<factory>, videos=<factory>, meshes=<factory>)[source]
Bases:
objectdataclasses.dataclass()for reporting information about the progress of a training run.-
scalars:
typing.Dict[str,float]
-
videos:
typing.Dict[str,typing.Tuple[numpy.ndarray,int]]
-
meshes:
typing.Dict[str,dair_pll.system.MeshSummary]
-
scalars:
- class dair_pll.system.System(space, integrator, max_batch_dim=None)[source]
-
Class for encapsulating a dynamical system.
Primarily implemented as a thin shell of
Integratorwith various sampling interfaces defined.A major difference from the
Integratorinterface is thatSystemaccepts a sequence of states, along with a singlecarry/hidden state, as an initial condition to accommodate proper initialization of some types of recurrent dynamics.Inits
Systemwith prescribed integration properties.- Parameters:
space (
StateSpace) – State space of underlying dynamicsintegrator (
Integrator) – Integrator of underlying dynamicsmax_batch_dim (
Optional[int]) – Maximum number of batch dimensions supported byintegrator. –
-
integrator:
dair_pll.integrator.Integrator
-
state_sampler:
dair_pll.state_space.StateSpaceSampler
-
carry_callback:
typing.Optional[typing.Callable[[],Tensor]]
-
max_batch_dim:
typing.Optional[int]
- simulate(x_0, carry_0, steps=1)[source]
Simulate forward in time from initial condition.
- Parameters:
- Return type:
- Returns:
(*, steps + 1, space.n_x)state trajectory(*, steps + 1, ?)hidden state trajectory
- set_carry_sampler(callback)[source]
Setter for hidden state initial condition sampler.
- Return type:
- preprocess_initial_condition(x_0, carry_0)[source]
Preprocesses initial condition state sequence into single state initial condition for integration.
For example, an RNN would use the state sequence to “preload” hidden states in the RNN, where
carry_0would provide an initial hidden state, and the output would be the hidden state after the RNN receives the state sequence.