ubuntu安装OMPL机器人运动规划库

前言

随着人工智能的不断发展,OMPLAPP机器人运动规划库应用范文越来越广,普遍使用在机器人路径规划等场景当中,下面介绍ubuntu18.04安装开源运动规划库omplapp库。

一、安装方法介绍

在ubuntu上安装opml主要有以下两种方法,第一种是使用官方脚本在线安装,该方法对网速依赖较大,且容易安装失败,第二种下载官网下载源码编译安装

二、安装步骤

1.方法1

1)在以下网址源码压缩包。

下载地址:http://www.mirrorservice.org/sites/distfiles.macports.org/ompl/?C=S;O=A

ompl-1.5.0.tar.gz

omplapp-1.5.0-Source.tar.gz

install-ompl-ubuntu.sh

./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)

使用该方法安装时若没有科学上网,网速会非常慢,安装常常失败。因此可以使用下面的方法安装。

官方安装脚本install-ompl-ubuntu.sh如下所示:

#!/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
            wget -O - https://github.com/ompl/${OMPL}/archive/1.5.2.tar.gz | tar zxf -
            cd ${OMPL}-1.5.2
        else
            wget -O - https://github.com/ompl/${OMPL}/releases/download/1.5.2/${OMPL}-1.5.2-Source.tar.gz | tar zxf -
            cd $OMPL-1.5.2-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=/usr/bin/python${PYTHONV}
    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
            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

2.方法2

1、安装ubuntu所需的依赖库,个人经过安装整理安装库如下所示:

安装依赖的库:
apt-get -y install g++ cmake libboost-serialization-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-test-dev libeigen3-dev libode-devlibyaml-cpp-dev

install_python_binding_dependencies:
apt-get -y install python3-dev python3-pip libboost-python-dev libboost-numpy-dev python3-numpy 

install_app_dependencies:
sudo apt-get -y install python3-pyqt5.qtopengl  freeglut3-dev libassimp-dev python3-opengl python3-flask python3-celery libccd-dev 

sudo pip3 install -vU PyOpenGL-accelerate

sudo apt-get -y install libfcl-dev 

2、解压源码到相应操作目录,在该目录下建立编译目录:

 mkdir -p build/Release
 cd build/Release

3、使用cmake工具生成makefile

cmake ../.. -DPYTHON_EXEC=/usr/bin/python${PYTHONV}

4、根据官方安装脚本目标板卡内存小于6G使用单线程编译,个人目标板卡2G内存,编译时间大概30分钟左右

make -j 1
Make install

安装成功如下图所示:

5、检查安装是否成功

安装成功后,在ompl/build/Release/bin目录下会有很多示例,执行一下示例,能成功运行那么安装就成功了。

./demo_RigidBodyPlanning

OMPL version:

Info: RRTConnect: Space information setup was not yet called. Calling now.

Debug: RRTConnect: Planner range detected to be 1.006980

Settings for the state space 'SE3CompoundSpace0'

- state validity check resolution: 1%

- valid segment count factor: 1

- state space:


总结

我使用方法1一直没有安装成功,主要是下载速度太慢了,一直安装不成功。使用方法2手动下载安装源码和修改安装脚本终于安装成功了。方法2安装需要以下文件,我已经分享到这里:

OMPL机器人运动规划库-C文档类资源-CSDN下载

该方法并不能100%安装成功,遇到问题根据问题内容解决即可!

  • 13
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
回答: 在Ubuntu 20.04上安装OMPLPython绑定,可以按照以下步骤进行操作。首先,从官方网站下载OMPL安装脚本。然后,运行脚本来安装OMPL。在运行脚本时,可以使用不同的选项来安装不同版本的OMPLPython绑定。比如,使用"./install-ompl-ubuntu.sh"命令可以安装最新版本的OMPL但不包含Python绑定,使用"./install-ompl-ubuntu.sh --python"命令可以安装最新版本的OMPLPython绑定。如果遇到安装过程中的问题,可能需要注意一些事项,比如编译过程中需要较大的内存和swap空间,可以在编译前增加swap空间来避免报错。此外,安装脚本中使用的是系统Python而不是虚拟环境中的Python,如果希望使用虚拟环境中的Python安装OMPL,可能需要在虚拟环境中逐个安装所需的依赖,然后进行编译和更新绑定。然而,这种方式可能较为复杂且容易出错。因此,建议直接使用官方提供的安装脚本进行安装。希望这些信息对您有所帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【OMPL】1- Ubuntu 20.04安装教程](https://blog.csdn.net/weixin_45355406/article/details/127477844)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Ubuntu(16.04+20.04)安装OMPL(app+python)机器人运动规划](https://blog.csdn.net/qq_42674415/article/details/115160042)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

flypig哗啦啦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值