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

HITL - Synchronize UI with grasp manager. #1988

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Conversation

0mdc
Copy link
Contributor

@0mdc 0mdc commented Jun 20, 2024

Motivation and Context

The RearrangeGraspManager is used by agents to pick up objects or identify if an object is grabbed. Therefore, the objects grabbed in rearrange_v2 are not visible to the agents, while the objects grabbed by agents can be interacted by the UI.

This changeset changes the rearrange_v2 GUI such as the grabbed objects are synchronized with grasp managers.

Note:
A hacky flag is introduced in RearrangeGraspManager, _automatically_update_snapped_object, which toggles whether objects are automatically displaced. In HITL, we displace the objects ourselves to avoid occluding the view and communicate to the user that an object is grabbed (see #1908 for examples).
Ideally, the "grasped object" data should be separated from the object displacement item. However, this is a significant refactor. Let me know if you have ideas in the thread.

How Has This Been Tested

Tested on single-learn and multi-player evaluation.

Types of changes

  • [Development]

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.

@0mdc 0mdc requested review from aclegg3 and zephirefaith June 20, 2024 16:05
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jun 20, 2024
Copy link
Contributor

@zephirefaith zephirefaith left a comment

Choose a reason for hiding this comment

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

Left a few questions, otherwise looks good.
I am assuming these are tested through phase3 deployment already, so logic is OK.

Comment on lines +28 to +32
if TYPE_CHECKING:
from habitat.tasks.rearrange.rearrange_grasp_manager import (
RearrangeGraspManager,
)

Copy link
Contributor

Choose a reason for hiding this comment

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

OMG this is neat! I have run into so many circular imports for typing that I ended up removing in the past :o

Comment on lines +134 to +137
for agent_index in range(len(agents_mgr.agent_names)):
grasp_mgr = agents_mgr._all_agent_data[agent_index].grasp_mgr
if grasp_mgr._snapped_obj_id == object_id:
return True
Copy link
Contributor

Choose a reason for hiding this comment

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

This generally brings HitL + habitat-llm logic closer together ✔️

Comment on lines +220 to +221
if self._automatically_update_snapped_object:
self._snap_constraints = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious what is the use-case here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for dynamic simulations. The other code path is for kinematic simulations.

Comment on lines +309 to +310
or not self._automatically_update_snapped_object
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Then is automatically updating == this code handling the update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.

Because this class is the mechanism for communicating the grasping state of each agent, this short circuit allows for external code to handle the transform updates.

@0mdc 0mdc merged commit 4c73ed1 into main Jun 25, 2024
4 checks passed
@0mdc 0mdc deleted the 0mdc/hitl_sync_grasp_manager branch June 25, 2024 18:38
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jun 26, 2024
* Read grasp manager when querying whether an agent is carrying an object.

* Communicate grasped objects to grasp manager.
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Read grasp manager when querying whether an agent is carrying an object.

* Communicate grasped objects to grasp manager.
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Read grasp manager when querying whether an agent is carrying an object.

* Communicate grasped objects to grasp manager.
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