Skip to content

Learning

simulo.Task is the RL contract you subclass to train a policy. simulo.LearningEnv and simulo.RLTrainer train a Task. 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.

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() every step; TerminationSet.check() returns the dict keyed by each condition’s optional name (or its class name). Call them 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 — Returns a named boolean-tensor dictionary for its TerminationConditions; an episode ends when any value is true.

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 is the Simulo-provided Trainer constructed in a training job body:

env = simulo.LearningEnv(task=CartpoleTask(), num_envs=512, device="cuda")
trainer = simulo.RLTrainer(env=env, algorithm="PPO", device="cuda", seed=42)
stats = trainer.train(max_iterations=20)
trainer.close()
env.close()

In a train job, Simulo saves the best and latest checkpoints for you, so the job body never calls save().

  • 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.preview — Check a task’s robot the way training will run it before training starts; returns a preview report and makes no policy.
  • simulo.evaluate — Run a trained policy on numbered episodes, judge each with the eval file’s @app.success function, and return the evaluation report.
  • simulo.RecordConfig — Recording configuration passed to player.play(record=...) — an output path, plus a profile and per-stream include_* overrides.