本文主要是介绍ocs2安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ocs2下载过程中,网络老是断开。
参考资料:
OCS2安装 - 知乎
OCS2安装以及Hunter双足机器人仿真环境配置 - 知乎
Installation — OCS2 1.0.0 documentation
1、学习到方法:
当前网络环境下,git clone老是出错,使用浏览器打开https://github/com/leggedrobotics/ocs2,使用download下载源码。
可以根据github网站的箭头观看文件夹包含其他链接,需要单独下载。有个箭头图标
2、使用github上的issues去查找编译的问题
3、 编译时如果ocs2_doc、ocs2_perceptive_anymal文件夹报错,可删除后再编译,有些东西实在编译不过,就删除源码(主要是doc、exam不是必须的。)否则,需要查看git 的版本。可能需要更新到最新。
一:创建工作空间并克隆OCS2
mkdir -p ~/ocs2_ws/src
cd ~/ocs2_ws/src
git clone https://github.com/leggedrobotics/ocs2.git
二:安装相关依赖包和依赖库
- C++ compiler with C++11 support
- Eigen (v3.3)
sudo apt-get update
sudo apt-get install libeigen3-dev
- Boost C++ (v1.71)
1.从 Boost 的官方网站下载 1.71.0 版本的源代码压缩包,并解压到适当的目录
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
2.进入解压后的目录,并开始准备构建 Boost
cd boost_1_71_0
./bootstrap.sh
3.安装 Boost
sudo ./b2 install
- GLPK
sudo apt install libglpk-dev
- catkin
sudo apt-get install catkin
- pybind11_catkin, ROS package, installable via
sudo apt install ros-noetic-pybind11-catkin
- catkin-pkg package for python3. Install with
sudo apt install python3-catkin-tools
- Doxygen for documentation. Install with
sudo apt install doxygen doxygen-latex
- rqt_multiplot. Install with
sudo apt-get install ros-noetic-rqt-multiplot
- Grid Map. Install with
sudo apt install ros-noetic-grid-map
- Pinocchio and HPP-FCL
cd ~/ocs2_ws/src
# Clone pinocchio
git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git
# Clone hpp-fcl
git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git
# install dependencies
sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev
- ocs2_robotic_assets
cd ~/ocs2_ws/src
# Clone ocs2_robotic_assets
git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git
- RaiSim
1.克隆RaiSim
cd ~/ocs2_ws/src
git clone https://github.com/raisimTech/raisimLib.git
2.将以下行添加到 ~/.bashrc 文件中
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/ocs2_ws/src/raisim/linux/lib
export PYTHONPATH=$PYTHONPATH:~/ocs2_ws/src/raisim/linux/lib
- ONNX Runtime
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
mkdir -p ~/.local/bin ~/.local/include/onnxruntime ~/.local/lib ~/.local/share/cmake/onnxruntime
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
rsync -a ~/ocs2_ws/src/ocs2/ocs2_mpcnet/ocs2_mpcnet_core/misc/onnxruntime/cmake/ ~/.local/share/cmake/onnxruntime
tips:暂时不需要Virtual environments
三:编译并测试
编译
cd ~/ocs2_ws
catkin init
catkin config --extend /opt/ros/noetic
catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo
catkin build
source环境
source ~/ocs2_ws/devel/setup.bash
测试
roslaunch ocs2_legged_robot_ros legged_robot_ddp.launch
Tips
- 若编译过程中出现因网络原因下载失败的库,可自行下载后放在src文件夹中后再次编译
- 编译时如果ocs2_doc、ocs2_perceptive_anymal文件夹报错,可删除后再编译
这篇关于ocs2安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!