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

Adds a rigid body collection class #1288

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Dhoeller19
Copy link
Collaborator

@Dhoeller19 Dhoeller19 commented Oct 22, 2024

Description

Adds a rigid body collection class, which allows to spawn multiple objects in each environment and access/modify the quantities with a unified (env_ids, object_ids) API.

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

…bject_collection/rigid_object_collection.py

Signed-off-by: David Hoeller <[email protected]>
##

@property
def object_state_w(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to use the same convention as RigidObjects for these properties i.e. body_? Or do we want to change RigidObjects to reflect this convention? What are your thoughts?

Copy link
Collaborator Author

@Dhoeller19 Dhoeller19 Oct 23, 2024

Choose a reason for hiding this comment

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

This is a question I have been thinking a lot about when designing this.

The core difference between rigid objects, and object collections is that object collections can have rigid bodies that contain the same prim structure (for example when two rigid bodies come from the same USD). That is why something like body_names would not work in general as there would be duplicates in that case. To mark that subtle but important difference, I have introduced the concept of object_names which refer to the keys of the dict you create the config with (see code). This allows you to uniquely identify each rigid object in the collection and do proper indexing later on.

I thought to be consistent with that, I would rename all the occurrences of body with object.

But I am open for debate :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah OK I see what you mean. I think that is reasonable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's see what @Mayankm96 / @kellyguo11 say

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the distinction makes sense, maybe we just need to make the use cases of these classes clear in the docs so users understand the differences between the classes.

@PerFrivik
Copy link

Awesome, literally what we needed. Will test it, thank you!

Comment on lines +146 to +147
self._external_force_b[env_ids[:, None], object_ids] = 0.0
self._external_torque_b[env_ids[:, None], object_ids] = 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

this code will break if we don't have the exact same number of rigid objects as the defined num_envs of our interactive scene. Would recommend that we remove them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Where should we put them though?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure if we can. As env_ids assumes that we have num_envs instances but that may not be the case, we might have to leave that reset to the user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This argument also holds for Articulations and RigidObjects thought

Copy link
Collaborator

Choose a reason for hiding this comment

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

true that, but wasn't the idea that with the collection, we allow exactly an option that does not have to be repeated num_envs times?

@pascal-roth
Copy link
Collaborator

Is there a reason why there is a change in the naming convention? For the regular RigidObject and Articulation, we use root as an indicator (e.g., root_pos_w), and now all of this has been renamed to object (e.g., object_pos_w).

@Dhoeller19
Copy link
Collaborator Author

Is there a reason why there is a change in the naming convention? For the regular RigidObject and Articulation, we use root as an indicator (e.g., root_pos_w), and now all of this has been renamed to object (e.g., object_pos_w).

This is explained in the comment above

Copy link
Collaborator

Choose a reason for hiding this comment

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

This goes for both class and data files. Do we plan on implementing this before or after the root_link_state/root_com_state change? At some point it would be good to implement the velocity transformation here as well.

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

Successfully merging this pull request may close these issues.

5 participants