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 - Remote keyboard input redirection. #1853

Merged
merged 4 commits into from
Mar 11, 2024
Merged

Conversation

0mdc
Copy link
Contributor

@0mdc 0mdc commented Mar 11, 2024

Motivation and Context

This changeset enables remote keyboard input redirection.

It works by assigning RemoteGuiInput's internal GuiInput to the application GuiInput. Therefore, any key received from a client will update the state as if they were local.
Beware that RemoteGuiInput will be renamed to RemoteClientState: #1852

The following changes are applied:

  • Add keyboard redirection.
  • Move key mapping to its own file.
  • Remove AbstractKeyNS - only maintain a single keymap for local or remote (KeyCode enum).
  • Map Magnum keys to KeyCode.

How Has This Been Tested

Tested locally with a Unity client.

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 jturner65 and aclegg3 March 11, 2024 16:37
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 11, 2024
Copy link
Contributor Author

@0mdc 0mdc left a comment

Choose a reason for hiding this comment

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

Notes for reviewers.


# Stub version of Application.MouseEvent.Button
class StubMouseNS(metaclass=StubNSMeta):
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These class will go away in a later pass.

KeyNS = Application.KeyEvent.Key
MouseNS = Application.MouseEvent.Button
KeyNS = KeyCode
MouseNS = StubMouseNS
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These won't be needed anymore. They will be removed in a later pass.

assert isinstance(mouse_button, Application.MouseEvent.Button)
# if not do_agnostic_gui_input:
# assert isinstance(mouse_button, Application.MouseEvent.Button)
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mouse tracking will be added in a following PR.

interprocess_record: InterprocessRecord,
debug_line_render,
gui_input: GuiInput,
):
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 where the redirection happens. RemoteGuiInput used to create its own internal GuiInput - now it's passed as a dependency.

Copy link
Contributor

@aclegg3 aclegg3 left a comment

Choose a reason for hiding this comment

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

LGTM

@0mdc 0mdc merged commit 5ac0d55 into main Mar 11, 2024
4 checks passed
@0mdc 0mdc deleted the 0mdc/hitl_keyboard_redirection branch March 11, 2024 23:25
@0mdc 0mdc mentioned this pull request Jun 19, 2024
5 tasks
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Move key mapping to its own file. Simplify key handling.

* Pass GuiInput to RemoteGuiInput to enable remote control.

* Activate keyboard redirection. Add 'in' override to KeyCode.

* Add missing typing annotation.
HHYHRHY pushed a commit to SgtVincent/habitat-lab that referenced this pull request Aug 31, 2024
* Move key mapping to its own file. Simplify key handling.

* Pass GuiInput to RemoteGuiInput to enable remote control.

* Activate keyboard redirection. Add 'in' override to KeyCode.

* Add missing typing annotation.
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