Skip to content

Learning

simulo.Task is the RL contract you subclass to train a policy; simulo.Scenario is the same build-then-step lifecycle without training, for a scene you script and watch instead. simulo.LearningEnv + simulo.RLTrainer train and evaluate a Task; simulo.RLPlayer plays one back. simulo.run drives a Scenario end to end. See Authoring for what build(scene) populates the scene with.

The six protocols your own code fulfils. Each is a mode-aware name — see the note on every page below — resolved lazily so importing your module never pulls in the GPU runtime.

  • simulo.Task — The RL task contract you subclass — observations, rewards, dones, actions, resets.
  • simulo.Scenario — Interactive sim lifecycle — build the scene, then step it (no training loop).
  • simulo.Policy — Callable observation → action policy.
  • simulo.Trainer — Training orchestration — train, evaluate, save, load.
  • simulo.LearningEnv — Gym-like vectorized environment — reset, step, close.
  • simulo.Player — Trained-policy playback — episodes, steps, optional video.

Tasks compose their observation/reward/termination spaces from small, reusable components. Each contract below is the shape one component fulfils.

ObservationSet, RewardSet, and TerminationSet are the containers a Task builds once — typically in on_start — from a list of the component contracts it composes: ObservationComponent, RewardComponent, and TerminationCondition respectively. Call initialize(robot, device, num_envs) once, then compute() / check() every step from get_observations() / get_rewards() / get_dones().

  • simulo.ObservationSet — Concatenates observations from a list of ObservationComponents into one tensor.
  • simulo.RewardSet — Sums weighted rewards from a list of RewardComponents into one tensor.
  • simulo.TerminationSet — Combines a list of TerminationConditions with OR logic — terminates if any condition is met.

The Contracts section documents contracts. This section documents what actually fulfils them at runtime. Simulation is the sim clock every mode shares — timestep, physics stepping, seeds, device placement. simulo.RLTrainer and simulo.RLPlayer are the Simulo-provided Trainer / Player you construct directly in a job body; the shape below is real, shipped train → evaluate → rollout usage, not a sketch:

env = simulo.LearningEnv(task=CartpoleTask(), num_envs=512, device="cuda")
trainer = simulo.RLTrainer(env=env, algorithm="PPO", device="cuda", seed=42)
trainer.train(max_iterations=20)
trainer.save(checkpoint_path)
trainer.export_policy(policy_path) # TorchScript, for RLPlayer / simulo.Policy.load
trainer.close()
player = simulo.RLPlayer(env=env, checkpoint=policy_path, device="cuda")
player.play(num_steps=200, record=simulo.RecordConfig(output_path=mcap_path))
player.close()

simulo.run(...) is the same idea for the interactive (non-learning) path: pass a Scenario subclass and it drives the whole build → step → shutdown loop for you. simulo.RecordConfig (used above via record=) configures the MCAP flight recording RLPlayer.play() writes.

  • simulo.Simulation — The simulation clock and lifecycle — timestep, physics stepping, seeds, device placement, reset/close.
  • simulo.RLTrainer — Reinforcement learning trainer (skrl PPO/IPPO/MAPPO/AMP) — the concrete class a job constructs to fulfil the Trainer contract.
  • simulo.RLPlayer — Runs a trained policy (skrl checkpoint or exported TorchScript/ONNX) without training — playback, video, and MCAP recording.
  • simulo.run — Run a Scenario subclass end to end — build the scene, then step it until max_steps or the window closes.
  • simulo.RecordConfig — Recording configuration passed to player.play(record=...) — an output path, plus a profile and per-stream include_* overrides.