Loads real2sim asset in locomanipulation SDG#4394
Loads real2sim asset in locomanipulation SDG#4394kellyguo11 merged 5 commits intoisaac-sim:developfrom
Conversation
Greptile SummaryThis PR adds support for loading USD background scenes in the locomanipulation SDG pipeline. It enables instantiating packing tables within background freespace and projecting initial robot/object states from input episodes into the environment. Key changes:
Critical Issues Found:
Confidence Score: 0/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Main
participant Env as G1LocomanipulationSDGEnv
participant Scene as setup_navigation_scene
participant Fixtures as SceneFixtures
participant Occupancy as OccupancyMap
participant PathPlanner as plan_path
participant StateProj as project_*_state_into_env
User->>Main: Run with --background_usd_path & --background_occupancy_yaml_file
Main->>Env: Create environment with cfg
Env->>Env: add_background_asset(background_usd_path)
Env->>Env: add_robot_pov_cam(height, width)
Env->>Env: _setup_background_mesh()
Note over Env: Hide mesh, enable collision
Main->>Scene: setup_navigation_scene(env, input_episode_data)
Scene->>Env: get_background_fixture()
Env-->>Scene: background_fixture with occupancy_map
alt Background exists
Scene->>Occupancy: Get background occupancy map
Scene->>Fixtures: Randomize start, end, obstacles in freespace
loop For each fixture
Fixtures->>Fixtures: place_randomly()
Fixtures->>Scene: sync_simulation_state()
Scene->>Occupancy: merge_occupancy_maps()
end
else No background
Scene->>Occupancy: Create empty occupancy map
Scene->>Fixtures: Randomize end and obstacles only
end
Scene->>StateProj: project_robot_state_into_env()
StateProj->>Env: Transform and write robot pose/joints
Scene->>StateProj: project_object_state_into_env()
StateProj->>Env: Transform and write object pose
Scene->>PathPlanner: plan_path(start, end, occupancy_map)
PathPlanner-->>Scene: base_path (waypoints)
alt Path valid (>2 points)
Scene-->>Main: NavigationScene
Main->>Main: Execute state machine with navigation
else Path invalid
Scene-->>Main: None (failure)
Main->>Main: Retry with different demo
end
|
scripts/imitation_learning/locomanipulation_sdg/generate_data.py
Outdated
Show resolved
Hide resolved
scripts/imitation_learning/locomanipulation_sdg/generate_data.py
Outdated
Show resolved
Hide resolved
scripts/imitation_learning/locomanipulation_sdg/generate_data.py
Outdated
Show resolved
Hide resolved
scripts/imitation_learning/locomanipulation_sdg/generate_data.py
Outdated
Show resolved
Hide resolved
84b712f to
500a157
Compare
a401bac to
1f9b421
Compare
scripts/imitation_learning/locomanipulation_sdg/generate_data.py
Outdated
Show resolved
Hide resolved
| return torch.any( | ||
| torch.max(torch.norm(net_contact_forces[:, :, sensor_cfg.body_ids], dim=-1), dim=1)[0] > threshold, dim=1 | ||
| ) | ||
| ) No newline at end of file |
There was a problem hiding this comment.
please run the formatter with ./isaaclab.sh -f
1f9b421 to
e8b82f9
Compare
2ef7fc8 to
f3061a4
Compare
|
Hi @dengyuchenkit , Thanks for the PR! It looks great. Have you tested the existing G1 locomanipulation data generation to ensure that it still works with these added changes? Best, |
92544a6 to
df1709d
Compare
|
Hi @jaybdub , I tested the existing workflow and it works fine! |
37b4950 to
5cad2e1
Compare
| """Hide the mesh object under background/volume/mesh and enable collision.""" | ||
| stage = sim_utils.get_current_stage() | ||
|
|
||
| if "background" in self.scene.keys(): |
There was a problem hiding this comment.
It feels like this should already be set as a collision mesh in the background USD, rather than having code here to force it.
A background USD might or might not include a collision mesh, and if it does, it could be somewhere other than under /volume/mesh depending on how it was generated. We should take care with assumptions about the specific background USD that gets used here.
There was a problem hiding this comment.
I removed "forcing collision mesh" logic and harcoded /volume/mesh path from the code. The huggingface assets are updated to have collision mesh enabled.
I added in the document that, if using a custom USD file, it should include neural reconstruction for rendering and collision mesh for interactions. Is it accurate to say that?
5cad2e1 to
dffa9d9
Compare
6c936d2 to
9e1e621
Compare
|
This PR looks great to me and adds features that we need for IsaacLab 3.0
@kellyguo11 @gavrielstate Would it be possible for this PR to be merged before the 02/26 cutoff? I had an existing PR #4725 but encountered issues while rebasing, so was wondering if we can instead use this. |
| from isaaclab.envs import ManagerBasedRLEnv | ||
|
|
||
|
|
||
| def task_done_pick_place( |
There was a problem hiding this comment.
The changes to the termination here is significant and looks targeted towards the G1 locomanip env specifically.
The pickplace base env is shared with the GR1 for a variety of other tasks. Can we leave the existing termination and GR1 envs alone and create a separate termination event with these changes for the G1?
There was a problem hiding this comment.
sure, I separated the termination event for G1 in the latest patch. The changes don't affect GR1 tasks now.
There was a problem hiding this comment.
Actually, there are some reverting errors. Let me fix those
There was a problem hiding this comment.
Fixed the reverting errors.
| ) | ||
|
|
||
| success = DoneTerm(func=mdp.task_done_pick_place, params={"task_link_name": "right_hand_roll_link"}) | ||
| success = DoneTerm( |
There was a problem hiding this comment.
See comment in terminations.py. It would be good if we can leave this alone for the GR1 as there are a number of existing envs and datasets that are already published using the existing termination function.
1b2280a to
c343a20
Compare
Fix GPU support Locomanip SDG migrates to 3.0 quat convention Load real2sim asset in locomanipulation SDG Address comments Add demo_id arg in hdf5_to_mp4 script Fix initial state Add success check. Export successful episodes Format code migrate to sim6 remove collision mesh logic Add init_camera_view Clear occupancy map around robot start pose format code
c343a20 to
f1c330a
Compare
# Description This PR adds support to load a USD background in locomanipulation SDG pipeline. 1. Load NuRec asset in locomanipulation SDG script. 2. Instantiates the first table in the freespace of the background occupancy map. It resets robot/object position according to table position. It also writes the default state for robot/object state, so these states are correct when resetting scene due to termination. 3. Termination conditions: - Add a termination condition `object_too_far_from_robot`, to check if robot picks up the wheel. - Add success termination check on task completion, and write successful episodes. Use object relative pose to the table for success check. It was tested by: Generate locomanipulation SDG data with the hand_hold-endeavor-wormhole-2 dataset at: https://huggingface.co/datasets/nvidia/PhysicalAI-Robotics-NuRec/tree/main ./isaaclab.sh -p scripts/imitation_learning/locomanipulation_sdg/generate_data.py \ --device cpu \ --kit_args="--enable isaacsim.replicator.mobility_gen" \ --task="Isaac-G1-SteeringWheel-Locomanipulation" \ --dataset ./datasets/generated_dataset_g1_locomanip.hdf5 \ --num_runs 1 \ --lift_step 60 \ --navigate_step 130 \ --enable_pinocchio \ --output_file ./datasets/generated_dataset_g1_locomanipulation_sdg.hdf5 \ --enable_cameras \ --background_usd_path <PATH_TO_USD_ASSET>/stage.usdz \ --background_occupancy_yaml_file <PATH_TO_USD_ASSET>/occupancy_map.yaml ## Type of change - New feature (non-breaking change which adds functionality) ## Screenshots <img width="1903" height="1046" alt="locomanipulation_sdg_usd_background1" src="https://github.com/user-attachments/assets/facb450a-4f6a-4630-a6b6-4e9fa4388825" /> <img width="829" height="441" alt="locomanipulation_sdg_usd_background2" src="https://github.com/user-attachments/assets/b0da6711-f812-4be5-b783-67fd5fd6d741" /> ## Checklist - [ ] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task -->
Description
This PR adds support to load a USD background in locomanipulation SDG pipeline.
object_too_far_from_robot, to check if robot picks up the wheel.It was tested by:
Generate locomanipulation SDG data with the hand_hold-endeavor-wormhole-2 dataset at: https://huggingface.co/datasets/nvidia/PhysicalAI-Robotics-NuRec/tree/main
Type of change
Screenshots
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there