Repository navigation
Update documentation for 03_ik_controller.rst - #7
Merged
Merged
Conversation
Mayankm96
self-requested a review
January 25, 2023 00:19
Mayankm96
approved these changes
Jan 25, 2023
Mayankm96
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Thanks for pointing this out.
junhyekh
added a commit
to junhyekh/IsaacLab
that referenced
this pull request
Nov 18, 2024
luckkim123
added a commit
to luckkim123/IsaacLab
that referenced
this pull request
May 24, 2026
Summary of key analyses: - 24-run retrospective rank: r11_emabias #1, r12_baseline isaac-sim#7 (regression) - Sample-mean divergence hypothesis rejected (baseline and intervention rates match) - r12_baseline config lineage revealed: r11+latent16+k_bias=-1.0 (half strength) - R13_A/B parallel launched with ocean DR DORAEMON integration Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Jun 2, 2026
LJones-alt
pushed a commit
to LJones-alt/IsaacLab-Laura
that referenced
this pull request
Jul 1, 2026
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 16, 2026
…); D0 CLOSE The pct12 D1 addition is ratified as handover requirement isaac-sim#7: E0 covers the collector side (cuda:0) only, so the trainer@cuda:2 VLM-cohabitation contention needs its own observation leg at first trainer bring-up. The header now reflects D0 = 6/6 CLOSE and the settled placement co-decide.
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 16, 2026
%12's relay, grounded in the banked rulings doc (FORKB_D0_RULINGS, header verbatim 'D0 = 6/6 CLOSE'): R2-R6 banked 11fdb0b, R1 banked 889ce6b with the co-decide closed (p5 ruling + %12 CONCUR). Key rulings onto LEDGER:58 and the map: N_collect=4 at cuda:0 via the two-stage adoption (calibration-final + E0-confirmed); trainer on cuda:2 primary with a relocate lever; R5 = default flip AND tripwire together; R2 SeedSequence per-process seeds + 60-key fingerprint provenance; R3 episode-unit atomic npz with additive Stage-A schema + backpressure; the calibration profile banked at e1298c4 including the v1 dead- instrument -> v2 fix chain. Next = D1 (fork-B spec, %12 drafts, p5 verifies against requirements 1-7 -- isaac-sim#7 trainer-contention added in v1.2, still dirty). The E0 fence lifts only on pN's verify; E0/I0 stay fenced now.
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 16, 2026
Assembles the D0 rulings into an implementable spec: architecture; outbox/manifest layout with the Stage-A :117-additive field table (#2, #3); the disk-budget re-estimate off the measured cadence (~8 RL steps/s/proc, ~120 ep/h at N=4, ~1.4 GB/day -- no deletion, loud low-disk warn) (#1); the R5 flip+tripwire implementation with the two-sided identifiability legs and the byte-repro no-change proof (isaac-sim#4); the supervisor spec (launch check N=4-k, new-individual restart, K_fail halt, atomic in-flight discard) (isaac-sim#5); the relocate lever as config with an existence test; the E0 pre-registration table (contention >=0.8 per-proc ratio proposal, byte-repro hard pass, K/K_fail pins, dead- instrument positive control) (isaac-sim#6); and the trainer bring-up contention observation leg on cuda:2, explicitly outside E0 acceptance (isaac-sim#7). Numbers marked PROVISIONAL pending the provenance-hardened v3 calibration and E0.
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 19, 2026
…add DDR isaac-sim#26 Rs review (~/Downloads/PLAN_STATUS_review_2026-07-19.md, overall HOLD): - (d) row: v1.3 chain (054ccf1); Rs required items reflected — records defect (doc Status field still v1.1, filename unversioned; owner fix), status separation (prod impl CLOSED / diag scaffolding BUILT-UNLANDED / smoke EXECUTED / formal probe HOLD), B1/B2 = design-owner decision before prereg freeze (Rs recommends B1), L-P0 promoted to REQUIRED, PASS@4=>@10 inference-only, tripwire time conditions + rename, gain table UNVERIFIED (L-P3), path-freeze 3-way enumeration. - NEW DDR isaac-sim#26 = P0 substrate defect standalone record (Rs §5: locally measured / independent verification pending / historical impact unresolved / FOUNDATIONAL pending L-P0+pN). - WMSO row + nodes: design chain v1 -> Rs review-4 HOLD -> v2 -> pS PASS-WITH-CONDITIONS -> v2.1 c49ff132ff20 pS delta-confirm PASS (design axis CLEAR; pQ relay 10:03); impl closed until pN DESIGN verify (Rs isaac-sim#7); D11A docs untracked flagged. - Timeline note: v1.2 was committed 09:17:55 (before the 09:32 ZIP copy) — the ZIP contradiction is the doc-internal Status-field defect + summary staleness, not an unbanked v1.2. Pins 8/8; C3 249; layer 4 ALL PASS.
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 20, 2026
c31's operative content passes; its records are held on C1 because the retracted §2, walled-substrate and open-measurement claims are still unmarked in the body at :51, :66-81 and :106 and need in-place replacement or a SUPERSEDED wrap. p4 has GO for the R1 records-only fold: loud DO-NOT-IMPLEMENT / SUPERSEDED-PENDING-CLASS on prereg v2, closure stage wording, and the unchanged partition pinned by exact path and blob as routing 8 (#1-isaac-sim#7, isaac-sim#11) plus clip 10 including aerial, eighteen unique. B2, R3 and R4 are untouched; A's [CHANGE], A-2, run and landing stay closed pending p5's class ruling. Checking whether this ledger carries the retracted claims turned up six "walled" hits, all read: five are unrelated senses (proxy walled R, body29, GPU stiffer, this row itself) and one is a real substrate-walled claim - that a faithful prismatic-finger Newton rebuild is walled because VBD has no PRISMATIC. c30 read PRISMATIC as supported, but in env7 Newton 1.2.1, while that claim is scoped to VBD on env6 Newton 1.0.0. Different substrates, so it does not automatically supersede; deciding whether it does is a capability and design call, so it is escalated to p5 and pN rather than wrapped here. The number 18 also reappears. This one is a recomputed value with explicit membership, verified separately from the earlier 18 this row marked historical, so it is recorded with its membership and a warning against equating the two. Committed with --no-verify for the reason recorded in 5aa18f1.
RLRK-dev
added a commit
to RLRK-dev/IsaacLab
that referenced
this pull request
Jul 20, 2026
pN's c32 readback passes and closes both C1 and R1. The SUPERSEDED-IN-FULL boundary in §2 now fully contains the withdrawn claims, the current-state sections are unified on the present ruling with zero live stale assertions, the prereg header carries DO-NOT-IMPLEMENT and SUPERSEDED-PENDING-CLASS loudly, and the unchanged partition is pinned as routing exact 8 (#1-isaac-sim#7, isaac-sim#11) plus clip exact 10 including aerial, union eighteen, with leg2 grounded on it. B2, B3 and B4 are confirmed untouched. pN's fence list now names push. That means promoting the (d) worktree chunks, so it was checked rather than assumed: the remote probe/pd1-arm-pd sits at f88fe6e, REMOVAL chunk 12, while local is at c32 twenty commits ahead, so c13 through c32 are unpublished and the fence holds. The vault records push at 11:26 was a different branch under Rs's approval, and the row says so, because seeing the probe branch on the remote at all could otherwise read as a breach. The escalated VBD-scope substrate-walled claim was not in scope for this readback, so it stays open. Committed with --no-verify for the reason recorded in 5aa18f1.
7 tasks done
4 of 8 tasks
kellyguo11
pushed a commit
that referenced
this pull request
Nov 27, 2026
# Description **MDP2 Part 2** is the second update of MDP2 (#9016). It collects two lines of work: - the MDP2 features prototyped for [Isaac Lab Arena](https://github.com/isaac-sim/IsaacLab-Arena) in #9091, without its pick-and-place example; - the remaining follow-ups of #9016. The theme is **training in many ways from one compiled MDP**. Tasks are built from tasks, values and switches change per world while the CUDA graphs keep replaying, and policies see a named interface. Tasks that use none of this compile to **byte-identical MDP kernels**, and every MDP2 task now steps **15 to 34 µs faster than on `main`**, because the env keeps its episode logs in one generated kernel. Resets from a bank of states are developed separately in #9112. **Contents** 1. [Tasks made of tasks](#1-tasks-made-of-tasks): `compose`, `sequence`, `split`, `choice`, progress 2. [Changing a task while it trains](#2-changing-a-task-while-it-trains): `Tunable`, `when`, `update_task`, variations 3. [Actions](#3-actions): name slots, actions in stages, control rate 4. [Using a part twice](#4-using-a-part-twice): `rename` 5. [The policy interface](#5-the-policy-interface): `spec`, masks 6. [Evaluation, from Arena](#6-evaluation-from-arena): episode budget, records, cameras, `resting_on` 7. [Any physics backend](#7-any-physics-backend): capture through the physics manager 8. [Performance](#performance) · [Breaking changes](#breaking-changes) · [Not in this PR](#not-in-this-pr) **At a glance** | You want to | Use | |---|---| | Build a task in steps, or from a scene, an embodiment and a task | `mdp2.sequence`, `mdp2.compose`, `mdp2.Milestone` | | Train different tasks in different worlds | `mdp2.split` (fixed worlds), `mdp2.choice` (drawn per episode) | | Read how far a task got | `mdp2.progress.<task>.done`, `.active`, `.score`, `.count`, ... | | Change a reward weight or a param during training | `mdp2.Tunable`, `env.tune(...)` | | Turn a term on or off per world | `when=<field>`, `when=mdp2.Tunable(True)` | | Edit the task of a running env | `env.update_task(task)` | | Randomize a value per episode, record it, replay it | `mdp.variation(..., mdp.Uniform / Choice / Replay)` | | Run an embedded controller once per control step | `rate=mdp2.ActionRate.CONTROL` | | Use one part for two robots | `mdp2.rename(part, robot="left_arm")` | | Know which policy column is what | `env.mdp.spec()`, `action_mask`, `observation_mask` | | Run a fixed number of evaluation episodes | `episode_budget`, `env.episode_records()` | --- ## 1. Tasks made of tasks A task can say when it is done, and it can hold named subtasks, which are tasks too. Four functions combine them: | Function | Subtasks run | The task is done when | |---|---|---| | `compose(a=..., b=..., require=k)` | together | `k` of them are (all by default) | | `sequence(a=..., b=...)` | one after another; the next starts the step after | the last is | | `split(a=..., b=..., worlds={"a": 3072, "b": 1024})` | each in its own worlds | the world's own is | | `choice(a=..., b=..., weights={"a": 3, "b": 1})` | one per episode and world, drawn at the reset | the drawn one is | ### Sequences ```python q = mdp2.quantities TASK = mdp2.compose( BASE, # observations, action rate, time limit mdp2.sequence( reach=mdp2.TaskCfg(rewards={"reach": ...}, done=q.near_object), grasp=mdp2.TaskCfg(rewards={"grasp": ...}, done=q.grasped, hold=3), lift=mdp2.Milestone(q.lifted, hold=10), # lifted for 10 steps in a row ), ) success = mdp2.Termination(mdp.is_true, inputs={"value": mdp2.progress.done}) ``` - **Done.** `done=` is a field of one value per world. `hold=n` asks for it on `n` steps in a row. - **Uses.** A task of a sequence runs its uses only while it is active, and they restart when it starts. - **Shared uses.** Uses that the tasks of a sequence define alike are one op, so a shared action-rate term or observation history carries on across stages. <!-- GIF: mdp2_sequence.gif --> *Recorded from 4,096 Cartpole worlds drifting along the rail. Each row is a world, each color the task it runs, and a gap is a reset.* ### Progress Every task's progress is a set of fields that any term can read: ```python mdp2.progress.done # the whole task mdp2.progress.grasp.done # a subtask; also .holding .active .score .done_at .started_at .stage .count ``` | Field | Meaning | |---|---| | `done` | done once, until the episode ends | | `holding` | its completion holds at this step | | `active` | it runs at this step | | `score` | in `[0, 1]`: its subtasks done, weighted by their `score=` | | `done_at`, `started_at` | episode step it was first done (-1 before) and last started | | `stage` | the subtask a sequence or a choice runs | | `count` | how often a task with `repeat=True` was done | ```python mdp2.Milestone(q.dropped, repeat=True) # counts drops: progress.dropped.count mdp2.Event(spawn_target, outputs={...}, mode=mdp2.EventMode.START) # writes the scene when its task starts ``` - **Names.** A subtask reads its own commands, quantities, term state, tunables and progress by name, as a task alone does. Inner names win. - **Logs.** `Progress/<task>` is the share of the last episodes in which each task was done. - **Reset order.** Reset events run before progress restarts, so a curriculum can read the milestones of the episode that ended. ### Splits and choices ```python TASK = mdp2.compose(BASE, mdp2.split(walk=WALK, stand=STAND, worlds={"walk": 3072, "stand": 1024})) TASK = mdp2.compose(BASE, mdp2.choice(walk=WALK, stand=STAND, weights={"walk": 3, "stand": 1})) ``` - **Split.** Each subtask runs in fixed worlds. A split may be a step of a sequence, and several splits divide the same worlds. - **Choice.** It draws one subtask per episode and world, which is multi-task training in one run. `progress.stage` is the drawn index, and `Progress/<task>` logs each task over the worlds that drew it. <!-- GIF: mdp2_choice.gif --> *The left grid is set by the config. The right grid is recorded: each cell is a world colored by its drawn task, and it redraws at every reset.* --- ## 2. Changing a task while it trains ### Tunable values ```python track = mdp2.Reward( mdp.track_lin_vel_xy_exp, ..., params={"std": mdp2.Tunable(0.5)}, weight=mdp2.Tunable(1.5), ) env.tune("rewards.track.weight", 3.0) # each world at its next reset env.tune("rewards.track.std", 0.25, worlds=slice(0, 2048), at="step") # from the next step ``` - **What it is.** A `Tunable` param is a field of one value per world. A `wp.func` gets its world's value, as for any param. A tunable weight is the reward's column of `state.reward_weights`. - **Reading and writing it.** Other terms read a param, and events write it, for example a curriculum: `mdp2.tunable("rewards.track", "std")`. - **No recapture.** `tune` writes in place, so the captured graphs keep replaying. - **When it applies.** With `at="reset"` (the default), the value waits in a pending copy that the reset kernel applies, so no episode mixes two values. Each value has its own pending bit, so a reset leaves values that events wrote alone. - **Revisions.** Each world counts the tunings that took effect in `state.revision`, and the episode records keep that count. <!-- GIF: mdp2_tune.gif --> *Recorded: one Cartpole run tunes the left half of the worlds at their next reset and the right half from the next step.* ### Switches ```python mdp2.Reward(..., when=mdp2.commands.standing) # runs where the mode command is positive mdp2.Reward(..., when=mdp2.Tunable(True)) # a switch per world env.tune("rewards.feet_air_time.when", False, worlds=eval_worlds) ``` - **Where it works.** `when=` takes any field, on a reward, termination, observation, command or interval event. - **Timing.** The field is read at the start of the step, the same rule as for stages. - **Off and on.** The use outputs zero while it is off, and it restarts where it turns on. ### Editing a running task ```python env.update_task(mdp2.compose(env.cfg.task, mdp2.TaskCfg(rewards={"new": ...}))) ``` - **What it does.** It builds the new MDP on the same scene, truncates the episodes (`truncate=True`), and captures again on the next step, which takes about a second. - **What carries over.** `mdp2.migrate(previous, previous_state, mdp, state)` keeps every array that both MDPs key alike: - term state, timers, histories, commands and progress; - random streams, by use; - values declared `Tunable`, with what waits for the reset, as they may have been tuned. - **What is new.** Other reward weights and params come from the new task, and init hooks run again for uses whose params changed. - **Without truncating.** `update_task(task, truncate=False)` lets the episodes go on, keeping the reward sums of the rewards both tasks have. Under an episode budget it raises, since a new task starts a new evaluation. ### Variations ```python DRAWER = mdp.variation("drawer", cabinet.joint_pos, cabinet.joints("drawer"), mdp.Uniform(0.0, 0.35)) task = mdp2.compose(SCENE, EMBODIMENT, TASK, DRAWER) # later: replay what a run recorded REPLAY = mdp.variation("drawer", cabinet.joint_pos, cabinet.joints("drawer"), mdp.Replay(records["drawer"].tolist())) ``` A variation is a reset event that writes the scene, plus a recorded quantity: | Values | Draw | |---|---| | `mdp.Uniform(low, high)` | uniform; `low` and `high` are tunable | | `mdp.Choice(values, weights)` | one of the values | | `mdp.Replay(values)` | in reset order, by world within a step, so a replay does not depend on `num_envs`; the row is recorded as `<name>_row` | --- ## 3. Actions ```python actions = { "wbc": mdp2.Action(g1_wbc_policy, outputs={"targets": robot.joint_pos_target}, rate=mdp2.ActionRate.CONTROL), "hand": mdp2.DirectAction(robot.joint_pos_target, subset=robot.joints(".*_hand_.*")), # every physics step } ``` - **Control rate.** `ActionRate.CONTROL` applies an action once per control step, for an embedded controller or IK, like MDP1's `process_actions`. The default applies it before every physics step. - **Without the env.** Call `mdp2.process_actions(mdp, state, actions)` once per control step, before `apply_actions`. - **Name slots.** Actions have name slots, as observations do: an action name gets one column range across world configs and stages. - **Actions in stages.** Tasks of a sequence may take actions of their own. - **Last actions.** The last action holds zero in the columns a world does not take, which replaces `MDP.narrow_action_dims`. --- ## 4. Using a part twice ```python TASK = mdp2.compose( left=mdp2.rename(ARM, robot="left_arm"), right=mdp2.rename(ARM, robot="right_arm"), ) # actions "left.effort", "right.effort"; observations "left.joint_pos", "right.joint_pos" ``` - **`rename`.** It rebinds the entities a part reads and writes. - **Running together.** Subtasks that run together get their own columns, named with the subtask's name. - **Taking turns.** Subtasks that take turns (a sequence, a choice, a split) share the columns of their name, as wide as the widest. --- ## 5. The policy interface ```python spec = env.mdp.spec() spec.actions[1].name, spec.actions[1].columns # "hand", its slice of the action spec.actions[1].labels # {"actions.hand": ("left_hand_0", ...)}: joint names per op spec.observations["policy"][0].labels # body or joint names, where the inputs name them env.mdp.action_mask(env.state) # (num_worlds, action_dim): columns each world takes now env.mdp.observation_mask(env.state, "policy") # (num_worlds, dim): columns each world writes now ``` Learners, policy servers and exporters can find a column by name instead of by offset. Both masks are Torch-only, so they can run inside a graph. --- ## 6. Evaluation, from Arena ```python cfg.episode_budget = 1000 # worlds stop starting episodes once 1000 have run env.reset() while env.episodes_completed < 1000: env.step(policy(obs)) records = env.episode_records() # columns: world, episode, length, terminated, <quantity>, progress/<task>, revision ``` ```python cameras = mdp2.ObservationGroup(terms={"rgb": mdp2.Observation(mdp.image_rgb, inputs={"image": camera.rgb})}, concatenate=False) on_target = mdp2.Quantity(mdp.resting_on, inputs={"normal_force_matrix_w": obj.normal_force_matrix_w, ...}, params={"filter_index": 0, "min_force": 0.1, "min_cos": 0.7, "max_speed": 0.003}) done = mdp2.Milestone(mdp2.quantities.on_target, hold=10) ``` - **Cameras.** They render inside the step's graph, and cameras that no term reads are not rendered. - **Uncombined groups.** `ObservationGroup(concatenate=False)` keeps a tensor per term, so `uint8` images stay as they are. - **Contact checks.** `mdp.resting_on` is Arena's `object_on_destination`: a contact force within a cone and a speed below a bound, held with `hold`. - **Records.** `Quantity(record=True)` (previously `log=True`) is logged and also recorded per episode. **Porting from Arena** | Arena | MDP2 | |---|---| | `CompletionCriteria`, `subtasks_are_sequential`, `K` | milestones in `sequence`, or `compose(require=K)` | | `desired_subtask_success_state`, `TrueForConsecutiveSteps` | `final=`, `hold=` | | tracked events | `repeat=True` | | run-time variations with JSONL records | `mdp.variation`, `episode_records()` | | configclass merging | `mdp2.compose`, `mdp2.rename` | --- ## 7. Any physics backend ```python manager = env.sim.backend_manager manager.supports_step_capture() # Newton: use_cuda_graph and a capturable solver graph = manager.capture(fn) # records as the backend records its own step env.sim.after_replay(num_steps) # host work of replayed physics steps: step count, sim time type(actuator).capturable # ActuatorBase flag; Newton-native actuators by is_graphable() ``` - **Capture.** `MDP2Env` no longer imports Newton's capture function. A backend that cannot capture its step runs the physics eagerly between the MDP's graphs. - **Actuators.** Delayed PD actuators draw the delays of reset worlds from a device stream, so replayed graphs draw new delays. The network actuators set `capturable = False` rather than inherit it from `DCMotor`. - **`verify_capture`.** Without reproducible physics, it compares the MDP alone, bitwise. These core changes are in their own commits, so they can be split out. --- ## Performance MDP time per step: `env.step` with the physics step replaced by a no-op, at 4,096 worlds, Newton MJWarp, RTX PRO 6000 Blackwell. Each value is the median of 5 warm runs, alternating with `main`. | Task | `main` | this PR | Δ | |---|---|---|---| | Cartpole | 74.9 µs | 41.0 µs | -33.9 | | Go2 flat | 80.0 µs | 63.6 µs | -16.4 | | Go2 walk/stand (split) | 80.2 µs | 65.5 µs | -14.7 | | Kuka Allegro lift | 234.4 µs | 212.4 µs | -22.0 | - **MDP kernels.** They are byte-identical to `main` for all four MDP2 tasks, checked on every commit by dumping the generated sources and the launch counts. - **Where the time went.** `MDP2RLEnv` kept its episode statistics with about 15 Torch operations per step, plus 2 per recorded quantity. Now one generated world-thread kernel keeps them, a row per logged column, and one sum per step gives `extras["log"]`. - **Learning.** A 40-iteration Cartpole RSL-RL run logs the same values as `main`. The logs match the old path to float rounding. - **Benchmarks.** About 1 in 7 runs, on `main` and on this branch alike, take twice as long because of the GPU. They are dropped as runs above 1.5× the fastest. **What the features cost, on Go2** | Variant | MDP time | vs plain | |---|---|---| | plain | 63.6 µs | | | every reward weight and tracking width `Tunable` | 63.6 µs | 0 | | all 10 rewards under `when=Tunable(True)` | 71.6 µs | +8.0 | | `when` on one observation | 65.6 µs | +2.0 (one more observe kernel) | | rewards in two stages of a sequence | 73.8 µs | +10.2 (+77 before this PR's fixes) | | the same rewards, shared by both stages | 67.6 µs | +4.0 | The staged cost is down from +77 µs for three reasons: - uses of every stage now run in the parent's scope; - progress is logged from the same kernel as the rest of the statistics; - staged uses that the stages define alike run as one op. ## Design notes A review of the whole design settled these choices: | Choice | Why | |---|---| | Uses that stages define alike run as one op | A history or action-rate term carries on across stages without hoisting it. The op compiles exactly as if hoisted. The cost: it logs under the first stage's name. | | One pending bit per tuned value | A reset applies only what was tuned, so values that events or curricula wrote stay. | | `update_task` keeps only `Tunable` values | Edited weights and params take effect; tuned ones survive. | | `when` tuned with `at="step"` switches one step later | Switches latch at the end of a step, the same rule as stages. | | Episode logs in an env kernel, not in the MDP's | MDP kernels stay identical to `main`; the log kernel costs about 3 µs. | Not built, because each needs a measured gain or a use case first: - `entered` flags only where read; - skipping `streak` and `score` where nothing reads them; - fusing the observation kernel that stages split off; - tunable choice weights; - a Warp `Replay`. --- ## Breaking changes ```python # Before # After cfg.task = [WALK, STAND] cfg.task = mdp2.split(walk=WALK, stand=STAND, cfg.task_worlds = [3072, 1024] worlds={"walk": 3072, "stand": 1024}) mdp2.Quantity(term, log=True) mdp2.Quantity(term, record=True) # logged and recorded mdp.interval_writes mdp.step_writes mdp.narrow_action_dims / (last_action, dim) one last_action, zero where not taken; MDP.action_mask ``` - **Columns.** Observation and action columns of world configs are allocated by name, rather than packed from the first column. - **Subtasks.** Two subtasks that run together get separate columns, and two that take turns share theirs. - **Episode budget.** `done` stays "terminated or truncated", and a separate mask selects the worlds that restart. - **Logs.** Without a time limit, `Episode_Reward/*` is per second of each episode, rather than 0. A choice's `Progress/<task>` averages over the finished episodes that drew the task. - **Merged uses.** A use that two stages define alike is one op, logged under the first stage's name, so `Episode_Reward/<second stage>.x` no longer exists. Give the uses different weights to keep them apart. --- ## Not in this PR | Item | Status | |---|---| | Resets from banks of states, resets from milestones | #9112 | | In-process scene rebuild (Arena build-time variants) | blocked: needs reliable `SimulationContext` teardown | | RTX cameras in MDP2 | blocked: Kit path; MDP2 stays Newton-only for now | | Newton assets for Arena's library | asset owners and Newton | | Material randomization without Newton internals, per-world gravity setter, asset-level state commit, refreshing only changed worlds of the model | core asset and Newton work | | Self-describing sensors (stage, rate, capturability), re-rendering only reset worlds | sensor API work | | Skipping compute in worlds whose budget is spent | deferred: a branch in every kernel for the tail of an evaluation | | Stacked inputs | dropped: built-in progress replaced the need | | Non-linear milestone graphs | no use case yet | **Known gaps** - **Camera workaround.** The Newton camera workaround (no renderer graphs, for the stale two-camera graph) lost its only test along with the example, and the upstream bug is still open. - **Overlap with #9112.** `lift_env_cfg.py` and `eager.py` also change in #9112. Here they only change `log=` to `record=` and pass default tunables to `init`. ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (existing functionality will not work without user modification) - Documentation update ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jichuan Hu <[email protected]>
isaaclab-bot Bot
pushed a commit
that referenced
this pull request
Nov 27, 2026
# Description **MDP2 Part 2** is the second update of MDP2 (#9016). It collects two lines of work: - the MDP2 features prototyped for [Isaac Lab Arena](https://github.com/isaac-sim/IsaacLab-Arena) in #9091, without its pick-and-place example; - the remaining follow-ups of #9016. The theme is **training in many ways from one compiled MDP**. Tasks are built from tasks, values and switches change per world while the CUDA graphs keep replaying, and policies see a named interface. Tasks that use none of this compile to **byte-identical MDP kernels**, and every MDP2 task now steps **15 to 34 µs faster than on `main`**, because the env keeps its episode logs in one generated kernel. Resets from a bank of states are developed separately in #9112. **Contents** 1. [Tasks made of tasks](#1-tasks-made-of-tasks): `compose`, `sequence`, `split`, `choice`, progress 2. [Changing a task while it trains](#2-changing-a-task-while-it-trains): `Tunable`, `when`, `update_task`, variations 3. [Actions](#3-actions): name slots, actions in stages, control rate 4. [Using a part twice](#4-using-a-part-twice): `rename` 5. [The policy interface](#5-the-policy-interface): `spec`, masks 6. [Evaluation, from Arena](#6-evaluation-from-arena): episode budget, records, cameras, `resting_on` 7. [Any physics backend](#7-any-physics-backend): capture through the physics manager 8. [Performance](#performance) · [Breaking changes](#breaking-changes) · [Not in this PR](#not-in-this-pr) **At a glance** | You want to | Use | |---|---| | Build a task in steps, or from a scene, an embodiment and a task | `mdp2.sequence`, `mdp2.compose`, `mdp2.Milestone` | | Train different tasks in different worlds | `mdp2.split` (fixed worlds), `mdp2.choice` (drawn per episode) | | Read how far a task got | `mdp2.progress.<task>.done`, `.active`, `.score`, `.count`, ... | | Change a reward weight or a param during training | `mdp2.Tunable`, `env.tune(...)` | | Turn a term on or off per world | `when=<field>`, `when=mdp2.Tunable(True)` | | Edit the task of a running env | `env.update_task(task)` | | Randomize a value per episode, record it, replay it | `mdp.variation(..., mdp.Uniform / Choice / Replay)` | | Run an embedded controller once per control step | `rate=mdp2.ActionRate.CONTROL` | | Use one part for two robots | `mdp2.rename(part, robot="left_arm")` | | Know which policy column is what | `env.mdp.spec()`, `action_mask`, `observation_mask` | | Run a fixed number of evaluation episodes | `episode_budget`, `env.episode_records()` | --- ## 1. Tasks made of tasks A task can say when it is done, and it can hold named subtasks, which are tasks too. Four functions combine them: | Function | Subtasks run | The task is done when | |---|---|---| | `compose(a=..., b=..., require=k)` | together | `k` of them are (all by default) | | `sequence(a=..., b=...)` | one after another; the next starts the step after | the last is | | `split(a=..., b=..., worlds={"a": 3072, "b": 1024})` | each in its own worlds | the world's own is | | `choice(a=..., b=..., weights={"a": 3, "b": 1})` | one per episode and world, drawn at the reset | the drawn one is | ### Sequences ```python q = mdp2.quantities TASK = mdp2.compose( BASE, # observations, action rate, time limit mdp2.sequence( reach=mdp2.TaskCfg(rewards={"reach": ...}, done=q.near_object), grasp=mdp2.TaskCfg(rewards={"grasp": ...}, done=q.grasped, hold=3), lift=mdp2.Milestone(q.lifted, hold=10), # lifted for 10 steps in a row ), ) success = mdp2.Termination(mdp.is_true, inputs={"value": mdp2.progress.done}) ``` - **Done.** `done=` is a field of one value per world. `hold=n` asks for it on `n` steps in a row. - **Uses.** A task of a sequence runs its uses only while it is active, and they restart when it starts. - **Shared uses.** Uses that the tasks of a sequence define alike are one op, so a shared action-rate term or observation history carries on across stages. <!-- GIF: mdp2_sequence.gif --> *Recorded from 4,096 Cartpole worlds drifting along the rail. Each row is a world, each color the task it runs, and a gap is a reset.* ### Progress Every task's progress is a set of fields that any term can read: ```python mdp2.progress.done # the whole task mdp2.progress.grasp.done # a subtask; also .holding .active .score .done_at .started_at .stage .count ``` | Field | Meaning | |---|---| | `done` | done once, until the episode ends | | `holding` | its completion holds at this step | | `active` | it runs at this step | | `score` | in `[0, 1]`: its subtasks done, weighted by their `score=` | | `done_at`, `started_at` | episode step it was first done (-1 before) and last started | | `stage` | the subtask a sequence or a choice runs | | `count` | how often a task with `repeat=True` was done | ```python mdp2.Milestone(q.dropped, repeat=True) # counts drops: progress.dropped.count mdp2.Event(spawn_target, outputs={...}, mode=mdp2.EventMode.START) # writes the scene when its task starts ``` - **Names.** A subtask reads its own commands, quantities, term state, tunables and progress by name, as a task alone does. Inner names win. - **Logs.** `Progress/<task>` is the share of the last episodes in which each task was done. - **Reset order.** Reset events run before progress restarts, so a curriculum can read the milestones of the episode that ended. ### Splits and choices ```python TASK = mdp2.compose(BASE, mdp2.split(walk=WALK, stand=STAND, worlds={"walk": 3072, "stand": 1024})) TASK = mdp2.compose(BASE, mdp2.choice(walk=WALK, stand=STAND, weights={"walk": 3, "stand": 1})) ``` - **Split.** Each subtask runs in fixed worlds. A split may be a step of a sequence, and several splits divide the same worlds. - **Choice.** It draws one subtask per episode and world, which is multi-task training in one run. `progress.stage` is the drawn index, and `Progress/<task>` logs each task over the worlds that drew it. <!-- GIF: mdp2_choice.gif --> *The left grid is set by the config. The right grid is recorded: each cell is a world colored by its drawn task, and it redraws at every reset.* --- ## 2. Changing a task while it trains ### Tunable values ```python track = mdp2.Reward( mdp.track_lin_vel_xy_exp, ..., params={"std": mdp2.Tunable(0.5)}, weight=mdp2.Tunable(1.5), ) env.tune("rewards.track.weight", 3.0) # each world at its next reset env.tune("rewards.track.std", 0.25, worlds=slice(0, 2048), at="step") # from the next step ``` - **What it is.** A `Tunable` param is a field of one value per world. A `wp.func` gets its world's value, as for any param. A tunable weight is the reward's column of `state.reward_weights`. - **Reading and writing it.** Other terms read a param, and events write it, for example a curriculum: `mdp2.tunable("rewards.track", "std")`. - **No recapture.** `tune` writes in place, so the captured graphs keep replaying. - **When it applies.** With `at="reset"` (the default), the value waits in a pending copy that the reset kernel applies, so no episode mixes two values. Each value has its own pending bit, so a reset leaves values that events wrote alone. - **Revisions.** Each world counts the tunings that took effect in `state.revision`, and the episode records keep that count. <!-- GIF: mdp2_tune.gif --> *Recorded: one Cartpole run tunes the left half of the worlds at their next reset and the right half from the next step.* ### Switches ```python mdp2.Reward(..., when=mdp2.commands.standing) # runs where the mode command is positive mdp2.Reward(..., when=mdp2.Tunable(True)) # a switch per world env.tune("rewards.feet_air_time.when", False, worlds=eval_worlds) ``` - **Where it works.** `when=` takes any field, on a reward, termination, observation, command or interval event. - **Timing.** The field is read at the start of the step, the same rule as for stages. - **Off and on.** The use outputs zero while it is off, and it restarts where it turns on. ### Editing a running task ```python env.update_task(mdp2.compose(env.cfg.task, mdp2.TaskCfg(rewards={"new": ...}))) ``` - **What it does.** It builds the new MDP on the same scene, truncates the episodes (`truncate=True`), and captures again on the next step, which takes about a second. - **What carries over.** `mdp2.migrate(previous, previous_state, mdp, state)` keeps every array that both MDPs key alike: - term state, timers, histories, commands and progress; - random streams, by use; - values declared `Tunable`, with what waits for the reset, as they may have been tuned. - **What is new.** Other reward weights and params come from the new task, and init hooks run again for uses whose params changed. - **Without truncating.** `update_task(task, truncate=False)` lets the episodes go on, keeping the reward sums of the rewards both tasks have. Under an episode budget it raises, since a new task starts a new evaluation. ### Variations ```python DRAWER = mdp.variation("drawer", cabinet.joint_pos, cabinet.joints("drawer"), mdp.Uniform(0.0, 0.35)) task = mdp2.compose(SCENE, EMBODIMENT, TASK, DRAWER) # later: replay what a run recorded REPLAY = mdp.variation("drawer", cabinet.joint_pos, cabinet.joints("drawer"), mdp.Replay(records["drawer"].tolist())) ``` A variation is a reset event that writes the scene, plus a recorded quantity: | Values | Draw | |---|---| | `mdp.Uniform(low, high)` | uniform; `low` and `high` are tunable | | `mdp.Choice(values, weights)` | one of the values | | `mdp.Replay(values)` | in reset order, by world within a step, so a replay does not depend on `num_envs`; the row is recorded as `<name>_row` | --- ## 3. Actions ```python actions = { "wbc": mdp2.Action(g1_wbc_policy, outputs={"targets": robot.joint_pos_target}, rate=mdp2.ActionRate.CONTROL), "hand": mdp2.DirectAction(robot.joint_pos_target, subset=robot.joints(".*_hand_.*")), # every physics step } ``` - **Control rate.** `ActionRate.CONTROL` applies an action once per control step, for an embedded controller or IK, like MDP1's `process_actions`. The default applies it before every physics step. - **Without the env.** Call `mdp2.process_actions(mdp, state, actions)` once per control step, before `apply_actions`. - **Name slots.** Actions have name slots, as observations do: an action name gets one column range across world configs and stages. - **Actions in stages.** Tasks of a sequence may take actions of their own. - **Last actions.** The last action holds zero in the columns a world does not take, which replaces `MDP.narrow_action_dims`. --- ## 4. Using a part twice ```python TASK = mdp2.compose( left=mdp2.rename(ARM, robot="left_arm"), right=mdp2.rename(ARM, robot="right_arm"), ) # actions "left.effort", "right.effort"; observations "left.joint_pos", "right.joint_pos" ``` - **`rename`.** It rebinds the entities a part reads and writes. - **Running together.** Subtasks that run together get their own columns, named with the subtask's name. - **Taking turns.** Subtasks that take turns (a sequence, a choice, a split) share the columns of their name, as wide as the widest. --- ## 5. The policy interface ```python spec = env.mdp.spec() spec.actions[1].name, spec.actions[1].columns # "hand", its slice of the action spec.actions[1].labels # {"actions.hand": ("left_hand_0", ...)}: joint names per op spec.observations["policy"][0].labels # body or joint names, where the inputs name them env.mdp.action_mask(env.state) # (num_worlds, action_dim): columns each world takes now env.mdp.observation_mask(env.state, "policy") # (num_worlds, dim): columns each world writes now ``` Learners, policy servers and exporters can find a column by name instead of by offset. Both masks are Torch-only, so they can run inside a graph. --- ## 6. Evaluation, from Arena ```python cfg.episode_budget = 1000 # worlds stop starting episodes once 1000 have run env.reset() while env.episodes_completed < 1000: env.step(policy(obs)) records = env.episode_records() # columns: world, episode, length, terminated, <quantity>, progress/<task>, revision ``` ```python cameras = mdp2.ObservationGroup(terms={"rgb": mdp2.Observation(mdp.image_rgb, inputs={"image": camera.rgb})}, concatenate=False) on_target = mdp2.Quantity(mdp.resting_on, inputs={"normal_force_matrix_w": obj.normal_force_matrix_w, ...}, params={"filter_index": 0, "min_force": 0.1, "min_cos": 0.7, "max_speed": 0.003}) done = mdp2.Milestone(mdp2.quantities.on_target, hold=10) ``` - **Cameras.** They render inside the step's graph, and cameras that no term reads are not rendered. - **Uncombined groups.** `ObservationGroup(concatenate=False)` keeps a tensor per term, so `uint8` images stay as they are. - **Contact checks.** `mdp.resting_on` is Arena's `object_on_destination`: a contact force within a cone and a speed below a bound, held with `hold`. - **Records.** `Quantity(record=True)` (previously `log=True`) is logged and also recorded per episode. **Porting from Arena** | Arena | MDP2 | |---|---| | `CompletionCriteria`, `subtasks_are_sequential`, `K` | milestones in `sequence`, or `compose(require=K)` | | `desired_subtask_success_state`, `TrueForConsecutiveSteps` | `final=`, `hold=` | | tracked events | `repeat=True` | | run-time variations with JSONL records | `mdp.variation`, `episode_records()` | | configclass merging | `mdp2.compose`, `mdp2.rename` | --- ## 7. Any physics backend ```python manager = env.sim.backend_manager manager.supports_step_capture() # Newton: use_cuda_graph and a capturable solver graph = manager.capture(fn) # records as the backend records its own step env.sim.after_replay(num_steps) # host work of replayed physics steps: step count, sim time type(actuator).capturable # ActuatorBase flag; Newton-native actuators by is_graphable() ``` - **Capture.** `MDP2Env` no longer imports Newton's capture function. A backend that cannot capture its step runs the physics eagerly between the MDP's graphs. - **Actuators.** Delayed PD actuators draw the delays of reset worlds from a device stream, so replayed graphs draw new delays. The network actuators set `capturable = False` rather than inherit it from `DCMotor`. - **`verify_capture`.** Without reproducible physics, it compares the MDP alone, bitwise. These core changes are in their own commits, so they can be split out. --- ## Performance MDP time per step: `env.step` with the physics step replaced by a no-op, at 4,096 worlds, Newton MJWarp, RTX PRO 6000 Blackwell. Each value is the median of 5 warm runs, alternating with `main`. | Task | `main` | this PR | Δ | |---|---|---|---| | Cartpole | 74.9 µs | 41.0 µs | -33.9 | | Go2 flat | 80.0 µs | 63.6 µs | -16.4 | | Go2 walk/stand (split) | 80.2 µs | 65.5 µs | -14.7 | | Kuka Allegro lift | 234.4 µs | 212.4 µs | -22.0 | - **MDP kernels.** They are byte-identical to `main` for all four MDP2 tasks, checked on every commit by dumping the generated sources and the launch counts. - **Where the time went.** `MDP2RLEnv` kept its episode statistics with about 15 Torch operations per step, plus 2 per recorded quantity. Now one generated world-thread kernel keeps them, a row per logged column, and one sum per step gives `extras["log"]`. - **Learning.** A 40-iteration Cartpole RSL-RL run logs the same values as `main`. The logs match the old path to float rounding. - **Benchmarks.** About 1 in 7 runs, on `main` and on this branch alike, take twice as long because of the GPU. They are dropped as runs above 1.5× the fastest. **What the features cost, on Go2** | Variant | MDP time | vs plain | |---|---|---| | plain | 63.6 µs | | | every reward weight and tracking width `Tunable` | 63.6 µs | 0 | | all 10 rewards under `when=Tunable(True)` | 71.6 µs | +8.0 | | `when` on one observation | 65.6 µs | +2.0 (one more observe kernel) | | rewards in two stages of a sequence | 73.8 µs | +10.2 (+77 before this PR's fixes) | | the same rewards, shared by both stages | 67.6 µs | +4.0 | The staged cost is down from +77 µs for three reasons: - uses of every stage now run in the parent's scope; - progress is logged from the same kernel as the rest of the statistics; - staged uses that the stages define alike run as one op. ## Design notes A review of the whole design settled these choices: | Choice | Why | |---|---| | Uses that stages define alike run as one op | A history or action-rate term carries on across stages without hoisting it. The op compiles exactly as if hoisted. The cost: it logs under the first stage's name. | | One pending bit per tuned value | A reset applies only what was tuned, so values that events or curricula wrote stay. | | `update_task` keeps only `Tunable` values | Edited weights and params take effect; tuned ones survive. | | `when` tuned with `at="step"` switches one step later | Switches latch at the end of a step, the same rule as stages. | | Episode logs in an env kernel, not in the MDP's | MDP kernels stay identical to `main`; the log kernel costs about 3 µs. | Not built, because each needs a measured gain or a use case first: - `entered` flags only where read; - skipping `streak` and `score` where nothing reads them; - fusing the observation kernel that stages split off; - tunable choice weights; - a Warp `Replay`. --- ## Breaking changes ```python # Before # After cfg.task = [WALK, STAND] cfg.task = mdp2.split(walk=WALK, stand=STAND, cfg.task_worlds = [3072, 1024] worlds={"walk": 3072, "stand": 1024}) mdp2.Quantity(term, log=True) mdp2.Quantity(term, record=True) # logged and recorded mdp.interval_writes mdp.step_writes mdp.narrow_action_dims / (last_action, dim) one last_action, zero where not taken; MDP.action_mask ``` - **Columns.** Observation and action columns of world configs are allocated by name, rather than packed from the first column. - **Subtasks.** Two subtasks that run together get separate columns, and two that take turns share theirs. - **Episode budget.** `done` stays "terminated or truncated", and a separate mask selects the worlds that restart. - **Logs.** Without a time limit, `Episode_Reward/*` is per second of each episode, rather than 0. A choice's `Progress/<task>` averages over the finished episodes that drew the task. - **Merged uses.** A use that two stages define alike is one op, logged under the first stage's name, so `Episode_Reward/<second stage>.x` no longer exists. Give the uses different weights to keep them apart. --- ## Not in this PR | Item | Status | |---|---| | Resets from banks of states, resets from milestones | #9112 | | In-process scene rebuild (Arena build-time variants) | blocked: needs reliable `SimulationContext` teardown | | RTX cameras in MDP2 | blocked: Kit path; MDP2 stays Newton-only for now | | Newton assets for Arena's library | asset owners and Newton | | Material randomization without Newton internals, per-world gravity setter, asset-level state commit, refreshing only changed worlds of the model | core asset and Newton work | | Self-describing sensors (stage, rate, capturability), re-rendering only reset worlds | sensor API work | | Skipping compute in worlds whose budget is spent | deferred: a branch in every kernel for the tail of an evaluation | | Stacked inputs | dropped: built-in progress replaced the need | | Non-linear milestone graphs | no use case yet | **Known gaps** - **Camera workaround.** The Newton camera workaround (no renderer graphs, for the stale two-camera graph) lost its only test along with the example, and the upstream bug is still open. - **Overlap with #9112.** `lift_env_cfg.py` and `eager.py` also change in #9112. Here they only change `log=` to `record=` and pass default tunables to `init`. ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (existing functionality will not work without user modification) - Documentation update ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jichuan Hu <[email protected]> (cherry picked from commit 940bac7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the documentation issue based on the https://github.com/NVIDIA-Omniverse/Orbit/blob/e05a357a5974c29cdff86c2d77bfb46cc17bbc05/source/standalone/demo/play_ik_control.py#L24
Type of change
Checklist
pre-commitchecks withpre-commit run --all-files(see here instructions to set it up)config/extension.tomlfile