GPMP2是董靖博士等人在16-17年提出的结合GTSAM因子图框架与Gaussian Processes完成motion planning的一项工作。前身源于Barfoot教授的课题组提出的STEAM(Simultaneous Trajectory Estimation and Mapping)问题及其相关工作。在提出董靖博士提出GPMP2后,borglab则不断在这个基础上延伸,包括: GPSLAM(再次回归SLAM领域), VIMP(同样是Motion Planning问题,但在GPMP2上引入变分推断Varational Inference), 以及与Learning from Demonstration相结合一些工作。
本文大致与GPMP2官方仓库中的ReadMe一致,但是为了更好地学习GPMP2, 本文集中于为使用GPMP2提供的Python接口方面的编译问题进行总结。
下载GTSAM, Ubuntu20.04直接使用最新版本(4.3a0)
git clone https://github.com/borglab/gtsam
这里我直接将gtsam安装与home目录下
安装GTSAM, 为了把GPMP2应用起来,需要先编译GTSAM的Python Wrapper。这样可以免去额外再安装wrap的步骤,参考链接为: Link
安装相关依赖:
cd ~/gtsam
pip3 install -r ~/gtsam/python/requirements.txt
安装Python-wrapper:
cmake .. -DGTSAM_BUILD_PYTHON=1 -DGTSAM_PYTHON_VERSION=3.8.10 -DGTSAM_WITH_TBB=OFF
这里我没有TBB,所以加上了这一选项.
编译与安装:
make
make python-install
执行完上面的步骤,可以进入python3中通过import gtsam查看是否安装成功。
下载GPMP2并进行安装:
下载GPMP2:
git clone https://github.com/borglab/gpmp2
第二步中只是为Python3安装GTSAM模块,为了安装GPMP2需要返回GTSAM目录内进行安装,下面是GPMP2中ReadMe部分内容:
cd gtsam
mkdir build && cd build
cmake -DGTSAM_ALLOW_DEPRECATED_SINCE_V42:=OFF .. #disable deprecated functionality for compatibility
make -j4 check # optional, run unit tests
sudo make install
添加库搜索路径到bashrc中:
echo 'export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/share:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc
启动CMake中的Python相关选项,安装GPMP2:
cd gpmp2 && mkdir build && cd build
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX:=ON ..
make -j8 # build
make python-install # install the python package
进入gpmp2/python/examples文件夹内运行:python3 Arm2FactorGraphExample.py
效果如下:


cd gtsam/build
xargs rm -rf < install_manifest.txt