Xiaomi Cyberdog Quadruped Developer Platform

repository·rolling·Indexed 42 days ago

https://github.com/miroboticslab/cyberdog_ws

The primary workspace for the Xiaomi Cyberdog quadruped robot, integrating modules for motion control, sensor management, interaction, and navigation. It features the cyberdog_bringup package for automated ROS2 node lifecycle management, using a compilation-based approach to generate launch.py files from YAML configurations. The workspace includes specialized repositories for devices, bridges, sensors, and navigation (cyberdog_nav2).

Tokens
1.9K
Snippets
1
Records
10
Agent score
53%

What's inside Xiaomi Cyberdog

  1. Overview of cyberdog_bringup functionality

    rolling

    The cyberdog_bringup package is designed to manage the lifecycle of robot nodes based on configuration files. Its primary functions include:

    1. Automated Node Startup: Starts all configured nodes within the robot based on parameters defined in a target configuration file (*.yaml).
    2. Dynamic Node Management: Supports the dynamic starting and stopping of specific nodes (currently specifically implemented for navigation2).
    3. ROS2 Compatibility: Configuration files are designed to be as compatible as possible with standard ROS2 launch interfaces.
  2. Overview of cyberdog_bringup

    rolling

    The cyberdog_bringup package is designed to manage the lifecycle of robot nodes on the CyberDog platform. Its primary functions include:

    1. Automated Node Startup: Starting all configured robot nodes based on parameters defined in target configuration files (*.yaml).
    2. Dynamic Node Management: Dynamically starting or stopping specific nodes (e.g., navigation2).
    3. ROS2 Compatibility: Ensuring configuration files are fully compatible with ROS2 launch interfaces.

    The system uses a compilation-based approach where launch.py files are dynamically generated from YAML configuration files during the build process to ensure all startup constraints are statically enumerated and easy to debug.

  3. Overview of Cyberdog Workspace component repositories

    rolling

    The cyberdog_ws project is composed of several specialized repositories that provide core functionality for the Xiaomi Quadruped Developer Platform. Key modules include:

    • cyberdog_ws: Startup/bringup modules.
    • manager: Global management nodes.
    • bridges: ROS message definitions, App communication, and CAN data encapsulation.
    • devices: Device management, BMS, LED, Touch, and UWB plugins.
    • motion: Motion control management.
    • sensors: Sensor nodes (GPS, LiDAR, ToF, Ultrasonic).
    • interaction: Voice, Visual Programming, XiaoAI training words, Video transmission, and Fast connection nodes.
    • cyberdog_nav2: Algorithm task management.
    • cyberdog_tracking_base: Parameters for docking, navigation, and tracking based on Navigation2.
    • utils: General interface libraries.
  4. How cyberdog_bringup launch generation works

    rolling

    Instead of relying on complex runtime dynamic loading which can be difficult to debug, cyberdog_bringup uses a pre-compilation approach to generate launch files.

    Configuration and Constraints

    Startup constraints are defined by two sources:

    1. Configuration Files (*.yaml): A unique master file that can load other sub-files containing parameters that follow ROS constraints.
    2. Command Line Arguments (argv[]): These adapt to the standard ROS2 launch parameter interface.

    Generation Process

    To ensure visibility and prevent issues where a single launch file cannot be started multiple times, the system follows these principles:

    • Static Enumeration: Launch files are dynamically generated from *.yaml files during the cyberdog_bringup compilation phase.
    • Hierarchical Launch Files:
      • A Unique Master Launch File is responsible for starting all nodes under the specified parameter constraints. This is used for system-level service calls to automate robot software functions.
      • Sub-level Launch Files are generated to handle specific groups of nodes.
    • Automated Workflow:
      1. Complex syntax is abstracted into a custom meta-language.
      2. This meta-language is encoded using standard formats like yaml, toml, or json.
      3. A compilation tool processes these files.
      4. During each build, the tool compiles the meta-language into executable scripts (launch files) and installs them.
      5. System instructions are used to set these up for auto-start on boot.
  5. Configuration constraints in cyberdog_bringup

    rolling

    Startup constraints for the robot are defined by two sources:

    1. Configuration Files (*.yaml): There is a unique master file that can load other sub-files containing parameters that comply with ROS constraints.
    2. Command Line Arguments (argv[]): These are designed to be compatible with the standard ROS2 launch parameter interface.

    To improve debuggability and avoid issues with invisible runtime dynamic loading, the system attempts to statically enumerate parameters during the compilation phase, while still providing entry points for necessary dynamic parameters.

  6. How cyberdog_bringup configuration and launch generation works

    rolling

    The cyberdog_bringup system uses a multi-layered configuration approach to generate ROS2 launch files. Instead of manually writing complex launch scripts, users define configurations in YAML files, which are then compiled into executable launch.py files.

    Configuration Hierarchy

    • Primary Configuration Files: The system uses bringup.yaml, launch.yaml, and node.yaml to drive the generation process.
    • Generated Launch Files: The build process produces various levels of launch.py files:
      • A Unique Main Launch File: Responsible for starting all nodes under specific parameter constraints. This is used for system-level service calls to automate the robot's software functions.
      • Sub-level Launch Files: Responsible for starting specific groups of nodes based on the configuration.

    Implementation Workflow

    1. Abstraction: Complex ROS2 launch syntax is abstracted into a custom meta-language.
    2. Encoding: This meta-language is encoded using standard formats like yaml, toml, or json.
    3. Compilation: A build tool processes these encoded files.
    4. Generation: During compilation, the tool generates and installs the executable launch.py scripts.
    5. Deployment: System commands are used to set these processes to start on boot.
  7. Initialize submodules using vcstool

    rolling

    After cloning the cyberdog_ws repository, you must expand the submodules to ensure all necessary component repositories are present. Navigate to the cyberdog_ws directory and use the vcs import command with the provided .repos file.

    Note: This requires vcstool to be installed on your system.

    vcs import . < cyberdog.repos
  8. Configuration files used by cyberdog_bringup

    rolling

    The cyberdog_bringup system uses three primary types of YAML configuration files to dynamically generate the required launch.py files:

    • bringup.yaml: Likely the master configuration for system-level bringup.
    • launch.yaml: Configuration related to launch-specific logic.
    • node.yaml: Configuration specific to individual nodes.

    These files are processed during the build phase to produce the final ROS2 launch scripts.

  9. Reference development demos for Cyberdog

    rolling

    The following repositories provide non-native reference implementations and demos for various features:

    Demo NameDescriptionGitHub Link
    grpc_demogRPC communication routineLink
    audio_demosAudio/Voice routinesLink
    cyberdog_ai_sports_demoMotion counting routineLink
    cyberdog_face_demoFace recognition demoLink
    nav2_demoNavigationLink
    cyberdog_vp_demoVisual ProgrammingLink
    cyberdog_action_demoGesture/Action recognitionLink