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 61 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 pull request (PR) introduces the capability to convert file types in Isaac Lab, specifically converting files into .usda format. These conversion utilities are essential for Isaac Sim physics simulations to process scene instance JSONs and object meshes from Habitat-Sim.

The PR includes the conversion of scene instances, encompassing rigid body objects. However, it does not currently support articulated objects or the stage. Future updates will address these limitations.

Additionally, a separate set of functions is required to convert robot URDF files into .usda format for use in Isaac Sim. This functionality will be implemented in a subsequent update.

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 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
@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.

test/data/usd_conversion_data/.asset_hash 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 Outdated Show resolved Hide resolved
test/test_isaac_sim.py Outdated Show resolved Hide resolved
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't run the conversion files as imports because assuming you run a unit test file, the other conversion files cannot use the Issac Lab USD library imported inside the unit test file. Instead, you have to run another instance of Applauncher on the conversion file.

An alternative to subprocess would be running the below, but at this point I don't know how to run the conversion file from Applauncher environment within the unit test file.

command = f"python script.py {arg1} {arg2}"
os.system(command)

test/test_isaac_sim.py Outdated Show resolved Hide resolved
test/data/usd_conversion_data/config.yaml Show resolved Hide resolved
test/test_isaac_sim.py Show resolved Hide resolved
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