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.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.

碰到了可以按如下方式解决

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
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值