Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Development] Add convert glb to usd objects. Issac Lab repo installation required. #2113

Open
wants to merge 55 commits into
base: isaac_sim_dev
Choose a base branch
from

Conversation

danieltmeta
Copy link
Contributor

@danieltmeta danieltmeta commented Dec 3, 2024

Motivation and Context

This PR adds Issac Lab file type conversion capability. Issac lab will convert files into .usda.

How Has This Been Tested

Unit tests will be added to code function and the usda file output.

Types of changes

  • [Docs change] Addition or changes to the documentation
  • [Refactoring] Large changes to the code that improve its functionality or performance
  • [Dependency Upgrade] Upgrades one or several dependencies in habitat
  • [Bug Fix] (non-breaking change which fixes an issue)
  • [Development] A pull request that add new features to the habitat-lab task and environment codebase. Development Pull Requests must be small (less that 500 lines of code change), have unit testing, very extensive documentation and examples. These are typically new tasks, environments, sensors, etc... The review process for these Pull Request is longer because these changes will be maintained by our core team of developers, so make sure your changes are easy to understand!
  • [Experiment] A pull request that add new features to the habitat-baselines training codebase. Experiments Pull Requests can be any size, must have smoke/integration tests and be isolated from the rest of the code. Your code additions should not rely on other habitat-baselines code. This is to avoid dependencies between different parts of habitat-baselines. You must also include a README that will document how to use your new feature or trainer. You will be the maintainer of this code, if the code becomes stale or is not supported often enough, we will eventually remove it.

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 3, 2024
Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some good progress here! I left some comments.

My biggest request is to add a test file (the last comment in usd_conversion_scene.py).

Also, I see that pre-commit and python lint CI tests are failing (see below "Some checks are failing"). Try to get those passing. Have you installed pre-commit locally? See instructions.

Let me know when you've addressed my comments and I'll take another look!

habitat-lab/habitat/isaacsim/remote_content/converter.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/ssh_conversion.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/urdf_conversion.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/urdf_conversion.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/usd_conversion_scene.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/usd_conversion_scene.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/usd_conversion_scene.py Outdated Show resolved Hide resolved
local_download_folder = "/home/trandaniel/dev/IsaacSimConversion/usd_scene/"
glb_data_folder = "/home/trandaniel/dev/habitat-sim/data/hssd-hab/objects"

convert_scene_instance(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add test/test_isaac_sim.py to habitat-lab in this PR. Look at our other test files in that folder for reference. Let's have a test that tries to convert a toy habitat scene instance (this is something you suggested a while back). The test can assume the source assets are present on the machine (or maybe check for them and skip the test if they're missing). The test should inspect the output usda file and check for expected contents.

Copy link
Contributor Author

@danieltmeta danieltmeta Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrating unit tests and example data from PR #2123

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to delete PR #2123 after unit tests are reviewed.

Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments. A few top-level comments:

  • Let's add nice CLIs for both of these files. This means using argument-parsing and offering a friendly command-line interface.
  • You need to fill out the PR description. What's autopopulated there is a template for you to edit. This is an important part of documenting a code change.
  • As I requested earlier, let's add a minimal test file to this PR.

habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/urdf_to_usd.py Outdated Show resolved Hide resolved
habitat-lab/habitat/isaacsim/urdf_to_usd.py Show resolved Hide resolved
habitat-lab/habitat/isaacsim/scene_instance_json_to_usd.py Outdated Show resolved Hide resolved
@danieltmeta danieltmeta changed the title Add convert glb to usd objects. Issac Lab repo installation required. **\[Development\]** Add convert glb to usd objects. Issac Lab repo installation required. Jan 9, 2025
@danieltmeta danieltmeta changed the title **\[Development\]** Add convert glb to usd objects. Issac Lab repo installation required. [Development] Add convert glb to usd objects. Issac Lab repo installation required. Jan 9, 2025
@eundersander eundersander changed the base branch from main to isaac_sim_dev January 17, 2025 17:42
Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress here!

Please flesh out your PR description a bit. You don't have to explain what Isaac Sim is, but give some background for why we need these conversion utils. Mention that we convert scene instances including rigid objects (but not any included articulated objects or the stage yet). Mention the URDF conversion for converting robot URDF files. For Type of change, specify [Development].

Let's move meshColored inside data/usd_conversion_data so all the isaac-related test data is in one subfolder.

It looks like maybe you're not using test/data/usd_conversion_data/102343992.scene_instance.json for testing, so you can remove it from this PR.

I suspect you don't need to add test/data/usd_conversion_data/objects_EXAMPLE2/1efdc3d37dfab1eb9f99117bb84c59003d684811.glb to this repo, because it's a render GLB and it won't be used/loaded during the conversion (or am I missing something?). In general, we want to be really careful and selective about adding binary files to a git repo, since they are usually large.

@@ -0,0 +1 @@
24f1b688baf20921994b95e47f42b7ee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for?

@@ -0,0 +1,245 @@
"""This module converts urdf files into usda files."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the base for this PR to isaac_sim_dev instead of main. Sorry I didn't do this earlier. The reason for this is that our entire integration is experimental and so we don't want it in main yet.

Related to this, I chose habitat-lab/habitat/isaac_sim as the location. Can you move your scripts inside this folder? How about habitat-lab/habitat/isaac_sim/asset_conversion/urdf_to_usd.py and likewise for the other one.

habitat-lab/habitat/isaacsim/urdf_to_usd.py Show resolved Hide resolved
stage_before_metadata = Usd.Stage.Open(converted_clean_usda)
stage_output_metadata = Usd.Stage.Open(out_usd_filepath)

# Add the habitatVisual metadata to each relevant prim
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment looks wrong.

out_usd_filepath = urdf_dir + "hab_spot_arm_with_hab_metadata.usda"
project_root_folder = repo_dir

subprocess.run(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your test shouldn't run the script in a subprocess. Just import and run the required functionality directly.

convert_urdf(clean_urdf_filepath, output_usd)
# TODO: Issac sim drops a prim. "Warning: Prim not found for link: fl_uleg"

assert True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should do a real test here that checks something. At a minimum, check that the output file exists.

@@ -0,0 +1,18 @@
asset_path: /home/trandaniel/dev/habitat-lab/test/data/usd_conversion_data/hab_spot_arm_clean_CORRECT.urdf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed in this PR? It looks like debug output from the conversion process.

def test_clean_urdf():
urdf_dir = repo_dir + "/test/data/usd_conversion_data/"
input_file = urdf_dir + "hab_spot_arm_EXAMPLE.urdf"
output_file = urdf_dir + "hab_spot_arm_clean.urdf"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If hab_spot_arm_clean.urdf is generated by the test, then I guess hab_spot_arm_clean.urdf doesn't need to be included in this PR. It isn't a source file needed to run the test.

out_usd_path: str,
project_root_folder: str,
) -> None:
"""This converts an hssd object to a usda file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just bumping this comment. Let's not name HSSD in comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants