Kuavo Docs
Debugging Tutorials

Preparations Before Startup

Confirm the Robot Version and Total Mass (Lower-Level Controller)

Robot Version

  • The robot version is set via the environment variable $ROBOT_VERSION. The version number relates to different robot models, hardware configurations, etc., and must match your own robot.

  • Run echo $ROBOT_VERSION in the terminal to check the currently set version number. If it is not set, set it as follows (the 42 here represents the 4pro version; modify it according to your actual situation):

    1. Run the following in the current terminal (temporary setting):

    export ROBOT_VERSION=42

    1. Add it to your ~/.bashrc or ~/.zshrc terminal configuration file: For example, run:

      echo 'export ROBOT_VERSION=42' >> ~/.bashrc

    This appends it to the end of the ~/.bashrc file (bash terminal) and takes effect after restarting the terminal

Robot Mass

  • Since each robot has a different optional configuration, its mass also differs. You need to confirm the robot's total mass to ensure the model is accurate. (The mass is corrected once at the factory.)
  • The robot's total mass is stored in the file ~/.config/lejuconfig/TotalMassV${ROBOT_VERSION} (where ${ROBOT_VERSION} is the version number set above). During compilation, this file is read automatically to calibrate the model mass in the repository.
  • After weighing the robot, simply write the total mass into the file ~/.config/lejuconfig/TotalMassV${ROBOT_VERSION}.
  • ocs2 uses the cppad automatic differentiation library, and cppad's cache is model-dependent.
    • Therefore, each time the total mass file is modified, the cache directory /var/ocs2/biped_v${ROBOT_VERSION} is automatically deleted, and the cppad model is automatically recompiled on the next run (about 4 minutes).
    • If you manually modify the model in the repository, you likewise need to delete the cache directory and recompile the cppad model.

Compilation

Lower-Level Controller

Docker Environment

When no robot runtime environment is available, you can use the Docker environment for compilation and simulation.

Real Robot Environment

Note: All compilation in the lower-level controller's real robot environment must be performed as the superuser

  • If the Kuavo real robot image is relatively old, you need to manually install some dependencies:
# Provides a script to quickly install dependencies on an old Kuavo real robot image
./docker/install_env_in_kuavoimg.sh
  • Compiling on the real robot
cd /home/lab/kuavo-ros-opensource #repository directory
sudo su
catkin config -DCMAKE_ASM_COMPILER=/usr/bin/as -DCMAKE_BUILD_TYPE=Release # Important! 
source installed/setup.bash # Load the environment of some already installed ROS package dependencies, including hardware packages, etc.
catkin build humanoid_controllers

Upper-Level Computer

  • Compile
cd ~/kuavo_ros_application/src/ros_audio/kuavo_audio_player/scripts
./deploy_autostart_h12pro.sh