ubuntu18.04 OMPL安装教程

ubuntu18.04 OMPL安装教程

参考:

https://ompl.kavrakilab.org/installation.html

http://acg.cs.tau.ac.il/projects/ompl-instruction

https://github.com/ompl/ompl/issues/808

https://www.guyuehome.com/34317

https://ompl.kavrakilab.org/installation.html

别看网上一堆教程,照着教程做80%几率装不上

前往GitHub下载文件omplomplapp,本教程用的1.5.0版本。为什么要手动去下?因为有时候你用了科学上网在终端git的时候依然会出问题

安装依赖

castxml
sudo apt-get install castxml
livccd
git clone https://github.com/danfis/libccd.git
cd libccd
cmake .
make
sudo make install
fcl
git clone https://github.com/flexible-collision-library/fcl.git -b fcl-0.5
cd fcl
cmake .
sudo -E make install
python依赖
pip install PyQt5 numpy pyplusplus pygccxml flask celery PyOpenGL PyOpenGL-accelerate
ompl_webapp依赖

https://ompl.kavrakilab.org/webapp.html

 sudo apt-get install rabbitmq-server

修改安装脚本文件

脚本文件ompl文件里有也可以去官网下载。需要注意脚本文件需要和前面下载的omplomplapp放在同一个目录

Download the OMPL installation script. First, make the script executable:

chmod u+x install-ompl-ubuntu.sh

​ Next, there are several ways to run this script:

  • ./install-ompl-ubuntu.sh will install the latest release of OMPL without Python bindings

  • ./install-ompl-ubuntu.sh --python will install the latest release of OMPL with Python bindings

  • ./install-ompl-ubuntu.sh --app will install the latest release of OMPL.app with Python bindings

  • ./install-ompl-ubuntu.sh --github will install the master branch of OMPL (this can be combined with the other flags above)

我们需要修改

wget -O - https://github.com/ompl/${OMPL}/archive/1.5.0.tar.gz | tar zxf -改为 tar zxf ${OMPL}-1.5.0.tar.gz
把 wget -O - https://github.com/ompl/${OMPL}/releases/download/1.5.0/${OMPL}-1.5.0-Source.tar.gz | tar zxf -改为tar zxf $OMPL-1.5.0-Source.tar.gz
注释掉 #git clone --recurse-submodules https://github.com/ompl/${OMPL}.git

事实上你可以对着安装脚本内容,自己手动做完脚本里面容易出错的地方,然后把自己完成了的注释掉。比如下面的脚本我注释掉了不少我已经安装了的内容

#!/bin/bash

set -e

if [ `id -u` == 0 ]; then
    SUDO=
    export DEBIAN_FRONTEND=noninteractive
    apt-get -y install lsb-release
else
    SUDO="sudo -H"
fi

ubuntu_version=`lsb_release -rs | sed 's/\.//'`

install_common_dependencies()
{
    # install most dependencies via apt-get
    #${SUDO} apt-get -y update
    #${SUDO} apt-get -y upgrade
    # We explicitly set the C++ compiler to g++, the default GNU g++ compiler. This is
    # needed because we depend on system-installed libraries built with g++ and linked
    # against libstdc++. In case `c++` corresponds to `clang++`, code will not build, even
    # if we would pass the flag `-stdlib=libstdc++` to `clang++`.
    ${SUDO} apt-get -y install g++ cmake pkg-config libboost-serialization-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-test-dev libeigen3-dev libode-dev wget libyaml-cpp-dev
    export CXX=g++
    export MAKEFLAGS="-j `nproc`"
}

install_python_binding_dependencies()
{
    #${SUDO} apt-get -y install python${PYTHONV}-dev python${PYTHONV}-pip
    # install additional python dependencies via pip
    #${SUDO} pip${PYTHONV} install -vU https://github.com/CastXML/pygccxml/archive/develop.zip pyplusplus
    # install castxml
    if [[ $ubuntu_version > 1910 ]]; then
        ${SUDO} apt-get -y install castxml
    else
        wget -q -O- https://data.kitware.com/api/v1/file/5e8b740d2660cbefba944189/download | tar zxf - -C ${HOME}
        export PATH=${HOME}/castxml/bin:${PATH}
    fi
    ${SUDO} apt-get -y install libboost-python-dev
    if [[ $ubuntu_version > 1710 ]]; then
        ${SUDO} apt-get -y install libboost-numpy-dev python${PYTHONV}-numpy
    fi
    if [[ $ubuntu_version > 1904 ]]; then
        ${SUDO} apt-get -y install pypy3
    fi
}

install_app_dependencies()
{
    ${SUDO} apt-get -y install python${PYTHONV}-pyqt5.qtopengl freeglut3-dev libassimp-dev python${PYTHONV}-opengl python${PYTHONV}-flask python${PYTHONV}-celery libccd-dev
    # install additional python dependencies via pip
    #${SUDO} pip${PYTHONV} install -vU PyOpenGL-accelerate
    # install fcl
    if ! pkg-config --atleast-version=0.5.0 fcl; then
        if [[ $ubuntu_version > 1604 ]]; then
            ${SUDO} apt-get -y install libfcl-dev
        else
            wget -O - https://github.com/flexible-collision-library/fcl/archive/0.6.1.tar.gz | tar zxf -
            cd fcl-0.6.1; cmake .; ${SUDO} -E make install; cd ..
        fi
    fi
}

install_ompl()
{
    if [ -z $APP ]; then
        OMPL="ompl"
    else
        OMPL="omplapp"
    fi
    if [ -z $GITHUB ]; then
        if [ -z $APP]; then
            tar zxf ${OMPL}-1.5.0.tar.gz
            cd ${OMPL}-1.5.0
        else
            tar zxf $OMPL-1.5.0-Source.tar.gz
            cd $OMPL-1.5.0-Source
        fi
    else
        ${SUDO} apt-get -y install git
        #git clone --recurse-submodules https://github.com/ompl/${OMPL}.git
        cd $OMPL
    fi
    mkdir -p build/Release
    cd build/Release
    cmake ../.. -DPYTHON_EXEC=/home/kouguozhao/.conda/envs/ompl/bin/python
    if [ ! -z $PYTHON ]; then
        # Check if the total memory is less than 6GB.
        if [ `cat /proc/meminfo | head -1 | awk '{print $2}'` -lt 6291456 ]; then
            echo "Python binding generation is very memory intensive. At least 6GB of RAM is recommended."
            echo "Proceeding with binding generation using 1 core..."
            make -j 1 update_bindings
        else
            echo "123"
            make update_bindings
        fi
    fi
    make
    ${SUDO} make install
}

for i in "$@"
do
case $i in
    -a|--app)
        APP=1
        PYTHON=1
        shift
        ;;
    -p|--python)
        PYTHON=1
        shift
        ;;
    -g|--github)
        GITHUB=1
        shift
        ;;
    *)
        # unknown option -> show help
        echo "Usage: `basename $0` [-p] [-a]"
        echo "  -p: enable Python bindings"
        echo "  -a: enable OMPL.app (implies '-p')"
        echo "  -g: install latest commit from master branch on GitHub"
    ;;
esac
done

# the default version of Python in 17.10 and above is version 3
if [[ $ubuntu_version > 1704 ]]; then
    PYTHONV=3
fi

install_common_dependencies
if [ ! -z $PYTHON ]; then
    install_python_binding_dependencies
fi
if [ ! -z $APP ]; then
    install_app_dependencies
fi
install_ompl

特别注意一这一行

cmake ../.. -DPYTHON_EXEC=/home/kouguozhao/.conda/envs/ompl/bin/python

官方脚本-DPYTHON_EXEC是设置的系统默认python路径,这里我改成了自己的,因为我用的anaconda管理python环境。

执行脚本

特别提醒:编译过程比较耗内存,请确保有足够内存,最好16g,并设置较大的swap空间,我的电脑16g的内存,中途因为爆内存编译失败
选择你需要的

  • ./install-ompl-ubuntu.sh will install the latest release of OMPL without Python bindings

  • ./install-ompl-ubuntu.sh --python will install the latest release of OMPL with Python bindings

  • ./install-ompl-ubuntu.sh --app will install the latest release of OMPL.app with Python bindings

  • ./install-ompl-ubuntu.sh --github will install the master branch of OMPL (this can be combined with the other flags above)

测试安装结果

c++测试

运行ompl-1.5.0-Source/build/Release/bin目录下的demo_RigidBodyPlanning,如果正常打印结果则c++的库已经编好

python绑定测试

在这里插入图片描述

先确保omplapp-1.5.0-Source/build/Release/lib目录下上面两个文件是否编译成功,否则python会出如下问题

No module named _util
No module named _base

运行omplapp-1.5.0-Source/demos/SE3RigidBodyPlanning目录下的SE3RigidBodyPlanning.py,如果正常打印结果则python绑定也弄好了

一些安装过程中的错误

werkzeug
If you want to use the benchmarking facilities of ompl_webapp,
run the "plannerarena" command as well.
Matplotlib or Numpy was not found; disabling plotting capabilities...
Matplotlib or Numpy was not found; disabling plotting capabilities...
Traceback (most recent call last):
  File "./omplweb.py", line 47, in <module>
    from werkzeug import secure_filename

修改:omplweb.py第47行from werkzeug import secure_filename

from werkzeug.utils import secure_filename
# from werkzeug.datastructures import  FileStorage
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
1. 博客园_首页 四月 5 2. CppLive 编程在线 十二月 16, 2012 3. CSDN博客推荐文章 四月 5 4. Linux公社 - Linux系统门户网站 四月 5 5. 小众软件 - Appinn 四月 5 6. 天朝娱乐 | 每天开心一下! 四月 5 7. CSDN版主推荐 四月 4 8. CSDN论坛热帖 四月 5 9. iPc.me 四月 5 10. Ubuntusoft 四月 2 11. 果壳网 guokr.com 四月 5 12. 异次元软件世界 四月 4 13. 月光博客 四月 2 14. cnBeta.COM 四月 5 15. 萝卜网 四月 5 16. Adoo's blog 十二月 24, 2012 17. The Verge - All Posts 四月 5 18. 谷奥聚合 四月 4 19. LiveSino 中文版 四月 5 20. Solidot 四月 5 21. Zono's Multiidea 六月 29, 2012 22. 李开复的微博 四月 5 23. 《犯贱报》 六月 23, 2011 24. IM贺昌 三月 23 25. Wow! Ubuntu 三月 28 26. 煎蛋 四月 5 27. IT偏见录——陈佼的blog 十二月 5, 2007 28. Joel on Software 四月 2 29. Lifehacker 四月 4 30. 柴静 四月 4 31. 大眼仔~旭 四月 4 32. 糗事百科 四月 4 33. 网易头条新闻 四月 5 34. Engadget 中国版 四月 4 35. Joyloft-Zenzen的酒楼 一月 7 36. 韩寒 二月 27 37. 老徐 十一月 12, 2010 38. 有意思吧 四月 5 39. 知乎每日精选 四月 5 40. 36氪 | 关注互联网创业 四月 5 41. Engadget 中国版 - 非看不可 三月 8 42. FT中文网 四月 3 43. FT中文网 - 双语阅读 四月 2 44. IE浏览器中文网站 四月 5 45. IT时报网站 四月 5 46. keepwalking 三月 15 47. 爱范儿 · Beats of Bits 四月 5 48. 道招 三月 20 49. 互联网的那点事 四月 3 50. 极客公园-GeekPark 四月 4 51. 刘韧Blog 十月 10, 2008 52. 善用佳软 四月 1 53. 树洞 八月 6, 2012 54. 天涯海阁|Web2.0Share 四月 4 55. 鲜果日志 九月 27, 2012 56. 一五一十部落头条 四月 3 57. 一五一十最新文章 四月 3 58. 酷壳 - CoolShell.cn 三月 23

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值