feat: keyboard mapping to velocity and pose via existing interfaces (#1159)#1393
feat: keyboard mapping to velocity and pose via existing interfaces (#1159)#1393christiefhyang wants to merge 5 commits intodevfrom
Conversation
…1159) Added 2 files: 1) keyboard_pose_teleop.py Keyboard → Relative Pose → goal_pose / cancel_goal 2) unitree_g1_blueprints.py Connect keyboard_pose_teleop() to with_joystick (along with the original keyboard_teleop()).
Greptile SummaryAdded keyboard-based pose control module that enables discrete navigation goals through arrow keys and rotation commands. The new Major Changes:
Critical Issues:
Confidence Score: 0/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant KeyboardPoseTeleop
participant Odom as /odom (PoseStamped)
participant GoalPose as /goal_pose
participant CancelGoal as /cancel_goal
participant Navigation as Navigation Stack
User->>KeyboardPoseTeleop: Start module
KeyboardPoseTeleop->>Odom: Subscribe to odometry
loop Pygame Event Loop (20Hz)
Odom-->>KeyboardPoseTeleop: Current robot pose
User->>KeyboardPoseTeleop: Press Arrow/Q/E key
KeyboardPoseTeleop->>KeyboardPoseTeleop: Generate relative goal<br/>(forward/left/yaw offset)
KeyboardPoseTeleop->>GoalPose: Publish PoseStamped goal
GoalPose-->>Navigation: New navigation goal
alt Cancel Goal (Space)
User->>KeyboardPoseTeleop: Press Space
KeyboardPoseTeleop->>CancelGoal: Publish cancel (Bool=True)
CancelGoal-->>Navigation: Cancel active goal
end
end
User->>KeyboardPoseTeleop: ESC or close window
KeyboardPoseTeleop->>CancelGoal: Publish cancel on stop
KeyboardPoseTeleop->>KeyboardPoseTeleop: Stop module
Last reviewed commit: ed7fc48 |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Import path file errors have been fixed. There's no runtime failure. Tested in Mujoco. |
| @@ -0,0 +1,240 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
This dir, dimos/robot/unitree_webrtc is no longer in use.
There was a problem hiding this comment.
Where should I best relocate the files to? If it's no longer in use, shall we delete it?
There was a problem hiding this comment.
This module is not G1 specific, so it should be in dimos/teleop/keyboard.
The other file, unitree_g1_blueprints.py, is also old. The blueprints for g1 are now in dimos/robot/unitree/g1.
There was a problem hiding this comment.
Thank you for your direction. This is my first actual PR at dimOS and I am just getting started. Will update the file locations.
|
You have to post PRs from a branch, not a fork, otherwise the CI doesn't run. |
This PR adds keyboard-based control for both velocity and pose using the existing control/navigation interfaces for the Unitree G1.> It keeps the existing KeyboardTeleop for continuous cmd_vel control and adds a new module to send small relative pose goals through the navigation stack.
Details:
Velocity control
• Reuse KeyboardTeleop to map keyboard input to Twist messages.
• Commands are published to the existing /cmd_vel transport; no changes to the low-level control path.
Pose control
• Add KeyboardPoseTeleop, a pygame-based module that:
• Subscribes to odom: In[PoseStamped] for the current robot pose.
• Maps key presses (Arrow keys, Q/E, Space) to relative motion (forward, left, degrees).
• Generates a new PoseStamped goal in the same frame as odom and publishes it on goal_pose: Out[PoseStamped].
• Sends cancel_goal: Out[Bool] on Space for goal cancellation.
• This reuses the existing navigation topics /odom, /goal_pose, and /cancel_goal instead of introducing new control interfaces.
Blueprint wiring
• Update unitree_g1_blueprints.with_joystick to include both:
• keyboard_teleop() for velocity (cmd_vel).
• keyboard_pose_teleop() for discrete pose goals.
Breaking Changes
None. This change only adds a new module and extends the G1 joystick blueprint; existing behavior is preserved.
How to Test
• Focus the Keyboard Teleop window:
• W/S: forward/backward
• A/D: turn left/right
• Q/E: strafe left/right
• Shift / Ctrl: speed up / slow down
• Space: emergency stop (cmd_vel = 0)
• Focus the Keyboard Pose Teleop window:
• ArrowUp/ArrowDown: move forward/backward by a fixed step (relative to current heading).
• ArrowLeft/ArrowRight: move left/right by a fixed step.
• Q/E: rotate in place by a fixed yaw step.
• Space: cancel the current navigation goal.
• ESC: close the pose teleop window.
Contributor License Agreement