Pre-Startup Preparation
Confirm Robot Version and Total Mass
Robot Version
-
The robot version is set through 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_VERSIONin the terminal to check the currently set version number. If it is not set, set the version number as follows (modify it according to your actual situation):- Run the following in the current terminal (temporary setting):
export ROBOT_VERSION=14-
Add it to your
~/.bashrcor~/.zshrcterminal configuration file: For example, run:echo 'export ROBOT_VERSION=14' >> ~/.bashrc
This appends it to the end of the
~/.bashrcfile (bash terminal), and it takes effect after restarting the terminal.
Robot Mass
- Since each robot has different optional configurations, its mass also differs. You need to confirm the robot's total mass to ensure the model is accurate. (The mass is set correctly once at the factory.)
- The robot's total mass is stored in the
~/.config/lejuconfig/TotalMassV${ROBOT_VERSION}file (${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, write the total mass into the
~/.config/lejuconfig/TotalMassV${ROBOT_VERSION}file. - ocs2 uses the cppad automatic differentiation library, and cppad's cache is model-dependent
- Therefore, every time the total mass file is modified, the cache directory
/var/ocs2/biped_v${ROBOT_VERSION}isautomaticallydeleted, and the cppad model will be automatically recompiled on the next run (about 4 minutes) - If you have manually modified the model in the repository, you likewise need to delete the cache directory and recompile the cppad model
- Therefore, every time the total mass file is modified, the cache directory
Compilation
Docker Environment
If no robot runtime environment is available, you can use the Docker environment for compilation and simulation.
Physical Robot Environment
Note: For the lower-level controller's physical robot environment, all compilation must be performed as the superuser
- If the physical robot image is rather old, you need to manually install some dependencies:
# 提供了一个脚本用于快速在旧的实机镜像进行安装依赖
./docker/install_env_in_kuavoimg.sh- Physical robot compilation
cd <kuavo-ros-opensource> #仓库目录
sudo su
catkin config -DCMAKE_ASM_COMPILER=/usr/bin/as -DCMAKE_BUILD_TYPE=Release # Important!
source installed/setup.bash # 加载一些已经安装的ROS包依赖环境,包括硬件包等
catkin build humanoid_controllers