protomotions.envs package#
Tasks share BaseEnv and differ through configuration. Motion tracking,
steering and path following use control components, not separate environment
subclasses. Their experiment files wire controls to observation, reward,
termination and action functions.
BaseEnv#
protomotions.envs.base_env.env.BaseEnv receives an EnvConfig, a robot
config, device, terrain, simulator, scene library and motion library. The
training entry point constructs these dependencies; the environment initializes
the simulator. Scene and motion libraries can be empty.
The runtime interface is:
obs, info = env.reset()
obs, rewards, dones, terminated, extras = env.step(actions)
obs is a dictionary of named tensors. The agent converts it to a TensorDict
for the model. Actions have shape [num_envs, num_actions]. dones includes
episode timeouts; terminated identifies terminal states for value
bootstrapping. Call reset(env_ids) for environments whose episodes ended;
the agent owns this rollout/reset sequence. get_obs() returns the current
observations without stepping the simulation.
Component ownership#
control_componentsown mutable task state: reference poses, commands, goals and timers.observation_componentsmap context tensors to named model inputs.reward_componentsmap context tensors to reward terms.termination_componentsdefine training episode failure conditions.action_configmaps policy outputs to simulator commands.
Observations, rewards and terminations use MdpComponent to bind pure tensor
functions to EnvContext paths. Sensor estimates and clean simulator state
are separate sources; each binding selects which it needs. Do not add noise
inside a reward or observation function to duplicate sensor behavior.
Examples#
Task |
Stateful control |
Experiment |
|---|---|---|
Motion tracking |
|
|
Steering |
|
|
Path following |
|
|
See Configuration System for component bindings and config lifecycle, and Evaluation components for benchmark scoring and temporary environment snapshots. Evaluation failure criteria are configured separately from training terminations.