Cartographer-slam

 下载依赖包

谷歌开发的地图绘制软件包支持0.2.0版本的ROS1 Kinetic。因此,如果你需要在Kinetic上使用Cartogrpher,你应该下载并构建如下的源代码,而不是安装二进制软件包。有关更详细的安装说明,请参阅官方wiki页面。

Kinetic

sudo apt-get install ninja-build libceres-dev libprotobuf-dev protobuf-compiler libprotoc-dev
cd ~/catkin_ws/src
git clone https://gitee.com/kay2020/cartographer.git
git clone https://gitee.com/kay2020/cartographer_ros.git
cd ~/catkin_ws
src/cartographer/scripts/install_proto3.sh
rm -rf protobuf/
rosdep install --from-paths src --ignore-src -r -y --os=ubuntu:xenial
catkin_make_isolated --install --use-ninja

 

注意proto3版本

 

 

 

 

melodic

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build stow
mkdir ~/catkin_ws && cd ~/catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=melodic -y
src/cartographer/scripts/install_abseil.sh
catkin_make_isolated --install --use-ninja

  

安装cartographer,找不到 "absl" 解决方法

sudo apt-get install stow
sudo chmod +x ~/catkin_ws/src/cartographer/scripts/install_abseil.sh
cd ~/catkin_ws/src/cartographer/scripts
./install_abseil.sh

  

 

 

 

 启动Cartographer SLAM节点

source ~/catkin_ws/install_isolated/setup.bash
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=cartographer

  

 

验证您的包

Cartographer ROS 提供了一个名为cartographer_rosbag_validate自动分析包中数据的工具。在尝试调整 Cartographer 以获取不正确的数据之前,运行此工具通常是一个好主意。

它得益于 Cartographer 作者的经验,可以检测出包包中常见的各种错误。例如,如果sensor_msgs/Imu检测到一个主题,该工具将确保重力矢量没有从 IMU 测量中删除,因为 Cartographer 使用重力范数来确定地面的方向。

该工具还可以提供有关如何提高数据质量的提示。例如,对于 Velodyne LIDAR,建议sensor_msgs/PointCloud2传感器发送的每个 UDP 数据包发送一条消息,而不是每圈发送一条消息。有了这个粒度,Cartographer 就能够解开由机器人运动引起的点云变形,从而实现更好的重建。

如果您已经source Cartographer ROS 环境,您可以像这样简单地运行该工具:

cartographer_rosbag_validate -bag_filename your_bag.bag

  

测试

rosbag record /imu /odom /tf /tf_static /scan -O cart3.bag

  

rosrun cartographer_ros cartographer_rosbag_validate -bag_filename cart3.bag

  

 

 

参考

https://google-cartographer-ros.readthedocs.io/en/latest/#building-installation

https://blog.csdn.net/weixin_44684139/article/details/104708387

https://www.cnblogs.com/gary-guo/p/10419630.html

https://blog.csdn.net/learning_tortosie/article/details/105158858

https://blog.csdn.net/weixin_43262513/article/details/88256762

 

posted @ 2022-03-25 09:25  kay880  阅读(166)  评论(0编辑  收藏  举报