简单写一下吧,折腾两天多装这个。结合两天多的错误经验和这篇博客成功安装。Ubuntu20.04安装OMPL安装指南_Destinycjk的博客-CSDN博客
这篇文章可以简单看看,github上的源码已经修复了这篇博客提出的错误。
虽然最终貌似仍然有错误,但是尝试了下是可以用的,可能还存在bug,大家也可以交流怎么解决。
安装过程
1.github下载源码:omplapp源码
下载后检查源码内ompl文件夹是否空的,如果没有文件,还需要下载ompl源码,放在omplapp的目录下面。可能需要调整文件夹名称,这两个文件夹一个命名为omplapp、一个ompl,结构就是omplapp/ompl/...
2.官网的.sh安装文件可以用,但是存在问题。需要修改。将sh放在omplapp同一目录下。omplapp
(1)依赖项安装,由于前期我安装了很多次,依赖项安装好像容易网络问题出问题,后来我直接手动装了一遍,因此这里我直接注释掉了,大家按照情况自己注释。(后面附的我的sh代码是没有注释这里的)
(2)
这里sh文件原本是从github上下载的(写到这里,我尝试了下这边地址,科学上网是可以访问的,忽然不明白为什么我很多次装不上的原因了,依赖项的问题???),先不谈不修改这里能不能安装,我先记下我的思路。
这里由于自己已经从github上下载整理好了安装文件,直接注释掉wget这两行。然后将原本的‘cd ${OMPL}-1.6.0-Source ’,这里由于我是安装omplapp因此,启动sh命令包含--app,$OMPL的值为omplapp,因此上面的if下的名称我没有改变。这里只要保证和你自己前面的文件夹名称相同就行。
74行 这里 'if [ -z $APP ]; then' APP原本少一个空格。
多核加速
make -j 4 update_bindings # if you want to use the GUI or Python bindings
make -j 4 # replace "4" with the number of cores on your machine
最后贴一下我最后的sh(到最后发现人家原本的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.6.0.tar.gz | tar zxf -
cd ${OMPL}-1.6.0
else
# wget -O - https://github.com/ompl/${OMPL}/releases/download/1.6.0/${OMPL}-1.6.0-Source.tar.gz | tar zxf -
# 文件夹名称必须为omplapp
cd ${OMPL}
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 8 update_bindings
else
make -j 8 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 main 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
记完越发不清楚当初是怎么安装不成功的了。说多都是泪,浪费太多时间了。大家也可以吸取教训。
或许有一些网络原因,另外就是看了些其他博客,有的博客的方法是从其他地方离线下载安装包,而那些版本的安装包可能并没有同步最新的github修改,于是开头提到的那篇博客提出的问题也没有解决。也是一个教训,以后先多看几篇博客,简单分析下sh文件, issue回复即时的项目一定先翻issue。但是网络原因实在无解。
windows下可以参考
1.ompl+win10+vs2017规划库,安装,执行示例_windows安装ompl-CSDN博客
2.Visual Studio开源库集成器Vcpkg全教程--利用Vcpkg轻松集成开源第三方库_vcokg-CSDN博客
目前直接用vcpkg安装ompl版本为1.5.1,而且编译出的库我尝试后不能用,参考方法1可以使用。此外注意的是,23年9月后新版本的vcpkg也改成默认编译x64版本的库了,但是如果是旧版本,需要注意核对版本库。