Skip to content

Add option to disable keyboard shortcuts in viewer#3032

Open
Shivam-Bhardwaj wants to merge 1 commit intogoogle-deepmind:mainfrom
Shivam-Bhardwaj:add-keyboard-disable-option
Open

Add option to disable keyboard shortcuts in viewer#3032
Shivam-Bhardwaj wants to merge 1 commit intogoogle-deepmind:mainfrom
Shivam-Bhardwaj:add-keyboard-disable-option

Conversation

@Shivam-Bhardwaj
Copy link

Summary

  • Add handle_keyboard parameter to launch() and launch_passive() functions
  • When set to False, built-in keyboard shortcuts (e.g., 'W' for wireframe, space for pause) are disabled
  • Useful for robot teleoperation where keyboard inputs should be handled by user code

Closes #2953

Changes

  • simulate/simulate.h: Add keyboard_ui flag
  • simulate/simulate.cc: Check flag before processing keyboard events
  • python/mujoco/simulate.cc: Expose keyboard_ui property in Python bindings
  • python/mujoco/viewer.py: Add handle_keyboard parameter to launch functions

Example usage

# Disable keyboard shortcuts for teleoperation
viewer = mujoco.viewer.launch_passive(
    model, data,
    handle_keyboard=False,  # Disable built-in shortcuts
    key_callback=my_teleop_callback  # Handle keys in user code
)

Test plan

  • Code follows existing patterns for ui0_enable/ui1_enable
  • Ran pyink and isort for style compliance
  • Manual testing with passive viewer (requires display)

Add handle_keyboard parameter to launch() and launch_passive() that
controls whether built-in keyboard shortcuts are processed. This is
useful for robot teleoperation scenarios where keyboard inputs should
be handled by user code instead of the viewer.

Closes google-deepmind#2953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to disable keyboard inputs to the Passive Viewer

1 participant