Domain Randomization

This page only describes the current domain randomization status of registered tasks in the repo. All conclusions come from the code; nothing is inferred from design intent.

Manager-Based event terms are the only DR declaration path:

  • Manager-Based (Compatible) tasks: reset / interval randomization is declared through Hydra events: manager terms in the owner YAML; reset-lifecycle events sample at reset, interval-lifecycle events perturb between steps. See the events: block of src/unilab/conf/ppo/task/go2_joystick_flat/base.yaml for an example.

The Manager-Based lifecycle is:

  • construction path: fixed model/tool identity is attached to SceneCfg before backend construction

  • reset path: event terms compose writes in ResetStateTransaction; the transaction commits once through the backend-owned packed reset transaction (SimBackend.bind_packed_reset())

  • interval path: event terms submit backend-owned interval plans through the public contract

These three paths correspond to three lifecycle classes:

  • construction-lifecycle identity: fixed model/tool variants and their immutable env assignment take effect only during backend construction/materialization.

  • reset-lifecycle DR: items that do not change model identity, only change parameters or reset state within the same model, e.g. base_mass_delta, base_com_offset, gravity, kp, kd, and backend-declared geometry/model fields.

  • interval-lifecycle DR: external perturbations between steps, e.g. push.

Status Conclusions

  1. Reset/interval randomization consists of events: manager terms in the owner YAML, executed uniformly by the manager lifecycle.

  2. Manager-Based owners declare reset behavior through Hydra command/event terms. G1 motion reset perturbations belong to the device-resident MotionCommandCfg, while task owners add EventTermCfg reset and interval terms.

  3. TensorResetRandomizationPayload (the torch-first reset payload) expresses curated reset terms; a backend must advertise every requested term on the matching host/device plane and own its derived-quantity obligation.

  4. MotrixBackend currently supports base_mass_delta, base_com_offset, kp, kd, and interval push; and it requires all model actuators to be position actuators during initialization.

  5. Fixed mesh/tool identity is declared by env.fixed_model_variants; reset-time geometry fields remain behind backend capability declarations and never change that identity.

Uniformity Assessment Table

Task

Declaration path

Structured form?

reset form

interval form

Code

Go2JoystickFlat

Hydra events: terms

Yes: owner YAML declares reset events

root-state reset + pd_gains kp/kd

none

src/unilab/conf/ppo/task/go2_joystick_flat/base.yaml

G1WalkFlat

Hydra events: terms

Yes: Hydra EventTermCfg + Manager-Based reset terms

root-state reset + kp/kd via pd_gains

none

g1/manager_terms.py

G1MotionTracking

Hydra command term

Yes: Hydra device-resident MotionCommandCfg + Manager-Based command reset

motion frame, root pose/velocity, and joint-position sampling

none

motion_tracking/common/manager_terms.py

Per-task Domain Randomization List

Task

Currently implemented reset domain randomization

Currently implemented interval domain randomization

Default state

Go2JoystickFlat

base xy/yaw and base qvel via reset_root_state_uniform; command sampling; kp/kd via pd_gains

none

event terms declared and enabled by default in src/unilab/conf/ppo/task/go2_joystick_flat/base.yaml

G1WalkFlat

base xy/yaw and base qvel via reset_root_state_uniform; command sampling with a planar dead zone; gait_phase sampling; kp/kd randomization via pd_gains

none

kp/kd enabled on mujoco owners by default; disabled on motrix/mjwarp owners

G1MotionTracking

Motion-command frame sampling; root pose perturbation x/y/z/roll/pitch/yaw; root velocity perturbation x/y/z/roll/pitch/yaw; joint-position noise clipped through the public entity soft limits; action-manager state reset

none

pose_range, velocity_range, and joint_position_range have non-zero perturbations in the base owner

Current DR Capabilities and Boundaries

The owner YAML declares event terms; ResetStateTransaction composes selected rows and validates shapes; UniSim backends advertise and apply the curated payload. Task-specific reset sampling remains owned by command/event terms:

  • G1MotionTracking pose / velocity / joint noise is owned by its manager command.

  • Fixed model/tool identity is construction-time and never reset-time DR.

A requested backend capability that is not advertised fails closed; there is no filtering or silent fallback.

Reset gravity Usage

gravity is a reset-lifecycle DR: on each reset, a full MuJoCo gravity vector (gx, gy, gz) is sampled per selected environment and dispatched through TensorResetRandomizationPayload.gravity. Configure it with a reset EventTermCfg that calls randomize_physics_scene_gravity; unsupported backends fail closed. A small tilt range is recommended because large horizontal gravity can make an early task unlearnable.

Interval push Usage

Manager-Based tasks configure interval push through the env.events.push_robot term using push_by_setting_velocity with an interval and per-axis velocity ranges.

Fixed Model/Tool Variant Boundary

Manager-Based owners declare fixed variants on the environment config. The task owns names, source descriptors, and the final assignment; it does not compile a model:

env:
  fixed_model_variants:
    variants:
      - name: tool_a
        source_model_file: tools/tool_a.xml
      - name: tool_b
        source_model_file: tools/tool_b.xml
    # Omit explicit_variant_names for deterministic round-robin assignment.
    explicit_variant_names: [tool_a, tool_b]

The Manager factory turns the declaration into a read-only int32 assignment with shape (num_envs,); an empty explicit list selects round-robin. The assignment is task identity: it is fixed after backend construction and is not resampled by reset events.

UniLab does not open, parse, or compile source_model_file, and does not hold MjSpec, MjModel, mjbatch, or Warp objects. UniSim adapters own source realization and must declare supports_fixed_variants. Until that contract lands, a task configured with fixed variants fails closed before env construction. Heterogeneous variants that cannot expose one public state/action/sensor layout also fail closed.

Reset-time model-field DR stays inside the selected identity. Its canonical or per-env baselines come from the backend’s declared get_reset_term_default(term) contract; Manager terms do not recompile the scene or apply a canonical baseline to every tool. When only part of a model table is randomized, unwritten columns retain the selected environment’s variant baseline.

The ownership boundary and MJWarp/CPU executor split are recorded in ADR-0010.