-
Notifications
You must be signed in to change notification settings - Fork 505
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: rearrange_v2 example app and other features/fixes for Feb 12 demo #1810
Conversation
8e91e59
to
29c3abc
Compare
* support for processing new client connections, including the "connection record" * changed client-ready message to instead be the connection record; see stub_client.html for reference * RemoteGuiInput logic to clear input history when client changes (i.e. disconnect/reconnect)"
…PEN_CLOSE feature flag
… for rearrange_v2; add ESC to AgnosticKeyNS; mypy/flake8 fixes
52a00fa
to
666bc0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments for reviewers.
@@ -450,15 +449,6 @@ def sim_update(self, dt): | |||
+ dt * self._hitl_config.viz_animation_speed | |||
) % 1.0 | |||
|
|||
# Navmesh visualization only works in the debug third-person view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of behavior tied to a keypress should be implemented in AppStates, not HitlDriver.
@@ -475,13 +465,6 @@ def sim_update(self, dt): | |||
for keyframe in keyframes: | |||
self._recording_keyframes.append(keyframe) | |||
|
|||
# Manually save recorded gfx-replay keyframes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like debug code. Removing it. It can be re-added to individual AppStates that need it.
@@ -10,6 +10,12 @@ | |||
import numpy as np | |||
|
|||
DIST_HIGHLIGHT: Final[float] = 0.15 | |||
COLOR_GRASPABLE: Final[mn.Color3] = mn.Color3(1, 0.75, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class was not being used at all in main
. I made some major changes to get it to work for rearrange_v2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice progress! I did a first pass and left some comments.
|
||
# physical key enum from USB HID Usage Tables | ||
# https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf, page 53 | ||
# add misisng keys here as necessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: misisng
) | ||
highlight_dict = {"t": [pos[0], pos[1], pos[2]], "r": radius} | ||
if billboard: | ||
highlight_dict["b"] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Billboarding could be driven by the server.
To be clear, I'm not suggesting any change here, the billboard
parameter makes it easy to replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest doing billboarding on the client. In general, I don't always expect the server to drive the camera.
|
||
def conv(channel): | ||
# sloppy: using int 0-255 to reduce serialized data size | ||
return int(channel * 255.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
def add_text( | ||
self, | ||
text_to_add, | ||
alignment: TextOnScreenAlignment = TextOnScreenAlignment.TOP_LEFT, | ||
text_delta_x: int = 0, | ||
text_delta_y: int = 0, | ||
): | ||
pass | ||
align_y, align_x = alignment.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated: I find TextOnScreenAlignment
being {y, x}
hard to follow. It's probably worth a comment, rename or swap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The text layout system needs a large refactor at some point.
self._app_service = gui_service | ||
self._gravity_dir = gravity_dir | ||
|
||
def _find_snap_pos(self, ray, query_obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type annotations would be useful on this one because the return type is non-trivial.
self._gui_agent_ctrl._humanoid_controller.obj_transform_base.translation | ||
) | ||
|
||
def _get_gui_agent_feet_height(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I would move this in GuiHumanoidController
.
) | ||
self._app_service.end_episode(do_reset=True) | ||
|
||
def _update_placement(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this to something along the lines of _update_held_object_placement()
.
|
||
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Why is this required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't add this, we see a lag between the camera movement and the snapped held object placement.
This is essentially part of a "post update" (after the underlying sim step). The sim step updates the agent pose. We update the camera from the updated agent pose, then we update the held object placement from the camera (since it uses a screen-relative raycast).
A gfx-replay keyframe is captured inside the sim step, but in this case we're manipulating the scene after the sim step.
self._app_service = gui_service | ||
self._gravity_dir = gravity_dir | ||
|
||
def _find_snap_pos(self, ray, query_obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this function to something like _try_snap_object_to_surface
to convey that this applies a translation.
def is_user_idle_this_frame(self): | ||
return not self._app_service.gui_input.get_any_key_down() | ||
|
||
def _update_for_remote_client_connect_and_idle(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be clearer to split this function into connection handling, idle timer handling and sps counter updating.
polish from PR feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think that this is a good starting point for rearrange_v2
.
class ClientHelper: | ||
""" | ||
Tracks connected remote clients. Displays client latency and kicks idle clients. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that we're grouping this functionality here.
Nit: the name ClientHelper
is vague in terms of what this class actually does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but I figure the functionality will grow.
…mo (#1810) * nicer instructions for installing Magnum on Mac * add MVP rearrange_v2 HITL app * add GuiPlacementHelper * add ClientHelper * changes to GuiPickHelper. * add config habitat_hitl.debug_line_width * changes to how connection_record/connection_params are handled * add config habitat_hitl.networking.wait_for_app_ready_signal * support for tracking client latency * add color and billboard-versus-up-facing options for highlight messages * minor bugfix to unity_dataset_processing.py * add hydra-core to requirements.txt
…mo (facebookresearch#1810) * nicer instructions for installing Magnum on Mac * add MVP rearrange_v2 HITL app * add GuiPlacementHelper * add ClientHelper * changes to GuiPickHelper. * add config habitat_hitl.debug_line_width * changes to how connection_record/connection_params are handled * add config habitat_hitl.networking.wait_for_app_ready_signal * support for tracking client latency * add color and billboard-versus-up-facing options for highlight messages * minor bugfix to unity_dataset_processing.py * add hydra-core to requirements.txt
…mo (facebookresearch#1810) * nicer instructions for installing Magnum on Mac * add MVP rearrange_v2 HITL app * add GuiPlacementHelper * add ClientHelper * changes to GuiPickHelper. * add config habitat_hitl.debug_line_width * changes to how connection_record/connection_params are handled * add config habitat_hitl.networking.wait_for_app_ready_signal * support for tracking client latency * add color and billboard-versus-up-facing options for highlight messages * minor bugfix to unity_dataset_processing.py * add hydra-core to requirements.txt
Motivation and Context
A big chunk of changes made in the last week leading up to our Feb 12/13 demo:
How Has This Been Tested
Some local testing with the various HITL apps.
Todo:
the VR clientUnity VR emulationTypes of changes
Checklist