Skip to content

Commit

Permalink
Add mock connection parameter config for testing purposes. (facebookr…
Browse files Browse the repository at this point in the history
  • Loading branch information
0mdc authored May 2, 2024
1 parent 5fb8974 commit 5b7d086
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
get_empty_keyframe,
update_consolidated_keyframe,
)
from habitat_hitl.core.hydra_utils import ConfigObject
from habitat_hitl.core.types import (
ClientState,
ConnectionRecord,
Expand Down Expand Up @@ -282,6 +283,21 @@ async def handle_connection(self, websocket: ClientConnection) -> None:
)
print("Client is ready!")
connection_record["connectionId"] = connection_id

# Copy test connection parameters from "mock_connection_params_dict".
if "mock_connection_params_dict" in self._networking_config:
mock_connection_params_dict = (
self._networking_config.mock_connection_params_dict
)
if mock_connection_params_dict is not None and isinstance(
mock_connection_params_dict, ConfigObject
):
for (
key,
value,
) in mock_connection_params_dict.__dict__.items():
connection_record[key] = value

self._interprocess_record.send_connection_record_to_main_thread(
connection_record
)
Expand Down
3 changes: 3 additions & 0 deletions habitat-hitl/habitat_hitl/config/hitl_defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ habitat_hitl:
# Optionally kick an idle client after n seconds.
client_max_idle_duration: ~

# Override incoming client connection parameters for testing purposes.
mock_connection_params_dict: None

client_sync:
# If enabled, the server main camera transform will be sent to the client. Disable if the client should control its own camera (e.g. VR), or if clients must use different camera transforms (e.g. multiplayer).
server_camera: True
Expand Down

0 comments on commit 5b7d086

Please sign in to comment.