unitree_ros

该博客详细记录了在 Ubuntu 18.04 上安装 ROS Melodic、Champ 机器人软件、Unitree Legged SDK、PCL 和相关依赖的过程,包括源添加、库安装、错误解决及环境配置等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

check ubuntu version

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

install ros melodic

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl 
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

OK

sudo apt update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo rosdep init
rosdep update

install champ

cd ~
mkdir catkin_ws
cd catkin_ws
mkdir src
cd src
git clone --recursive https://github.com/chvmp/champ
git clone https://github.com/chvmp/champ_teleop
cd ..
rosdep install --from-paths src --ignore-src -r -y

#All required rosdeps installed successfully

catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
  • test
tmux new -s tmp
# in one window 
roslaunch champ_config bringup.launch rviz:=true
# in the other window
roslaunch champ_teleop teleop.launch
# push i, and the dog should move forward

install Eigen3

sudo apt install libeigen3-dev
pkg-config --modversion eigen3

3.3.4

install Ipopt

sudo apt-get install gcc g++ gfortran git patch wget pkg-config liblapack-dev libmetis-dev
  • install HSL
  1. Go to http://hsl.rl.ac.uk/ipopt. download hsl file.
cd ~
git clone git@github.com:coin-or-tools/ThirdParty-HSL.git
cp /tmp/coinhsl-archive-2021.05.05.tar.gz ~/ThirdParty-HSL/
cd ThirdParty-HSL/
tar -zxvf coinhsl-archive-2021.05.05.tar.gz 
mv coinhsl-archive-2021.05.05 coinhsl
./configure

make sure MA27 has been installed

checking for MA27… yes

make
sudo make install
  • install MUMPs
cd ~
git clone https://github.com/coin-or-tools/ThirdParty-Mumps.git
cd ThirdParty-Mumps
./get.Mumps
./configure
make
sudo make install
  • install Ipopt
cd ~
git clone https://github.com/coin-or/Ipopt.git
cd Ipopt
mkdir build
cd build
../configure --with-mumps-cflags="-I/usr/local/include/coin-or/mumps" --with-mumps-lflags="-L/usr/local/lib -lcoinmumps"
make
sudo make install

install unitree_ros

cd ~/catkin_ws/src/
git clone git@github.com:HybridRobotics/unitree_ros.git
cd unitree_ros
git checkout dev-final
git branch

dev
dev-final

cd ~/catkin_ws/src/unitree_ros/unitree_gazebo/src/boxdynlib
mkdir build
cd build
cmake ../
make
cd ~/catkin_ws/src/unitree_ros/codogs_plan/src/dogCtrlAlgorithm/
mkdir build
cd build
cmake ../
make

install hector-slam

sudo apt install ros-melodic-hector-slam

install graph_rviz_plugin

cd ~/catkin_ws/src
git clone https://gitlab.com/InstitutMaupertuis/graph_rviz_plugin.git
cd ..
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y

but get this bug

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
walking_controller: Cannot locate rosdep definition for [sensor+msgs]
codogs_paper_draw: Cannot locate rosdep definition for [tf_bag]

vim ~/catkin_ws/src/unitree_ros/walking_controller/package.xml
# change sensor+msgs to sensor_msgs # assume it is a typo
cd  ~/catkin_ws/src
git clone git@github.com:IFL-CAMP/tf_bag.git

then rosdep install again

rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y

#All required rosdeps installed successfully

install sdk

  • install boost 1.56
cd ~
wget -O boost_1_56_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.tar.gz/download
tar xzvf boost_1_56_0.tar.gz
cd boost_1_56_0/
./bootstrap.sh
./b2
sudo ./b2 install
mv /tmp/lcm-1.4.0.tar.gz ~
cd lcm-1.4.0
mkdir build
cd build
cmake ../
make
sudo make install
mv /tmp/unitree_legged_sdk-3.3.1.tar.gz ~
cd unitree_legged_sdk-3.3.1/
mkdir build
cd build
cmake ../
make
  • edit ~/.bashrc
# ros-melodic
source /opt/ros/melodic/setup.bash
# catkin_ws
source ~/catkin_ws/devel/setup.bash
export ROS_PACKAGE_PATH=~/catkin_ws:${ROS_PACKAGE_PATH}
export LD_LIBRARY_PATH=~/catkin_ws/devel/lib:${LD_LIBRARY_PATH}
export UNITREE_LEGGED_SDK_PATH=~/unitree_legged_sdk-3.3.1
export UNITREE_PLATFORM="amd64"

install pcl_ros

  • install pcl
    get file from : https://github.com/PointCloudLibrary/pcl/releases?page=2
mv /tmp/pcl-pcl-1.8.1.tar.gz  ~
tar -zxvf pcl-pcl-1.8.1.tar.gz 
cd pcl-pcl-1.8.1/
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make -j2 install
  • check pcl version
# an ugly way to preventing bug "<pcl/pcl_config.h> No such file or dir"
sudo cp -r /usr/local/include/pcl-1.8/pcl /usr/include
cd ~
mkdir test && cd test
touch test.cpp
vim test.cpp

write file as

#include <iostream>
#include <pcl/pcl_config.h>
int main(){
        std::cout << PCL_VERSION << std::endl;
        return 0;
}

save and run

g++ test.cpp
./a.out

100801 # mean successfully install pcl-1.8.1

cd ~/catkin_ws/src
git clone git@github.com:ros-perception/perception_pcl.git
cd perception_pcl/
git checkout melodic-devel 
git branch

* melodic-devel
ros2

cd ~/catkin_ws
catkin_make  # will occur error

error occured!

Project ‘pcl_conversions’ specifies ‘/usr/include/pcl-1.8’ as an include dir, which is not found. It does neither exist as an absolute directory

# an ugly way to solve it 
sudo cp -r /usr/local/include/pcl-1.8/ /usr/include/
  • errors and solutions

fatal error: unitree_legged_msgs/MotorCmd.h: No such file or directory
#include “unitree_legged_msgs/MotorCmd.h”

cd ~/catkin_ws
catkin_make --only-pkg-with-deps unitree_legged_msgs

error: ‘find_if’ was not declared in this scope

vim src/unitree_ros/realsense-ros/realsense2_camera/src/base_realsense_node.cpp
find_if -> std::find_if

/usr/bin/ld: cannot find -ldogController

cd src/unitree_ros/codogs_plan/src/dogCtrlAlgorithm/build/
sudo cp libdogController.so /usr/lib

catkin_make

cd ~/catkin_ws
catkin_make -DCATKIN_WHITELIST_PACKAGES=""

Other

libcurl: (51) SSL: no alternative certificate subject name matches target host name ‘api.ignitionfuel.org’

sudo gedit ~/.ignition/fuel/config.yaml

把api.ignitionfuel.org換成 fuel.ignitionrobotics.org,然後儲存退出,再開啟gazebo就不會出現之前的問題了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值