core classes¶
System¶
- class autompc.System(observations, controls, dt=None)[source]¶
The System object defines a robot system, including the size of the control and observation dimensions and the labels for each control and observation variable.
- __init__(observations, controls, dt=None)[source]¶
- Parameters:
observations (List of strings) – Name of each observation dimension
controls (List of strings) – Name of each control dimension
dt (float) – Optional: Data time step for the system.
- property controls¶
Names of each control dimension
- property observations¶
Names of each observation dimension
- property ctrl_dim¶
Size of control dimensions
- property obs_dim¶
Size of observation dimensions
Trajectories¶
Trajectory¶
- class autompc.Trajectory(system, size, obs, ctrls)[source]¶
The Trajectory object represents a discrete-time state and control trajectory.
- __init__(system, size, obs, ctrls)[source]¶
- Parameters:
system (System) – The corresponding robot system
size (int) – Number of time steps in the trajectrory
obs (numpy array of shape (size, system.obs_dim)) – Observations at all timesteps
ctrls (numpy array of shape (size, system.ctrl_dim)) – Controls at all timesteps.
- property system¶
Get trajectory System object.
- property size¶
Number of time steps in trajectory
- property obs¶
Get trajectory observations as a numpy array of shape (size, self.system.obs_dim)
- property ctrls¶
Get trajectory controls as a numpy array of shape (size, self.system.ctrl_dim)
TimeStep¶
zeros¶
empty¶
extend¶
- autompc.extend(traj, obs, ctrls)[source]¶
Create a new trajectory which extends an existing trajectory by one or more timestep.
- Parameters:
traj (Trajectory) – Trajectory to extend
obs (numpy array of shape (N, system.obs_dim)) – New observations
ctrls (numpy array of shape (N, system.ctrl_dim)) – New controls
Pipeline¶
- class autompc.Pipeline(system, *components)[source]¶
The Pipeline class represents a collection of MPC components, including the model, controller, and cost function. A Pipeline can provide the joint configuration space over its constituent components, and can instantiate an MPC given a configuration.
- __init__(system, *components)[source]¶
- Parameters:
system (System) – Corresponding robot system
components (List of models, controllers, costs and corresponding factories.) – The set of components which make up the pipeline: the model, the controller, and the cost. For each of these components, you can either pass the factory or the instantiated version. For example, you must pass either a Controller or a ControllerFactory, but not both. If the factory is passed, than its hyperparameters will become part of the joint configuration space. If the instantiated version is passed, the component will be treated as fixed in the pipeline.
- __call__(cfg, task, trajs, model=None)[source]¶
Instantiate the MPC.
- Parameters:
cfg (Configuration) – Configuration from the joint pipeline ConfigurationSpace
task (Task) – Task which the MPC will solve
trajs (List of Trajectory) – System ID training set
model (Model) – A pre-trained model can be passed here which overrides the configuration. Default is None.
- Returns:
controller (Controller) – The MPC controller
task (Task) – The task with the instantiated cost
model (Model) – The instantiated and trained model