How unitreerobotics/unitree_sdk2 works
Based on our analysis of the file tree and the README, this project is the Unitree robot SDK version 2 – a C++ robotics software development kit that provides API support for a range of Unitree robot models (such as b2, g1, go2, h1, etc.). Its purpose is to enable developers to build applications that control and interact with these robots. The repository is organized into core source headers (under include/unitree), pre-built static libraries (in lib), a collection of examples demonstrating usage (under example), and a comprehensive integration with DDS for the communication layer, along with third-party components.
And Label Main Components
• Core SDK Library: Represent the core functionalities (e.g., common utilities, thread, time, logging, file system, error/exception handling) found within the include/unitree/common and various include directories.
• Communication & Messaging Layer: Create a component for the DDS integration. This includes the DDS-related code in include/unitree/common/dds as well as the IDL definition files in include/unitree/idl. Also, note the integration with third-party DDS libraries (thirdparty folder).
• Build & Deployment Infrastructure: Include a component for the build system and installation procedures (the CMakeLists.txt at the root and within examples, plus the CI configuration in the .github/workflows directory). This emphasizes the use of CMake as well as the multi-architecture support (aarch64 and x86_64).
Relationships & Data Flow
• That the Application Examples use the Core SDK Library to interact with the robot-specific modules.
• That the SDK wraps third-party DDS functionalities and provides a layer of abstraction for client/server communications.
• How CMake scripts and configuration files integrate all these components during the build and installation processes.
Architectural Patterns and Design Principles
• Layered Architecture: Show separate layers for (a) utility/core functions, (b) communication/messaging, (c) robot-specific APIs, and (d) application examples.
• Modular Design: Stress that the robot modules (b2, g1, go2, h1) are independently organized, allowing developers to pick the right APIs per robot family.
• Client-Server Model: Indicate that there is a clear separation between legacy client side interactions and the internal server implementations (as seen in include/unitree/robot/client and include/unitree/robot/server).
• DDS Integration: Make clear how the DDS layer encapsulates communication, which is fundamental to the SDK’s operations.