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

Decouples rigid object and articulation asset classes #644

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

Conversation

Mayankm96
Copy link
Contributor

Description

Since we override a lot of the functions from RigidObject inside the Articulation class, we don't need to rely on inheritance anymore. Duplicacy in the code makes it easier to understand the two classes' functionalities without severely added overhead from the maintenance side. Moreover, conceptually, it can be motivated that the two are independent concepts.

This MR decouples the rigid object and articulation concepts in the framework.

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

@Mayankm96 Mayankm96 requested a review from Dhoeller19 July 4, 2024 13:16
@Mayankm96 Mayankm96 self-assigned this Jul 4, 2024
Base automatically changed from fix/articulation-body-view to main July 5, 2024 10:34
Comment on lines 49 to +51

torch.zeros(1, device=self.sim.device) # dummy tensor to initialize CUDA context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
torch.zeros(1, device=self.sim.device) # dummy tensor to initialize CUDA context

Copy link
Collaborator

@jtigue-bdai jtigue-bdai left a comment

Choose a reason for hiding this comment

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

Everything looks good. I just have a specific question about the num_instances property of the articulation

@@ -116,6 +116,10 @@ def is_fixed_base(self) -> bool:
"""Whether the articulation is a fixed-base or floating-base system."""
return self.root_physx_view.shared_metatype.fixed_base

@property
def num_instances(self) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need a doc string?

My interpretation of "num_instances" in this case is the number of replications of the articulation. Is this the correct interpretation? Can this be different than the number of environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For most learning setup, "num_instances" = "num_envs". At least that's the main underlying idea. However, for a single environment case, the view can be used to capture two instances of the same robot in that environment.

Scaling it to N environments with M same robots in each remains a discussion point because all the tensor shapes change in that case. We can think of adding it if we see a huge perf gain by doing so, i.e. one view capturing M robots vs. one view per robot.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That sounds reasonable. What about learning setups for multi-robot collaboration (i.e. two arm manipulation) do we set it up such that the two robots are viewed as one?

@jsmith-bdai jsmith-bdai mentioned this pull request Jul 9, 2024
6 tasks
from .articulation_data import ArticulationData

if TYPE_CHECKING:
from .articulation_cfg import ArticulationCfg


class Articulation(RigidObject):
class Articulation(AssetBase):
"""An articulation asset class.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you do a Ctrl-F for any instances of rigid + object and remove / update them? The docstring has some references to it being a subclass

@jsmith-bdai
Copy link
Collaborator

This seems like a big change, do you mind outlining the pros / cons of this approach?

It looks like we're not getting much benefit at first glance, but are now having a lot of repeated code that will be difficult to maintain

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.

None yet

4 participants