feat: keyboard mapping to velocity and pose via existing interfaces (#1159)#1393
Open
christiefhyang wants to merge 5 commits intodevfrom
Open
feat: keyboard mapping to velocity and pose via existing interfaces (#1159)#1393christiefhyang wants to merge 5 commits intodevfrom
christiefhyang 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()).
Contributor
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>
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.
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