遇到了两三天的问题,差点就把Ubuntu20.04给卸载重新安装个18.04的Ubuntu~~
Failed to process package 'cartographer_ros' :
遇到这个问题分为两种情况
第一种
看Cmake Error上面两行 它会提示:ImportError:"…………………"No module named 'catkin_pkg'
这时在 命令行里面输入
catkin_make_isolated --install --use-ninja -DPYTHON_EXECUTABLE=/usr/bin/python2
第二种
看Cmake Error下面两行 它会提示:Could NOT find PythonInterp: Found unsuitable version"你的python版本",but required is at least "3"(found /usr/bin/python)
这时在命令行里面输入
catkin_make_isolated --install --use-ninja -DPYTHON_EXECUTABLE=/usr/bin/python3
(它提示至少python 3.0以上 如果你的python版本过低:看这里
下载python3.7.2安装包
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
新建安装路径(根据个人喜好),然后解压安装包
mkdir -p /usr/local/python3
tar -zxvf Python-3.7.2.tgz
进入解压后的路径编译,安装
cd cd Python-3.7.2
./configure --prefix=/usr/local/python3
make && make instal
编译安装成功后,修改软连接
rm /usr/bin/python
rm /usr/bin/pip
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pi
检查安装
python --version #输出版本号为3.7.2即升级成功
)
cartographer安装成功后可以通过下面代码测试
下载cartographer 例子数据包
2D数据包下载的命令如下:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
3D数据包下载的命令如下:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
launch数据包
直接执行launch语句来run数据包,可能会报错,所以通常加一句:
source install_isolated/setup.bash
launch 2D对应2D数据包:
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
launch 3D对应3D数据包:
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
运行成功后如下所示:
如果你想再次打开相应的2D或者3D模型
打开终端ctrl+alt+t
cd cartographer_ws
刷新一下环境变量
source install_isolated/setup.bash
2D的
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=//你的2D包的路径
3D的换成
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=你的3D包的路径
参考文章:
(46条消息) Linux系统Ubuntu Python2.7升级Python3.7 踩雷先锋_livre7的博客-CSDN博客
(46条消息) Ubuntu + ROS 安装Google-Cartographer建图导航测试bag_汉文修士的博客-CSDN博客