Ubuntu20.04:OCS2安装

[复制链接]
发表于 6 天前 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×

环境准备

OCS2 是 leggedrobotics 开源的最优控制工具箱,依赖 C++11 编译器、Eigen 3.3、Boost 1.71、ROS Noetic 及若干机器人相关库。建议在虚拟机中预留较大磁盘空间(作者用 200G),并先装好 ROS Noetic。

一、创建工作空间并克隆 OCS2

>> mkdir -p ~/ocs2_ws/src
>> cd ~/ocs2_ws/src
>> git clone https://github.com/leggedrobotics/ocs2.git

二、安装依赖包与库

>> sudo apt-get update
>> sudo apt-get install libeigen3-dev

Boost 1.71 源码编译安装:

>> wget https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2
>> tar --bzip2 -xf boost_1_71_0.tar.bz2
>> cd boost_1_71_0
>> ./bootstrap.sh
>> sudo ./b2 install

其余依赖:

sudo apt install ros-noetic-catkin
sudo apt install libglpk-dev libglfw3-dev
sudo apt install ros-noetic-pybind11-catkin
sudo apt install python3-catkin-tools
sudo apt install doxygen doxygen-latex
sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev
sudo apt-get install ros-noetic-rqt-multiplot
sudo apt install ros-noetic-grid-map-msgs
sudo apt install ros-noetic-octomap-msgs
sudo apt install libreadline-dev
sudo apt install libcgal-dev
sudo apt update && sudo apt install checkinstall

三、安装相关子库

在 ocs2_ws/src 下克隆所需软件包(务必带指定版本,否则易报错):

git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git
git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git
git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git
git clone --depth 1 https://github.com/raisimTech/raisimLib.git -b v1.1.01
git clone https://github.com/leggedrobotics/elevation_mapping_cupy.git
git clone https://github.com/ANYbotics/grid_map.git
git clone https://github.com/leggedrobotics/ocs2.git

编译安装 Raisim:

>> cd ~/ocs2_ws/src/raisimLib
>> mkdir build
>> cd build
>> cmake ..
>> make -j4 && sudo checkinstall

安装 onnxruntime 并配置环境变量(如找不到包时手动设置):

>> cd /tmp
>> wget https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz
>> tar xf onnxruntime-linux-x64-1.7.0.tgz
>> rsync -a /tmp/onnxruntime-linux-x64-1.7.0/include/ ~/.local/include/onnxruntime
>> rsync -a /tmp/onnxruntime-linux-x64-1.7.0/lib/ ~/.local/lib
export onnxruntime_DIR=~/.local/
export LD_LIBRARY_PATH=/home/lgf/.local/lib{LD_LIBRARY_PATH}

四、编译并测试 OCS2

>> cd ~/ocs2_ws
>> catkin init
>> catkin config --extend /opt/ros/noetic
>> catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo
>> catkin build ocs2

编译很耗时且易失败,可先单独构建 elevation_mapping_cupy,失败后用 catkin clean 反复重编。完成后在 ~/.bashrc 中加入:

source ~/ocs2_ws/devel/setup.bash

测试例程:

roslaunch ocs_mobile_manipulator_ros manipulator_franka.launch

qidao123.com企服评测-应用市场 编辑提示:OCS2 依赖繁杂、编译耗时,建议在配置完成的节点先做系统快照;文中 /home/lgf 路径请替换为你自己的用户名。

回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表