Repository navigation
Allow keyboard events to move sliders and click button controls. - #129
Merged
Merged
Conversation
RussTedrake
added a commit
to RussTedrake/drake
that referenced
this pull request
Sep 17, 2022
Depends on meshcat-dev/meshcat#129. This will enable, for instance, keyboard teleop through Meshcat. It will make the Deepnote teleop demos much more ergonomic.
rdeits
reviewed
Sep 18, 2022
rdeits
left a comment
Collaborator
There was a problem hiding this comment.
good idea, and good luck with the FIRST demo!
| // The default layout for dat.GUI buttons is broken, with the button name artificially truncated at the same width that slider names are truncated. We fix that here. | ||
| this.gui_controllers[name].domElement.parentElement.querySelector('.property-name').style.width="100%"; | ||
| if (keycode1 != undefined) { | ||
| let keydown_callback = {name: name, callback: eval(callback)}; |
Collaborator
There was a problem hiding this comment.
We're now evaling the callback twice on this code path and once above. Can you centralize that to remove the duplicate call (and in case we someday want to do something other that naively eval)?
| } else { | ||
| this.keydown_callbacks[keycode2] = [keydown_callback]; | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
The two blocks here are identical except for the sign of the step. Make this a function instead?
My goal is to enable keyboard teleoperation through meshcat, even when I'm running it the Deepnote cloud service (which doesn't fully support ipywidgets). This seemed like a particularly clean way to accomplish that; I've already been using sliders and buttons for teleop successfully in my course notebooks. This will make it much more ergonomic! Actually the immediate motivation for coding it this weekend actually came from trying to convince a FIRST robotics team to use simulation. ;-)
RussTedrake
force-pushed
the
keyboard_controls
branch
from
September 18, 2022 14:31
bf18186 to
ccef5a9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My goal is to enable keyboard teleoperation through meshcat, even when I'm running it the Deepnote cloud service (which doesn't fully support ipywidgets). This seemed like a particularly clean way to accomplish that; I've already been using sliders and buttons for teleop successfully in my course notebooks. This will make it much more ergonomic!
Actually the immediate motivation for coding it this weekend actually came from trying to convince a FIRST robotics team to use simulation. ;-)