安装RBDL过程,记录下自己失败好多次的经历

1、官方的 rbdl-orb git 存储库可以从网址下载,下载完放到document文件夹,自建的rbdl-build也在document文件夹内

    https://github.com/ORB-HD/rbdl-orb

或者克隆(官网竟然少个字母s)

git clone --recursive https://github.com/ORB-HD/rbdl-orb
无权限用这个 sudo git clone --recursive https://github.com/ORB-HD/rbdl-orb

2、乌班图20.04,安装RBDL

1.在安装之前更新 apt 系统。打开终端并输入

  sudo apt update
  sudo apt upgrade

2.安装 git

  sudo apt install git-core

3.安装 cmake

  sudo apt install cmake

4.安装 Eigen3 RBDL 使用 Eigen3 进行高效计算 ( http://eigen.tuxfamily.org )。

  sudo apt install libeigen3-dev

5.安装 c++ 编译器

  sudo apt-get install build-essential

6.构建 RBDL

  sudo mkdir /rbdl-build  或者自己找地自建文件夹
  cd rbdl-build/ 一般不好使,自己找到这个文件夹,在文件夹内打开终端
  cmake -D CMAKE_BUILD_TYPE=Release ../rbdl-orb
  make

此时您将看到 RBDL 构建选项的完整列表。我们建议您通过构建 RBDL 来构建和运行 RBDL 的测试代码至少一次(我是个新手,就这个等号我都找了半天,官网就写了个ON ,只怪自己太菜)

RBDL_BUILD_TESTS=ON
RUN_AUTOMATIC_TESTS=ON

Linux: RBDL's documentation

安装 doxygen

sudo apt install doxygen

构建 doxygen:  在下载的rbdl-orb文件里面打开终端运行,自己下载rbdl-orb感觉比克隆要快,克隆卡的很

doxygen Doxyfile

打开rbdl-orb文件夹,里面会自动生成一个一堆文件,打开 doc/html/index.html是官网的帮助文档

来到了最最关键的问题:python绑定

我是ubuntu20.04,python版本3,安装过程如下:

1.安装依赖库

sudo apt install cython3 python3-numpy python3-scipy python3-matplotlib

2.运行这句话,-D一定要加,至于为啥我也不知道

cmake -D CMAKE_BUILD_TYPE=Release ../rbdl -D RBDL_BUILD_PYTHON_WRAPPER=ON

../rbdl代表是目录下的rbdl文件夹进行编译,如果你下载的是rbdl-orb并且没改名字,这个命令就是cmake -D CMAKE_BUILD_TYPE=Release ../rbdl-orb  (这个最重要了)

-D RBDL_BUILD_PYTHON_WRAPPER=ON,我第一次失败的原因是因为我用了这句命令(cmake -D CMAKE_BUILD_TYPE=Release ../rbdl /python),后来发现不对。RBDL_BUILD_PYTHON_WRAPPER=ON是将为 python 3 构建包装器。

简单的讲如果你和我一样,将rbdl-orb从github下载并且将文件夹rbdl-orb名字更改成rbdl,可以直接复制命令运行。(蓝色是运行终端提示的信息)

(base) tian@tian:~/Documents/rbdl-build$ cmake -D CMAKE_BUILD_TYPE=Release ../rbdl -D RBDL_BUILD_PYTHON_WRAPPER=ON
-- Found NumPy: /home/tian/miniconda3/lib/python3.9/site-packages/numpy/core/include (found version "1.21.5")
-- Found PythonInterp: python3 (found version "3.9.5")
-- Found Cython: /usr/bin/cython3  
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found version "3.8.10")
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tian/Documents/rbdl-build

运行完这句话后会在rbdl-build中生成python文件夹

3.运行sudo make install,终端提示

(base) tian@tian:~/Documents/rbdl-build$ sudo make install
[ 76%] Built target rbdl
[100%] Built target rbdl-python
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/lib/librbdl.so.3.1.3
-- Up-to-date: /usr/local/lib/librbdl.so
-- Up-to-date: /usr/local/include/rbdl/rbdl_config.h
-- Up-to-date: /usr/local/include/rbdl/Body.h
-- Up-to-date: /usr/local/include/rbdl/Constraint.h
-- Up-to-date: /usr/local/include/rbdl/Constraint_Contact.h
-- Up-to-date: /usr/local/include/rbdl/Constraint_Loop.h
-- Up-to-date: /usr/local/include/rbdl/Constraints.h
-- Up-to-date: /usr/local/include/rbdl/Dynamics.h
-- Up-to-date: /usr/local/include/rbdl/Joint.h
-- Up-to-date: /usr/local/include/rbdl/Kinematics.h
-- Up-to-date: /usr/local/include/rbdl/Logging.h
-- Up-to-date: /usr/local/include/rbdl/Model.h
-- Up-to-date: /usr/local/include/rbdl/Quaternion.h
-- Up-to-date: /usr/local/include/rbdl/SpatialAlgebraOperators.h
-- Up-to-date: /usr/local/include/rbdl/compileassert.h
-- Up-to-date: /usr/local/include/rbdl/rbdl.h
-- Up-to-date: /usr/local/include/rbdl/rbdl_eigenmath.h
-- Up-to-date: /usr/local/include/rbdl/rbdl_errors.h
-- Up-to-date: /usr/local/include/rbdl/rbdl_math.h
-- Up-to-date: /usr/local/include/rbdl/rbdl_mathutils.h
-- Up-to-date: /usr/local/include/rbdl/rbdl_utils.h
-- Up-to-date: /usr/local/lib/pkgconfig/rbdl.pc
-- Up-to-date: /usr/local/lib/cmake/RBDL/RBDLConfig.cmake

4.添加路径,以便 python 可以找到 rbdl 的 python 版本

export PYTHONPATH=$PYTHONPATH:/home/tian/Documents/rbdl-build/python

5.最最重要的一件事:关机重启才好使,别问我怎么知道的,没关机一直不好使搞了半个多小时,最后关机重启好使了。

截图如下:rbdl是从github下载的源文件,我把文件夹名称更改了,rbdl-build是我自己建的,因为命令行建文件夹不好使,剩下的步骤按照我之前写的就可以。

我是个菜鸡,仅此记录自己遇到的大坑,如果不是必须用rbdl的话,个人建议安装pinocchio,安装简单,python还挺友好,目前也能做闭环建模,但是得用c++,据说3.0版本要上线,但按照官网的速度,我猜我博士毕业也够呛能上线。祝愿各位小伙伴少遇到些坑。 

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值