本文主要是介绍ROS cartographer的安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ROS cartographer的安装与一些坑
安装前先检查是否安装过了proto,执行
protoc --version
看看有没有,有的话可能会报错
根据官方文档开始安装
# Install wstool and rosdep.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build# Create a new workspace in 'catkin_ws'.
mkdir catkin_ws
cd catkin_ws
wstool init src
这两步一般都没什么问题
这一步可能会因为网络不行报错,建议翻一下
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
# Install proto3.
src/cartographer/scripts/install_proto3.sh
如果前面检查发现安装了protoc2,请对proto3建立一个软连接。
sudo mv /usr/bin/protoc /usr/bin/protoc.bk
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc
下面的老问题选手了,可以不执行
# Install deb dependencies.
# The command 'sudo rosdep init' will print an error if you have already
# executed it since installing ROS. This error can be ignored.
sudo rosdep init
rosdep update
# Build and install.
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
这一步可能会提示找不到absl
,报错如下
-- Found GMock: gmock_main;-lpthread
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.cmakeAdd 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.
碰到了可以按如下方式解决
sudo apt-get install stow
sudo chmod +x ~/carto_ws/src/cartographer/scripts/install_abseil.sh
cd ~/carto_ws/src/cartographer/scripts
./install_abseil.sh
然后再执行剩下的命令
最后是跑示例
# Download the 2D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag# Launch the 2D backpack demo.
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag# Download the 3D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag# Launch the 3D backpack demo.
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
可能会报错Error reading from file: wanted 4 bytes, read 0 bytes
原因是录制bag包后可能没有正确结束掉程序,回放出现错误,解决办法如下,修复包就行了
rosbag reindex xxx-xxx-xxx.bag
这篇关于ROS cartographer的安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!