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

Unit test and parameter checks for scale randomization #1810

Open
wants to merge 6 commits into
base: feature/spawn-events
Choose a base branch
from

Conversation

hapatel-bdai
Copy link
Collaborator

Description

Added a unit test for the scale randomization feature and added some parameter checks based on comments from #1165

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have run the pre-commit checks 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

@hapatel-bdai hapatel-bdai added the enhancement New feature or request label Feb 7, 2025
@hapatel-bdai hapatel-bdai self-assigned this Feb 7, 2025
@hapatel-bdai hapatel-bdai changed the title Unit tests and parameter checks for scale randomization Unit test and parameter checks for scale randomization Feb 7, 2025
@@ -126,6 +143,10 @@ def randomize_scale(
# spawn single instance
prim_spec = Sdf.CreatePrimInLayer(stage.GetRootLayer(), prim_paths[env_id])

# check to make sure xformOp:scale attribute exists
if not prim_spec.GetAttributeAtPath(prim_paths[env_id] + ".xformOp:scale"):
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to comment in #1165, would it be more user friendly to create the scale attribute if one doesn't already exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was not able to add attributes to Sdf's like we do for Usd's. For example the https://openusd.org/dev/api/class_usd_geom_gprim.html#a7fd86a311b27d9b4fdd82736bb423056 does not exist for type Sdf (prim_spec)

@@ -63,6 +63,10 @@ def randomize_shape_color(env: ManagerBasedEnv, env_ids: torch.Tensor | None, as
# spawn single instance
prim_spec = Sdf.CreatePrimInLayer(stage.GetRootLayer(), prim_paths[env_id])

# check to make sure input:diffuseColor attribute exists
if not prim_spec.GetAttributeAtPath(prim_paths[env_id] + "/geometry/material/Shader.inputs:diffuseColor"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Left a comment in #1165 regarding whether we should create a material if one doesn't exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. We should just use replicator for this randomization. Gets complex to do it on our end.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you suggesting re-doing how the randomization is performed? Can we do this in a follow-up PR? Or do you have suggestions on how this would be done?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, @kellyguo11 any tips on how to create the material if it doesn't exist?

Copy link
Contributor

@Mayankm96 Mayankm96 left a comment

Choose a reason for hiding this comment

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

Thanks a ltof or the MR and the test!

Might make sense to also check that all assets in the scene are created successfuly. Sometimes PhysX might be erroring out which isn't desired.

Also you should add the failure case of replicate physics is not True and sim is playing so we can ensure we handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants