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 - [Placeholder interface] Prevent placing objects when placement is impossible. #1882

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions examples/hitl/rearrange_v2/rearrange_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, app_service):
self._recent_reach_pos = None
self._paused = False
self._hide_gui_text = False
self._can_place_object = False

self._camera_helper = CameraHelper(
self._app_service.hitl_config,
Expand Down Expand Up @@ -212,14 +213,17 @@ def _update_grasping_and_set_act_hints(self, user_index):

# todo: implement grasping properly for each user. _held_obj_id, _has_grasp_preview, etc. must be tracked per user.
if self._held_obj_id is not None:
if self._get_user_key_down(user_index, GuiInput.KeyNS.SPACE):
if (
self._get_user_key_down(user_index, GuiInput.KeyNS.SPACE)
and self._can_place_object
):
if DO_HUMANOID_GRASP_OBJECTS:
# todo: better drop pos
drop_pos = self._get_gui_agent_translation(
user_index
) # self._gui_agent_controllers.get_base_translation()
else:
# GuiPlacementHelper has already placed this object, so nothing to do here
# GuiPlacementHelper has already placed this object.
pass
self._held_obj_id = None
else:
Expand Down Expand Up @@ -367,6 +371,9 @@ def _update_held_object_placement(self):
if self._placement_helper.update(ray, self._held_obj_id):
# sloppy: save another keyframe here since we just moved the held object
self.get_sim().gfx_replay_manager.save_keyframe()
self._can_place_object = True
else:
self._can_place_object = False

def sim_update(self, dt, post_sim_update_dict):
if (
Expand Down