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

Fixes issue where the indices were not created correctly. #1660

Conversation

AntoineRichard
Copy link
Contributor

Description

This PR fixes an issue in articulation object from omni.isaac.lab. The functions write_root_com_pose_to_sim and write_root_link_to_sim both result in an error where a variable is called before being assigned. I checked and there is a test for this, but I'm not sure why they don't catch it...

The two functions have been changed to match the behaviors of write_root_link_pose_to_sim and write_root_com_velocity_to_sim.

Fixes #1659

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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

@AntoineRichard
Copy link
Contributor Author

I'll update the test function for the articulation to catch this error. It's only checking when no indices are passed, and that's why it wasn't caught in the tests.

@jtigue-bdai
Copy link
Collaborator

I'll update the test function for the articulation to catch this error. It's only checking when no indices are passed, and that's why it wasn't caught in the tests.

Thanks for catching this.

@AntoineRichard AntoineRichard changed the title FIxed issue where the indices were not create correctly. FIxed issuea where the indices were not created correctly. Jan 10, 2025
@AntoineRichard AntoineRichard changed the title FIxed issuea where the indices were not created correctly. FIxed issue where the indices were not created correctly. Jan 10, 2025
@kellyguo11 kellyguo11 changed the title FIxed issue where the indices were not created correctly. Fixed issue where the indices were not created correctly. Jan 12, 2025
@kellyguo11
Copy link
Contributor

Thanks a lot for catching this and adding a fix for it! Look forward to the unit test addition, please add it to the same PR here.

…n to catch errors when indexes are passed but not assigned properly.
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.

LGTM! Thanks for the fix

@kellyguo11 kellyguo11 changed the title Fixed issue where the indices were not created correctly. Fixes issue where the indices were not created correctly. Jan 13, 2025
@@ -385,11 +385,14 @@ def write_root_com_pose_to_sim(self, root_pose: torch.Tensor, env_ids: Sequence[
env_ids: Environment indices. If None, then all indices are used.
"""
# resolve all indices
physx_env_ids = env_ids
if env_ids is None:
local_env_ids = slice(None)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is generating an unused variable warning, we should be able to remove this. Please also run the formatter ./isaaclab.sh -f to verify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha, yes sorry. It's fixed now.

@@ -399,7 +402,7 @@ def write_root_com_pose_to_sim(self, root_pose: torch.Tensor, env_ids: Sequence[
)

root_link_pose = torch.cat((root_link_pos, root_link_quat), dim=-1)
self.write_root_link_pose_to_sim(root_pose=root_link_pose, env_ids=env_ids)
self.write_root_link_pose_to_sim(root_pose=root_link_pose, env_ids=physx_env_ids)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@kellyguo11 but that variable is used here?

Copy link
Collaborator

@jtigue-bdai jtigue-bdai Jan 13, 2025

Choose a reason for hiding this comment

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

Nevermind I mis-read the line the previous comment was pointing to.

@kellyguo11 kellyguo11 merged commit a73b63c into isaac-sim:main Jan 14, 2025
3 of 4 checks passed
AntoineRichard added a commit to AntoineRichard/IsaacLab that referenced this pull request Jan 15, 2025
…1660)

# Description

This PR fixes an issue in articulation object from omni.isaac.lab. The
functions `write_root_com_pose_to_sim` and `write_root_link_to_sim` both
result in an error where a variable is called before being assigned. I
checked and there is a test for this, but I'm not sure why they don't
catch it...

The two functions have been changed to match the behaviors of
`write_root_link_pose_to_sim` and `write_root_com_velocity_to_sim`.



Fixes isaac-sim#1659 

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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

---------

Co-authored-by: Kelly Guo <kellyg@nvidia.com>
hapatel-bdai pushed a commit that referenced this pull request Jan 21, 2025
# Description

This PR fixes an issue in articulation object from omni.isaac.lab. The
functions `write_root_com_pose_to_sim` and `write_root_link_to_sim` both
result in an error where a variable is called before being assigned. I
checked and there is a test for this, but I'm not sure why they don't
catch it...

The two functions have been changed to match the behaviors of
`write_root_link_pose_to_sim` and `write_root_com_velocity_to_sim`.



Fixes #1659 

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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

---------

Co-authored-by: Kelly Guo <kellyg@nvidia.com>
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.

[Bug Report] local_variable referenced before assignment in IsaacLab's articulation wrapper
3 participants