一、完整安装过程!(建议在安装过程中连接手机热点或通过蓝牙上网!)
本文借鉴了几个博主的内容,原文连接放到了最后!
1、安装工具
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
2、初始化工作空间
mkdir -p cart_ws/src
cd cart_ws
wstool init src
3、下载安装包
方法一:不太建议,可以试试,我有的时候会成功,有的时候会失败。
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
如果成功安装的话会在 cart_ws/src/目录下又三个文件分别为:
cartographer, cartographer_ros,ceres-solver;
如果失败的话,请在此目录下ctrl+h,会显示一个.rosinstall的文件,打开它
把里面的内容改成:
- git:
local-name: cartographer
uri: https://github.com/googlecartographer/cartographer.git
version: 1.0.0
- git:
local-name: cartographer_ros
uri: https://github.com/googlecartographer/cartographer_ros.git
version: 1.0.0
- git:
local-name: ceres-solver
uri: https://github.com/ceres-solver/ceres-solver.git
version: 1.13.0
改完后重新执行第三步一般来说就会成功出现上述三个文件;
方法二:直接从Github下载这三个文件的压缩包,然后解压放到src目录下;
三个连接分别为:https://github.com/cartographer-project/cartographer
https://github.com/cartographer-project/cartographer_ros
GitHub - ceres-solver/ceres-solver: A large scale non-linear optimization library
4、添加依赖
src/cartographer/scripts/install_abseil.sh
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
补充:执行最后一步时报错:
WARNING: given --rosdistro but ROS_DISTRO is "melodic". Ignoring environment.
WARNING: ROS_PYTHON_VERSION is unset. Defaulting to 3
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
cartographer: [libabsl-dev] defined as "not available" for OS version [bionic]
修改为:
rosdep install --from-paths ~/cart_ws/src --ignore-src -r
补充:执行完这一步报错:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
cartographer: [libabsl-dev] defined as "not available" for OS version [bionic]
修改:
1、cd cart_ws/src/cartographer
2、sudo gedit package.xml
3、删除<depend>libabsl-dev</depend>
4、cd cart_ws/src/cartographer/scripts
5、./install_abseil.sh
————————————————
版权声明:本文为CSDN博主「风穗子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_61132763/article/details/125756208
第二行执行可能出错,跳过就好;
安装install_abseil.sh
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git checkout d902eb869bcfacc1bad14933ed9af4bed006d481
mkdir build
cd build
cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \ ..
ninja
sudo ninja install
sudo apt-get install stow安装stow
cd /usr/local/stow
sudo stow absl
5、编译安装
catkin_make_isolated --install --use-ninja
注意这里可能会报错!
我抱错的内容是
CMake Error at CMakeLists.txt:32 (find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.
解决方法步骤:
1.sudo apt-get install stow
2.进入你建的工作空间下的src目录下的cartographer下的scripts:sudo chmod +x install_abseil.sh
3. ./install_abseil.sh
然后重新编译就成功了!
6、配置环境变量
echo 'source ~/cat_ws/install_isolated/setup.bash' >> ~/.bashrc
source ~/.bashrc
7、下载官方3Ddemo试验
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag