Adding strafe and arrow control to keyboard telop#2028
Conversation
Greptile SummaryThis PR adds arrow key support for movement and replaces the old Q/E strafe with an Alt-modifier scheme (Alt+A/D or Alt+←/→) across the pygame
Confidence Score: 3/5The Python side is safe to merge; the web component has a real cross-platform defect that should be addressed before merging. The Python pygame implementation is clean and correct. The web component mirrors it faithfully on Windows/Linux, but the Alt+letter handling breaks on macOS because the browser produces composed characters (e.g. "å", "∂") instead of "a"/"d" when Alt is held, causing the strafe condition to never fire for those keys. dimos/web/command-center-extension/src/KeyboardControlPanel.tsx — the Alt key normalisation needs attention for cross-platform correctness. Important Files Changed
|
| const altStrafe = | ||
| keys.has("Alt") && | ||
| (keys.has("a") || | ||
| keys.has("d") || | ||
| keys.has("ArrowLeft") || | ||
| keys.has("ArrowRight")); | ||
|
|
||
| // Alt + A/D or ←/→: strafe (linear Y). Otherwise those keys turn (yaw). | ||
| if (altStrafe) { | ||
| const strafeLeft = keys.has("a") || keys.has("ArrowLeft"); | ||
| const strafeRight = keys.has("d") || keys.has("ArrowRight"); | ||
| if (strafeLeft && !strafeRight) { | ||
| linearY = linearSpeed * speedMultiplier; | ||
| } else if (strafeRight && !strafeLeft) { | ||
| linearY = -linearSpeed * speedMultiplier; | ||
| } | ||
| } else { | ||
| const turnLeft = keys.has("a") || keys.has("ArrowLeft"); | ||
| const turnRight = keys.has("d") || keys.has("ArrowRight"); | ||
| if (turnLeft && !turnRight) { | ||
| angularZ = angularSpeed * speedMultiplier; | ||
| } else if (turnRight && !turnLeft) { | ||
| angularZ = -angularSpeed * speedMultiplier; | ||
| } | ||
| } |
There was a problem hiding this comment.
Alt+A/D strafe silently broken on macOS browsers
On macOS, holding Alt and pressing A generates event.key === "å" (not "a"), and Alt+D generates "∂" instead of "d". Because neither character is in controlKeys, the KEYDOWN handler filters them out before they reach keysPressed. The result is that keys.has("a") is always false while Alt is held on macOS, so altStrafe only becomes true via ArrowLeft/ArrowRight — the A/D half of the advertised "Alt+A strafe left, Alt+D strafe right" feature never fires on macOS Chrome/Safari.
|
|
||
| // Linear X (forward/backward) - W/S | ||
| if (keys.has("w")) { | ||
| const forward = keys.has("w") || keys.has("ArrowUp"); |
There was a problem hiding this comment.
This control center extension is deprecated so no need to change it
Description
Added strafing and arrow key support to keyboard teleop across
the Python pygame module, the twist base example, and the web
command center extension
How to Test
python -m dimos.control.examples.twist_base_keyboard_teleop
Verify:
Screencast from 05-08-2026 10:25:37 PM.webm
Contributor License Agreement
Closes #1957