diff --git a/README.md b/README.md index cd483a4..392cb3b 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ the amount of manual collection needed to produce datasets for policy training. - **Demonstration amplification** — Transform and recombine a small number of annotated demonstrations into larger, more diverse datasets. -- **Three generation algorithms** — Use MimicGen for single-arm tasks, DexMimicGen for coordinated multi-arm tasks, - or SkillGen for collision-aware, motion-planned transitions. +- **Generation algorithms** — Use MimicGen for single-arm tasks, DexMimicGen for coordinated multi-arm tasks, + SkillGen for collision-aware, motion-planned transitions, or SoftMimicGen for deformable-object manipulation. - **Parallel simulation** — Generate demonstrations across multiple Isaac Lab environments at once. - **Robot and task configuration** — Describe embodiments, tasks, subtasks, and generation policies in reusable YAML files. diff --git a/docs/README.md b/docs/README.md index 9f019cb..b35c37b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -31,6 +31,9 @@ make html SPHINXOPTS="-W --keep-going" xdg-open _build/current/html/index.html ``` +Run both commands from `docs/`. `make html` writes to `_build/current/html/`; +`_build/index.html` is only created by `make multi-docs` (see below). + For an existing docs environment, start at `cd docs` and `source venv_docs/bin/activate`, then run the build command above. `-W` makes warnings fail the build. To rebuild every page after changing the configuration, use `make html SPHINXOPTS="-E -a -W --keep-going"`. diff --git a/docs/images/franka_rope_annotation.png b/docs/images/franka_rope_annotation.png new file mode 100644 index 0000000..25697b3 --- /dev/null +++ b/docs/images/franka_rope_annotation.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b84976692d8d1a6fdf49ca5b0fc8047b4540ce28382987e6f8a897f3e38de20a +size 364585 diff --git a/docs/images/franka_rope_softmimicgen.png b/docs/images/franka_rope_softmimicgen.png new file mode 100644 index 0000000..4e14343 --- /dev/null +++ b/docs/images/franka_rope_softmimicgen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55929217ccb6569ce494131f835302bbb7cf9f93cd50b269a34333148db4d027 +size 313362 diff --git a/docs/images/franka_rope_softmimicgen_datagen.png b/docs/images/franka_rope_softmimicgen_datagen.png new file mode 100644 index 0000000..e00ac27 --- /dev/null +++ b/docs/images/franka_rope_softmimicgen_datagen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aaedb9bbceef88dddc19f1fa3812681d2a0c91f9b430e8cbd95189facc4b6a35 +size 499523 diff --git a/docs/images/franka_rope_softmimicgen_replay.gif b/docs/images/franka_rope_softmimicgen_replay.gif new file mode 100644 index 0000000..2b42119 --- /dev/null +++ b/docs/images/franka_rope_softmimicgen_replay.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cf9f3fa0df1fdfda5c30c8498751d1fff0a2667824ba117d72b6c7292c317a2 +size 3443911 diff --git a/docs/images/franka_rope_teleop.gif b/docs/images/franka_rope_teleop.gif new file mode 100644 index 0000000..ba936e9 --- /dev/null +++ b/docs/images/franka_rope_teleop.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0212fded4f8999b9a6f58486ecd0562691ef1b0de0b02cd06cdb941fbf574578 +size 4901577 diff --git a/docs/index.rst b/docs/index.rst index 853caf5..9fd6179 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -114,6 +114,7 @@ Table of Contents :caption: Example Workflows pages/workflows/franka_cube_stack_mimicgen/index + pages/workflows/franka_rope_softmimicgen/index pages/workflows/humanoid_dexmimicgen/index pages/workflows/skillgen/index diff --git a/docs/pages/concepts/algorithms.rst b/docs/pages/concepts/algorithms.rst index 0502158..d78ded0 100644 --- a/docs/pages/concepts/algorithms.rst +++ b/docs/pages/concepts/algorithms.rst @@ -1,13 +1,13 @@ Generation Algorithms ===================== -AutoData ships three generation algorithms, selected with ``--alg`` on the CLI (the -task descriptor's ``algo`` field independently selects which per-subtask ``algo_params`` -schema the descriptor is parsed with — keep the two consistent). All three plug into the +The task descriptor's ``algo`` field selects the generation algorithm and its per-subtask +``algo_params`` schema. ``--alg`` is optional; when supplied, it must match the descriptor's +``algo``. The algorithms plug into the :doc:`data generator ` and share the same skeleton — split source demonstrations into subtask segments, select a segment per subtask, transform it to the current scene, execute, and keep successful demonstrations — and differ in how segments are bridged and how -multiple arms are handled. +reference objects and multiple arms are handled. .. list-table:: :widths: 18 14 18 50 @@ -29,6 +29,10 @@ multiple arms are handled. - 1 - Motion planning - cuRobo-planned, collision-free transit; requires start signals. + * - ``softmimicgen`` + - 1 or 2 + - Interpolation + - Thin-plate-spline warping for deformable objects. MimicGen -------- @@ -60,6 +64,27 @@ are selected, transformed, and executed per arm. Two mechanisms keep the arms co synchronize specific subtask pairs across arms at runtime (see :doc:`task_descriptors`). +SoftMimicGen +------------ + +SoftMimicGen (`Moghani et al., 2026 `_) adapts demonstrations +to deformable objects such as ropes, whose shape cannot be described by a rigid-object pose +alone. It fits a **thin-plate-spline (TPS)** transform between corresponding simulation-node +positions in the source and current object shapes, then warps the source end-effector +trajectory to match. End-effector orientations are also adapted by default +(``use_rotation_transform: true``). Subtask transitions use the same interpolation as MimicGen. + +Set ``algo: softmimicgen`` in the task descriptor; optionally pass ``--alg softmimicgen`` on +the CLI. For each deformable subtask, set ``algo_params.object_soft: true`` and provide an ``object_ref``. +Source annotations must include that object's simulation-node positions, and the source and +live objects must have matching node counts, topology, and node ordering: each array index +must refer to the same mesh node in both objects. Rigid-object subtasks retain +MimicGen's object-pose transform. The ``registration_cost`` selection strategy ranks source +shapes by their TPS fitting cost (see below). + +See the :doc:`Franka rope workflow <../workflows/franka_rope_softmimicgen/index>` for recording, +annotation, generation, and replay with Newton or PhysX. + SkillGen -------- @@ -75,6 +100,7 @@ abandoned and counted as a failure. See the :doc:`SkillGen workflow <../workflows/skillgen/index>` and :doc:`../advanced/motion_planners`. + Source Demonstration Selection Strategies ----------------------------------------- @@ -96,10 +122,14 @@ configured per subtask in the task descriptor (``selection_strategy`` / * - ``nearest_neighbor_robot_distance`` - Ranks demonstrations by how close their (object-frame-transformed) source end-effector pose lands to the current end-effector pose, then picks among the ``nn_k`` nearest. + * - ``registration_cost`` + - For deformable objects, ranks source shapes by TPS fitting cost and picks randomly among + the ``nn_k`` lowest-cost valid candidates. The nearest-neighbor strategies trade diversity for reliability: segments recorded under similar geometry transform with less distortion, raising the success rate, while ``nn_k`` -keeps some randomness so the output does not collapse onto a single source demonstration. The shipped -examples use ``nearest_neighbor_object`` with ``nn_k: 3``. How often selection re-runs — per +keeps some randomness so the output does not collapse onto a single source demonstration. The +cube-stacking examples use ``nearest_neighbor_object`` with ``nn_k: 3`` while the SoftMimicGen rope +example uses ``registration_cost`` with ``nn_k: 3``. How often selection re-runs — per subtask, per arm, or once per episode — is set by the generation policy's ``select_src_per_subtask`` / ``select_src_per_arm`` flags. diff --git a/docs/pages/workflows/franka_rope_softmimicgen/index.rst b/docs/pages/workflows/franka_rope_softmimicgen/index.rst new file mode 100644 index 0000000..ce213d9 --- /dev/null +++ b/docs/pages/workflows/franka_rope_softmimicgen/index.rst @@ -0,0 +1,116 @@ +.. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Franka Rope Manipulation with SoftMimicGen +========================================== + +This example demonstrates the AutoData workflow using SoftMimicGen to generate a synthetic +dataset for a Franka robot manipulating a deformable rope. It covers recording source +demonstrations by teleoperation, annotating their subtask boundaries, generating a dataset, +and validating the result. + +The workflow supports **Newton** and **PhysX**. Use the tabs throughout the tutorial to +select a physics backend. The commands use separate dataset filenames for each backend. + +.. important:: + + Keep the physics backend consistent for recording, annotation, generation, and replay. + Use the source dataset that matches your selected backend. + +.. figure:: ../../../images/franka_rope_softmimicgen.png + :width: 100% + :align: center + :alt: Franka arm grasping a deformable rope on the table in the Kit viewer + + The Franka rope manipulation task. + + +Task Overview +------------- + +**Environment name:** ``Isaac-Rope-Franka-Arena-IK-Rel-v0`` + +**Task Description:** A Franka arm grasps a deformable rope on a table and manipulates it +until its two ends are close together. + +**Key Specifications:** + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + + * - Property + - Value + * - **Algorithm** + - SoftMimicGen (single end-effector in this example) + * - **Physics backends** + - Newton (``--presets newton``) or PhysX (``--presets physx``) + * - **Embodiment** + - Franka, relative IK task-space actions (7-D: delta position, axis-angle rotation, and gripper open/close) + * - **Task descriptor** + - :autodata_code_link:`` + * - **Embodiment config** + - :autodata_code_link:`` + * - **Subtasks** + - Approach and grasp the rope (``grasp``) → bring its ends together (``end of trajectory``) + * - **Newton source dataset** + - :autodata_code_link:`` + * - **PhysX source dataset** + - :autodata_code_link:`` + + +How SoftMimicGen Adapts Demonstrations +-------------------------------------- + +In the :doc:`cube-stacking workflow <../franka_cube_stack_mimicgen/index>`, MimicGen transforms +each source segment relative to a rigid object's pose. A rope can change shape, so its pose +alone does not describe the geometry the gripper needs to follow. + +SoftMimicGen uses the rope's **simulation-node positions** to compare the source and current +rope shapes. It selects a source demonstration using registration cost, then fits a +**thin-plate-spline (TPS)** transform to adapt the source end-effector trajectory to the new +shape. Annotation records the nodal positions needed for this transform along with the +subtask signals. The source data and live rope must have matching node counts, topology, +and **node ordering**: node ``i`` in the source must correspond to node ``i`` in the live rope. +AutoData records nodes in simulation order. Use the same rope asset and physics backend +throughout the workflow, and preserve that order when converting or preprocessing datasets. +The setup check verifies node counts but does not detect reordered nodes. + + +Workflow +-------- + +Follow the whole pipeline, or skip recording and annotation by using the backend-specific +pre-annotated source dataset described in :doc:`step_3_generate_dataset`. + +Prerequisites +^^^^^^^^^^^^^ + +Complete :doc:`../../quickstart/installation`, including downloading the Git LFS assets, and +start the dev container: + +:docker_run_default: + +Run the commands below from the repository root inside the container. Both backends use +``--device cuda``. A SpaceMouse is recommended for recording; a keyboard also works. + +The examples enable cameras to include the task's fixed-view and wrist RGB observations. +``--viz kit`` opens the simulation window; ``--viz none`` runs without it. Camera recording +is controlled separately by ``--enable_cameras``. + +Workflow Steps +^^^^^^^^^^^^^^ + +- :doc:`step_1_record_demonstrations` +- :doc:`step_2_annotate_demonstrations` +- :doc:`step_3_generate_dataset` +- :doc:`step_4_validate_dataset` + +.. toctree:: + :maxdepth: 1 + :hidden: + + step_1_record_demonstrations + step_2_annotate_demonstrations + step_3_generate_dataset + step_4_validate_dataset diff --git a/docs/pages/workflows/franka_rope_softmimicgen/step_1_record_demonstrations.rst b/docs/pages/workflows/franka_rope_softmimicgen/step_1_record_demonstrations.rst new file mode 100644 index 0000000..ac27459 --- /dev/null +++ b/docs/pages/workflows/franka_rope_softmimicgen/step_1_record_demonstrations.rst @@ -0,0 +1,135 @@ +.. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Step 1: Record Source Demonstrations +------------------------------------ + +Record a small set of successful rope-manipulation demonstrations as Isaac Lab HDF5 +datasets. Each episode includes the robot's actions, observations, and initial state, +including the rope's deformable state. + +.. note:: + + To skip recording and annotation, use the backend-specific pre-annotated source dataset + in :doc:`step_3_generate_dataset`. + + +Recording with a SpaceMouse (Recommended) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Set up the SpaceMouse on the host using the device setup instructions in +:doc:`../franka_cube_stack_mimicgen/step_1_record_demonstrations`, then start the dev container: + +:docker_run_default: + +Run the recording command for your backend: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python submodules/IsaacLab-Arena/submodules/IsaacLab/scripts/tools/record_demos.py \ + --task Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --external_callback autodata_examples.envs.register_environments \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --teleop_device spacemouse \ + --num_demos 3 \ + --no-reset_sim_buffer_each_episode \ + --dataset_file ./datasets/dataset_franka_rope_newton.hdf5 + + .. note:: + + Newton recording requires ``--no-reset_sim_buffer_each_episode``. Keep this flag + when using either a SpaceMouse or a keyboard. + + .. group-tab:: PhysX + + .. code-block:: bash + + python submodules/IsaacLab-Arena/submodules/IsaacLab/scripts/tools/record_demos.py \ + --task Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --external_callback autodata_examples.envs.register_environments \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --teleop_device spacemouse \ + --num_demos 3 \ + --dataset_file ./datasets/dataset_franka_rope_physx.hdf5 + +.. figure:: ../../../images/franka_rope_teleop.gif + :width: 90% + :align: center + :alt: Recorded source demonstration of the Franka grasping one rope end and moving it toward the other + + A source demonstration: approach the rope, grasp one end, and bring it toward the other. + +``--external_callback`` registers AutoData's Arena rope environment before Isaac Lab creates +it. Keep this option when recording or replaying with Isaac Lab's tools. + +The SpaceMouse controls are the same as in the cube-stacking workflow: + +.. list-table:: + :widths: 40 60 + :header-rows: 1 + + * - Input + - Action + * - Move the puck laterally / vertically + - Translate the end-effector + * - Tilt / twist the puck + - Rotate the end-effector + * - Left button + - Toggle gripper (open / close) + * - Right button + - Discard the current demonstration and reset + + +Performing the Demonstrations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Approach one end of the rope, close the gripper around it, then move it toward the other +end. Hold the ends close together until the recorder recognizes success. The recorder +exports successful demonstrations and exits automatically after three have been collected. + +Use smooth, direct motions and avoid extended pauses. Confirm that the rope stays in the +gripper as it moves. If a grasp slips or the rope falls off the table, discard the attempt +and reset. Record several demonstrations across the randomized starting rope shapes. + + +Recording with a Keyboard (Optional) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Replace ``--teleop_device spacemouse`` with ``--teleop_device keyboard`` in the command for +your backend. No additional device setup is required. + +Use the keyboard controls printed by the recorder: ``W/S``, ``A/D``, ``Q/E`` translate the +arm; ``Z/X``, ``T/G``, ``C/V`` rotate it; ``K`` toggles the gripper; and ``R`` discards the +current demonstration and resets. + + +Expected Output +^^^^^^^^^^^^^^^ + +Check that the recorded file contains the successful episodes: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/dataset_franka_rope_newton.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/dataset_franka_rope_physx.hdf5 + +Continue to :doc:`step_2_annotate_demonstrations`. diff --git a/docs/pages/workflows/franka_rope_softmimicgen/step_2_annotate_demonstrations.rst b/docs/pages/workflows/franka_rope_softmimicgen/step_2_annotate_demonstrations.rst new file mode 100644 index 0000000..0441458 --- /dev/null +++ b/docs/pages/workflows/franka_rope_softmimicgen/step_2_annotate_demonstrations.rst @@ -0,0 +1,161 @@ +.. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Step 2: Annotate Demonstrations +------------------------------- + +Annotation replays the recorded actions and adds data that SoftMimicGen needs: end-effector +poses, rope simulation-node positions, and the ``grasp`` subtask termination signal. +The second subtask, bringing the rope ends together, ends with the trajectory and needs +no explicit termination signal. + +Use the same physics backend that recorded the source dataset. The AutoData annotation +script registers the rope environment internally, so it does not need the external callback +used by Isaac Lab's recording tool. + + +Automatic Annotation (Recommended) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The rope environment publishes a ``grasp`` observation. With ``--auto``, annotation uses its +first rising edge as the boundary between grasping and manipulating the rope. + +Start the dev container, then run the command for your backend: + +:docker_run_default: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/annotate_demos.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --viz none \ + --device cuda \ + --enable_cameras \ + --auto \ + --no-reset_sim_buffer_each_episode \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/dataset_franka_rope_newton.hdf5 \ + --output_file ./datasets/dataset_franka_rope_newton_annotated.hdf5 + + .. note:: + + Use ``--no-reset_sim_buffer_each_episode`` when annotating Newton demonstrations. + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/annotate_demos.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --viz none \ + --device cuda \ + --enable_cameras \ + --auto \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/dataset_franka_rope_physx.hdf5 \ + --output_file ./datasets/dataset_franka_rope_physx_annotated.hdf5 + +The script exports only episodes that complete the task during replay and have a valid +``grasp`` boundary with enough steps left for the task descriptor's offset range. Skipped +episodes are reported in the console. To watch automatic annotation, use ``--viz kit``. + +Manual Annotation (Optional) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To mark the boundary yourself, omit ``--auto`` and use ``--viz kit``: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/annotate_demos.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --no-reset_sim_buffer_each_episode \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/dataset_franka_rope_newton.hdf5 \ + --output_file ./datasets/dataset_franka_rope_newton_annotated.hdf5 + + .. note:: + + Use ``--no-reset_sim_buffer_each_episode`` when annotating Newton demonstrations. + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/annotate_demos.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/dataset_franka_rope_physx.hdf5 \ + --output_file ./datasets/dataset_franka_rope_physx_annotated.hdf5 + +.. figure:: ../../../images/franka_rope_annotation.png + :width: 100% + :align: center + :alt: Three frames showing the approach, the grasp boundary to mark with S, and subsequent rope manipulation + + Mark ``grasp`` just after the gripper closes around the rope, before the manipulation motion begins. + +Each episode starts paused. Use these controls: + +.. list-table:: + :widths: 15 85 + :header-rows: 1 + + * - Key + - Action + * - ``N`` + - Begin / resume playback + * - ``B`` + - Pause playback + * - ``S`` + - Mark the ``grasp`` boundary at the current step + * - ``Q`` + - Skip the current episode + +Press ``S`` once per episode, just after the gripper has grasped the rope and before it +starts moving the rope toward the other end. Pause and resume as needed to place the mark. +Do not mark the end of the trajectory. Only fully annotated episodes that pass the replay +success check are exported. + + +Expected Output +^^^^^^^^^^^^^^^ + +Check the annotated dataset: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/dataset_franka_rope_newton_annotated.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/dataset_franka_rope_physx_annotated.hdf5 + +Continue to :doc:`step_3_generate_dataset`. diff --git a/docs/pages/workflows/franka_rope_softmimicgen/step_3_generate_dataset.rst b/docs/pages/workflows/franka_rope_softmimicgen/step_3_generate_dataset.rst new file mode 100644 index 0000000..d1664b6 --- /dev/null +++ b/docs/pages/workflows/franka_rope_softmimicgen/step_3_generate_dataset.rst @@ -0,0 +1,160 @@ +.. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Step 3: Generate the Dataset +---------------------------- + +SoftMimicGen generates new demonstrations by randomizing the rope's starting configuration, +selecting a source demonstration by nodal registration cost, and warping the source +end-effector trajectory to the current rope shape. It then executes the adapted trajectory +and evaluates task success. + +The commands below use the pre-annotated source datasets that ship with the repository. +Use the source dataset that matches your physics backend: + +.. tabs:: + + .. group-tab:: Newton + + :autodata_code_link:`` + + If you ran Steps 1–2, set ``--input_file`` to + ``./datasets/dataset_franka_rope_newton_annotated.hdf5`` instead. + + .. group-tab:: PhysX + + :autodata_code_link:`` + + If you ran Steps 1–2, set ``--input_file`` to + ``./datasets/dataset_franka_rope_physx_annotated.hdf5`` instead. + + +.. figure:: ../../../images/franka_rope_softmimicgen_datagen.png + :width: 90% + :align: center + :alt: Parallel environments generating data with SoftMimicGen + + Parallel environments generating data with SoftMimicGen. + + +Small-Scale Generation +^^^^^^^^^^^^^^^^^^^^^^ + +Start with two parallel environments in a Kit window to inspect the generated motions: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/generate_dataset.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --num_envs 2 \ + --alg softmimicgen \ + --generation_num_trials 5 \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/annotated_datasets/dataset_franka_rope_newton_annotated.hdf5 \ + --output_file ./datasets/generated_dataset_softmimicgen_franka_rope_newton_small.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/generate_dataset.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --num_envs 2 \ + --alg softmimicgen \ + --generation_num_trials 5 \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/annotated_datasets/dataset_franka_rope_physx_annotated.hdf5 \ + --output_file ./datasets/generated_dataset_softmimicgen_franka_rope_physx_small.hdf5 + + +Failed attempts are normal. The task descriptor sets ``guarantee_success: true`` +so generation retries until it reaches the target of 5 successful +demonstrations and exports only successes. The console reports progress and success rate. + + +Full-Scale Generation +^^^^^^^^^^^^^^^^^^^^^ + +After checking the small run, generate 100 successful demonstrations with 10 parallel +environments and run without the Kit window. Adjust ``--num_envs`` according to GPU memory +and observed throughput. Deformable simulation and camera recording can be expensive. + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/generate_dataset.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --viz none \ + --device cuda \ + --enable_cameras \ + --num_envs 10 \ + --alg softmimicgen \ + --generation_num_trials 100 \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/annotated_datasets/dataset_franka_rope_newton_annotated.hdf5 \ + --output_file ./datasets/generated_dataset_softmimicgen_franka_rope_newton.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/generate_dataset.py \ + --env_name Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --viz none \ + --device cuda \ + --enable_cameras \ + --num_envs 10 \ + --alg softmimicgen \ + --generation_num_trials 100 \ + --task_descriptor autodata_examples/tasks/franka_rope_softmimicgen.yaml \ + --embodiment autodata_examples/embodiments/franka_ik_rel.yaml \ + --input_file ./datasets/annotated_datasets/dataset_franka_rope_physx_annotated.hdf5 \ + --output_file ./datasets/generated_dataset_softmimicgen_franka_rope_physx.hdf5 + +To generate state-only datasets, omit ``--enable_cameras``. ``--viz none`` alone does not +disable image recording. + + +Key Parameters +^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + + * - Parameter + - Description + * - ``--presets`` + - Physics backend: ``newton`` or ``physx``. Match the source dataset's backend. + * - ``--alg`` + - Use ``softmimicgen`` for this deformable-object task. + * - ``--generation_num_trials`` + - Generation target. With this descriptor's ``guarantee_success: true``, counts successful demonstrations. + * - ``--num_envs`` + - Number of parallel simulation environments. + * - ``--enable_cameras`` + - Render and record the fixed-view and wrist RGB observations. + * - ``--viz`` + - ``kit`` opens the simulation window; ``none`` runs headless. + +Continue to :doc:`step_4_validate_dataset`. diff --git a/docs/pages/workflows/franka_rope_softmimicgen/step_4_validate_dataset.rst b/docs/pages/workflows/franka_rope_softmimicgen/step_4_validate_dataset.rst new file mode 100644 index 0000000..b526e1d --- /dev/null +++ b/docs/pages/workflows/franka_rope_softmimicgen/step_4_validate_dataset.rst @@ -0,0 +1,95 @@ +.. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Step 4: Validate the Generated Dataset +-------------------------------------- + +Structural Validation +^^^^^^^^^^^^^^^^^^^^^ + +Check the generated HDF5 file and summarize its contents: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/generated_dataset_softmimicgen_franka_rope_newton.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python scripts/validate_dataset.py ./datasets/generated_dataset_softmimicgen_franka_rope_physx.hdf5 + +If you only ran small-scale generation, use the corresponding ``_small.hdf5`` file instead. +The validator prints the episode count, environment metadata, and any structural issues. +It checks that every episode contains ``actions``, ``initial_state``, and ``obs`` with the +expected HDF5 types, and exits nonzero if a file is invalid. For unreadable or truncated +files, see :ref:`troubleshooting-hdf5`. + +Structural validation does not check rope geometry, grasp quality, or whether actions +reproduce the original outcome. Inspect the generated motions as well. + + +Visual Validation +^^^^^^^^^^^^^^^^^ + +Replay the generated episodes using Isaac Lab's replay tool. Select the backend used to +generate the dataset, and keep the Arena registration callback: + +.. tabs:: + + .. group-tab:: Newton + + .. code-block:: bash + + python submodules/IsaacLab-Arena/submodules/IsaacLab/scripts/tools/replay_demos.py \ + --task Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets newton \ + --external_callback autodata_examples.envs.register_environments \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --num_envs 1 \ + --dataset_file ./datasets/generated_dataset_softmimicgen_franka_rope_newton.hdf5 + + .. group-tab:: PhysX + + .. code-block:: bash + + python submodules/IsaacLab-Arena/submodules/IsaacLab/scripts/tools/replay_demos.py \ + --task Isaac-Rope-Franka-Arena-IK-Rel-v0 \ + --presets physx \ + --external_callback autodata_examples.envs.register_environments \ + --viz kit \ + --device cuda \ + --enable_cameras \ + --num_envs 1 \ + --dataset_file ./datasets/generated_dataset_softmimicgen_franka_rope_physx.hdf5 + +.. figure:: ../../../images/franka_rope_softmimicgen_replay.gif + :width: 90% + :align: center + :alt: Replaying a generated Franka demonstration + + Replay a generated demonstration to inspect the data. + +If you only ran small-scale generation, use the corresponding ``_small.hdf5`` file in the +replay command as well. Press ``B`` to pause replay and ``N`` to resume. + +Look for a firm grasp, smooth motion after the grasp boundary, and the rope ends coming +together while the rope remains on the table. Watch for slipping grasps, abrupt transitions, +or distorted rope geometry. If these occur repeatedly, inspect the source demonstrations +and their ``grasp`` annotations before increasing the generation target. Keep the source +and live rope assets consistent, including simulation-node ordering. Matching node counts +alone does not establish correspondence. + +.. note:: + + Action replay can diverge from the original simulation. In particular, PhysX replay + after a reset is not deterministically reproducible. A different replay outcome does + not by itself mean the saved demonstration failed during generation: with the supplied + descriptor, exported episodes passed the task's success condition when generated. + Keep the backend and simulation settings consistent when comparing replay outcomes.