Feature: go2 control coordinator TwistBase adapter#1357
Feature: go2 control coordinator TwistBase adapter#1357
Conversation
Greptile SummaryAdds Unitree Go2 quadruped control through the ControlCoordinator via a new Key Changes:
The implementation follows existing patterns and maintains backward compatibility. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant KeyboardTeleop
participant Coordinator as ControlCoordinator
participant Adapter as UnitreeGo2Adapter
participant SDK as Unitree SDK2
participant Go2 as Go2 Hardware
Note over User,Go2: Initialization Phase
User->>Coordinator: start()
Coordinator->>Adapter: connect()
Adapter->>SDK: ChannelFactoryInitialize(0)
SDK-->>Adapter: DDS initialized
Adapter->>SDK: SportClient.Init()
SDK-->>Adapter: Client ready
Adapter->>SDK: StandUp()
SDK->>Go2: Stand command
Go2-->>SDK: Standing (3s)
Adapter->>SDK: FreeWalk()
SDK->>Go2: Activate locomotion
Go2-->>SDK: Ready (2s)
Adapter-->>Coordinator: Connected & Ready
Coordinator->>Adapter: write_enable(true)
Adapter-->>Coordinator: Enabled
Note over User,Go2: Runtime Control Loop
User->>KeyboardTeleop: Press W (forward)
KeyboardTeleop->>Coordinator: Twist(/cmd_vel) [vx, vy, wz]
Coordinator->>Coordinator: _on_twist_command()
Coordinator->>Adapter: write_velocities([vx, vy, wz])
Adapter->>SDK: Move(vx, vy, wz)
SDK->>Go2: DDS velocity command
Go2-->>SDK: SportModeState (actual velocities)
SDK-->>Adapter: State callback
Adapter->>Adapter: Update _latest_state
Coordinator->>Adapter: read_velocities()
Adapter-->>Coordinator: [actual vx, vy, wz]
Coordinator->>Coordinator: Publish joint_state
Note over User,Go2: Shutdown Phase
User->>Coordinator: stop()
Coordinator->>Adapter: disconnect()
Adapter->>SDK: StopMove()
SDK->>Go2: Zero velocities
Adapter->>SDK: StandDown()
SDK->>Go2: Sit down
Adapter-->>Coordinator: Disconnected
Last reviewed commit: 20b9e29 |
dimos/robot/unitree/go2/README.md
Outdated
| If the prebuilt wheel doesn't work on your system (e.g. unsupported | ||
| architecture), fall back to building from source: | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
Instructions exist in docs/usage/transports/dds.md . This shouldn't be in Go2.
There was a problem hiding this comment.
I updated readme to point to dds.md and cut it down quite a bit.
wanted this to be a quickstart readme. Should I delete completely?
There was a problem hiding this comment.
No, I think you can keep it, but what I'm not sure about is this being the main readme for Go2. The homepage links to this page and most of our Go2 stuff uses WebRTC.
Maybe put this in go2/dds.md? What do you think @leshy ?
There was a problem hiding this comment.
removed all dds related things to the existing dds.md in the docs.
This readme is not just a quick starter to load the keyboard teleop for the go2
… reported by the go2
…ubscriptiuoin fails
…onnected hardware
5ea0ca9 to
f6ef415
Compare
Problem
The ControlCoordinator ocannot control unitree go2 using Twist (cmd_vel)
Solution
Added
UnitreeGo2Adapterimplementing theTwistBaseAdapterprotocol, enabling the Go2 quadruped to be driven through the ControlCoordinator. Key changes:UnitreeGo2Adapter: Wraps Unitree SDK2SportClientwith DDS state feedback. Reads actual velocities fromSportModeState(not command echo). Handles the Go2's init sequence (StandUp → FreeWalk → Move).HardwareAdapterbase protocol: Extractedconnect/disconnect/is_connectedinto a shared base soManipulatorAdapterandTwistBaseAdaptershare a common ancestor, eliminatingtype: ignore[override]on the adapter property.unitree-go2-keyboard-teleopblueprint: Dual-mode — simulation usesgo2_connection(MujocoConnection), real hardware uses ControlCoordinator with the Go2 adapter._subscribe_if()with list-based cleanup. Gripper methods useisinstancenarrowing forManipulatorAdapter.Breaking Changes
None
How to Test
Simulation ( ONLY verifies blueprint wiring, keyboard input, MuJoCo physics — does NOT exercise the coordinator or Go2 adapter):
dimos --simulation run unitree-go2-keyboard-teleopReal hardware (verifies the full coordinator → adapter → SDK path):
unitree-sdk2py):dimos run unitree-go2-keyboard-teleopcloses DIM-550