How to build Xiaomi CyberDog 2 bionic quadruped robot: the whole process
157 steps to build Xiaomi CyberDog 2 bionic quadruped robot, from buying parts, printing and assembly to software, calibration and training, with the bill of materials, …
The Xiaomi store page shows no price (2026‑10‑31; the page data carries a price of 0 and the item is not enabled); no official BOM or BOM cost
Buy parts
- Prepare PC flash equipment
Prepare one Ubuntu PC and one general-purpose flashing cable. PC flashing takes at least 15 minutes and does not require a particular configuration filename.
- Prepare Type-C flash drive
Prepare a Type-C flashing USB drive; the document recommends an aigo U350 32GB dual-interface drive. This method needs no flashing cable, and the drive must fit the robot's limited internal space.
Software
- Upgrade Xavier NX first
Upgrade the perception mainboard, Xavier NX, first.
- Upgrade other subboards
After upgrading the perception mainboard, upgrade the robot's other internal subboards. Updating all mainboards together is recommended to ensure system stability.
- Fill configuration by example
Fill the first nine lines with r329, mr813, power, imu, head-tof, tail-tof, mini-led, head-uwb, and tail-uwb, all set to on in the example; use check-battery = 40 on line 10 and force-update = off on line 11.
- Check configuration file format
The file must use Linux text format with LF line endings, contain exactly 11 lines, and have no newline after line 11. Separate each field with at least one space; the first two fields must match the example, and the third must be on, off, or a check-battery value from 0–100.
- Apply for developer access
First apply to become a developer in the app and pass the review.
- Enter flashing mode
Log in with ssh [email protected] using password 123, then run sudo reboot --force forced-recovery to enter flashing mode.
- Perform PC flashing
- Flash using USB drive
- Connect flash drive directly
The flashing drive cannot be connected through a USB hub and must be inserted directly into the robot. USB-interface solid-state drives are not currently supported as flashing drives.
- Re-enable flash flag
- Extract the official flash package
Use sudo tar on the PC to extract the official release flash package; the output path and name have no requirements.
- Configure the flashing environment
Enter the extracted directory and run tools/otf_tools/setup.sh to configure the flashing environment.
- Fix script execution permission
If setup.sh reports a permission problem, add execute permission to the script.
- Confirm continued installation
If the script asks for “Y” during execution, enter Y to continue the installation.
- Put the robot into flash mode
Keep the robot facing forward and insert the supplied flashing cable into the rightmost USB Type-C port. When powered off, hold the power button for 5 seconds; when powered on, hold it for 5 seconds, release it, and hold it for 5 seconds again.
- Run the flashing command
After the robot enters flash mode, run flashall.sh and replace flash_conf_file_path with the actual PC path of the flashing configuration file.
- Confirm Xavier NX update success
Flashing generally takes about 15 minutes. When “Flash Successfully !” appears, the Xavier NX perception board has updated successfully and the flashing cable can be removed.
- Wait for other boards to update
- Confirm all flashing is complete
- Restart the robot
Hold the power button for 5 seconds, release it, and hold it for 5 seconds again to restart the robot; it then enters normal use.
- Back up USB drive data
USB card flashing erases all existing data on the USB drive, so back it up beforehand.
- Determine whether tools are prepared
If PC cable flashing was already used, the script tools are already included in the official release package and this step can be skipped; otherwise perform the following preparation.
- Extract the USB flashing package
Use sudo tar on the PC to extract the flashing package into a chosen directory; the path and name have no requirements.
- List drives before USB insertion
Run ls /dev/sd* while the USB drive is not inserted into the PC and record the current device list.
- Identify the USB device name
After inserting the USB drive, run ls /dev/sd* again. The newly appearing device node is the USB device name and its partition node is the device partition name; the example names vary by PC.
- Insert USB and enter tools directory
Insert the USB drive into the PC and enter the tools/otf_tools directory inside the extraction directory from 5.1.
- Create the USB flashing media
Run mkudisk.sh with the USB device name identified in 5.2.1. The message “make udisk successfully!” indicates successful creation.
- Unmount the default USB partition
Unmount the USB device partition identified in 5.2.1. Keep the USB drive inserted after unmounting it.
- Change the USB partition table format
Use parted to change the USB drive partition table to the gpt format and execute mklabel inside parted.
- Start Parted partitioning
- Configure USB partition
Set the partition name to otf, the filesystem type to ext4, the start to 0%, and the end to 100%, then quit parted.
- Open USB disk settings
- Select format partition
Click the settings button in the USB drive interface and select the format partition option.
- Set USB volume name
- Format the USB drive
- Confirm USB is mounted
Ensure that the prepared USB drive is mounted on the PC.
- Enter the script tools directory
- Create the USB image
Run mkimage.sh with the full path and complete filename of the official release flashing package as its argument; the command takes about 10 minutes. If a permission error appears, first run chmod +x mkimage.sh.
- Check image creation result
“Make udisk image successfully!” indicates success, while “Fail to make udisk image!” indicates failure. If the process remains at “Wait for the udisk to be ready...”, check that the USB drive is inserted in the PC and reconnect it if necessary.
- Place Flash Configuration on USB Root
The configuration filename must be ota_others.conf, and all other requirements are the same as the PC-card flashing method.
Calibrate and test
- Maintain the R329 Heartbeat
NX sends a heartbeat request to R329 once per second to confirm that its status is normal. An abnormal heartbeat causes an error log to be printed.
- Set the Audio Volume
Use the audio_volume_set service to set the volume to 50. The target node name can be found from ros2 node list.
- Get the Current Audio Volume
Use the audio_volume_get service to query the current volume. The target node name can be found from ros2 node list.
- Enable or Disable the Microphone
Use the provided microphone enable or disable service to control sound input. After the microphone is disabled, it no longer captures sound and the dog cannot be awakened.
- Set the Robot Nickname
- Confirm flashing prompt
During flashing, the robot emits a corresponding prompt whether the operation succeeds or fails.
- Set battery check threshold
check-battery accepts 0–100; 0 disables the battery check, while a value above 0 checks the battery before upgrading the NX board and stops flashing if the level is below the threshold.
- Confirm default configuration
Without a configuration file, all mainboards default to off and are not upgraded, check-battery defaults to 0 with no battery check, and force-update defaults to on, forcing other mainboards to update.
- Place robot in prone state
Ensure the robot is not executing any action or program and place it in a prone state.
- Handle flashing interruption caused by locale
If the ROS environment uses the listed locale configuration, flashing may not continue after the Xavier NX update; manually restart the robot to continue updating the other boards.
- Enter low-battery mode
The robot automatically enters low-battery mode when the battery is below 20%, and automatically exits when the battery reaches 20% or more.
- Trigger entry into low-power mode
Low-power mode is entered automatically when the battery is below 5% or when the robot stays lying down for more than 30s; after waking, if no motion control happens within 30s it enters low-power mode again.
Data and training
- Record and Bind a Voiceprint
Use the App's voiceprint recording entry to trigger the recording process and bind the voiceprint to the specific owner's information.
Use it
- Use the Visual Programming App
Complete the visual program in the graphical programming APP, adjusting the program and result together.
- Use all functions in Active mode
In Active mode all robot function modules work normally, so all operations on tasks, modules and AI capabilities are open.
- Manage processes in SelfCheck, OTA and Error modes
In SekfCheck, OTA and Error modes the function modules are sealed: only stopping, suspending or shutting down existing processes is allowed, plus inquiry to review tasks, modules and AI information for further editing.
- Restrict motion and LED in Protected mode
In Protected mode most modules work normally, but the motion module only allows the stand and lie-down result commands; the LED module can be preempted by the BMS.
- Exit low-power mode three ways
- Label coordinates and four legs
Follow the robot coordinate system in Figure 1 and name the four legs FL (Front-left), FR (Front-right), RL (Rear-left), and RR (Rear-right).
- Create gait definition file
Store the gait definition content in a file.
- Fill gait blocks
Each gait block contains a support state and duration. The four values correspond to FR, FL, RR, and RL in order, with 1 for support and 0 for swing; duration N equals N×30 milliseconds.
- Fill pace parameter blocks
Each pace block specifies torso velocity, position, and attitude; swing-leg landing point and lift height; current ground-to-foot friction coefficient; and gait duration.
- Relate gait and parameter durations
Relate the durations in the gait definition and pace parameters without making them one-to-one. Specify landing points generally only when the support phase changes.
- Set desired torso state
Set the desired torso displacement, attitude, linear velocity, and angular velocity. Define translational movement mainly with velocity and rotational movement mainly with attitude.
- Calculate desired torso displacement
When a direction has a desired velocity, obtain displacement by integrating velocity and do not use the corresponding body_pos_des displacement; when velocity is 0.0, use body_pos_des and set desired velocity to displacement divided by time. In the first Moonwalk block, vx over T1 gives vx×T1, so the x body_pos_des value 0.0 is unused.
- Specify swing foot landing points
Specify each swing leg’s endpoint as its landing point; its start is the end of the support state and need not be specified. The x and y directions each use one endpoint, while z uses separate lift and landing curves because of the lift height.
- Calculate swing leg trajectories
Use third-order Bézier curves to calculate the swing position at each moment in x, y, and z, with each curve defined by its initial position, initial velocity, final position, and final velocity. The swing leg’s ground-relative velocity is zero at lift and landing, so the landing point and lift height determine the trajectory.
- Combine complete desired state
Combine the desired torso and swing-leg states while keeping support legs fixed relative to the ground, fully determining the robot’s desired state at that moment.
- Execute custom action
Execute the action calculated for the current state using the open-source MPC+WBC control algorithm or another motion-control algorithm.
- Check action completion
Check whether the action is complete at every moment. When execution time reaches the user-defined total time, the robot enters a standing state and waits for the next command; otherwise, increase dt and continue.
- Synchronize the Account Token
After the App connects to the robot, it transparently passes the account token to NX and then synchronizes it with R329. The App initiates the transfer to the NX gRPC node, which calls the cyberdog_audio service to synchronize it.
- Cache and Use the Token
After receiving the token, R329 caches it locally and uses it to access the XiaoAI cloud service.
- Play an Offline Voice
The voice node provides topic and service methods for offline voice playback. An ID identifies a voice file stored on NX or R329; the constants and associated text are defined in bridge/protocol/ros/msg/AudioPlay.msg.
- Play Online Text-to-Speech
Online voice, also called tts (text to speech), converts text into speech for playback. The NX side must be able to access the internet.
- Trigger a Configured Dog Action
- Identify the Owner by Voiceprint
- Report Dog Information to Cloud
The dog information includes its nickname, activation date, and weight. After the first activation, the information is reported to the cloud; when asked its age, it gives a specific answer.
Common problems
- Workspace builds fail from missing or incompatible native dependencies #1 #9 #22 #26 #35 #42
- ROS2 installation and workspace setup fail due to environment or repository errors #10 #12 #23
- Python package installation fails from broken pip environments and encoding errors #15 #28
- Failed self-tests block sensors, LEDs, and broader robot functions #13 #20 #36
- Flashing or firmware changes disrupt app access, SSH, and connectivity #25 #34 #43
- Camera image streams fail to publish or stop after startup #38 #41
- ROS2 nodes and topics fail to communicate across machines on a LAN #17 #40
- Outdoor mapping fails with too little valid map data #37
Parts
- NVIDIA Xavier NX perception board (6-core Carmel CPU, 384-core Volta GPU, 8 GB LPDDR4x, 16 GB eMMC) plus two co-processors, 21 TOPS per the site
- 12 Xiaomi-made micro motors, 3 DoF per leg; the site gives a peak torque density of 37.85 N·m/kg
- RealSense D430, 13 MP and 1 MP cameras, 146° fisheye, TG30 lidar, ultrasonic, ToF, touch, 4 microphone groups, UWB, IMU
- 21.6 V 4500 mAh (97.2 Wh) Li-polymer battery, about 90 minutes of runtime and 90 minutes to charge; 20 V 10.5 A adapter
- Standing 562×339×481 mm, 8.9±0.5 kg, 1 kg maximum payload, model MS2242CN
Tools
- An Ubuntu PC: motion control code is built off-board or cross-compiled in Docker
- A flashing cable (PC flashing) or a suitably small Type‑C USB stick (USB flashing)
Skills
- ROS 2 and Linux, the C++ or Python API
- MIT Cheetah-based MPC + WBC motion control and gait parameters
- Blockly visual programming in the app (entry level)
Software
- cyberdog_ws v1.3.0 (2024‑01): the ROS 2 workspace that pulls in each feature repo with vcs
- cyberdog_locomotion motion control and the loco_hl_example high-level API examples
- cyberdog_sim: Gazebo + ROS 2 Galactic simulation with Rviz2 visualisation