diff --git a/habitat-hitl/habitat_hitl/core/remote_client_state.py b/habitat-hitl/habitat_hitl/core/remote_client_state.py index d32cdc9ee0..5809972bda 100644 --- a/habitat-hitl/habitat_hitl/core/remote_client_state.py +++ b/habitat-hitl/habitat_hitl/core/remote_client_state.py @@ -57,6 +57,8 @@ def __init__( self._client_state_history.append([]) self._receive_rate_trackers.append(AverageRateTracker(2.0)) + self._client_loading: List[bool] = [False] * users.max_user_count + # temp map VR button to key self._button_map = { 0: GuiInput.KeyNS.ZERO, @@ -81,6 +83,10 @@ def get_gui_inputs(self) -> List[GuiInput]: """Get a list of all GuiInputs indexed by user index.""" return self._gui_inputs + def is_user_loading(self, user_index: int) -> bool: + """Return true if the specified user's client is in a loading state.""" + return self._client_loading[user_index] + def bind_gui_input(self, gui_input: GuiInput, user_index: int) -> None: """ Bind the specified GuiInput to a specified user, allowing the associated remote client to control it. @@ -282,6 +288,11 @@ def _update_input_state( # frame and other ways that keyHeld, keyDown, and keyUp can be inconsistent. last_client_state = client_states[-1] + # Loading states. + self._client_loading[user_index] = last_client_state.get( + "isLoading", False + ) + input_json = ( last_client_state["input"] if "input" in last_client_state