ros:cartographer

本文详细介绍了如何在ROS环境中安装和配置Cartographer SLAM系统,并提供了运行示例数据和自定义数据集的步骤。从环境搭建到实际应用,涵盖安装依赖、编译源码、运行demo及自定义bag文件的全过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 安装

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
src/cartographer/scripts/install_proto3.sh
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html

2 跑cartographer提供的demo

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

运行的节点
在这里插入图片描述
运行的topic
在这里插入图片描述
/horizontal_laser_2d和/scan_matched_points2的类型如下图:
在这里插入图片描述
submap_list
在这里插入图片描述
trajactory_node_list
在这里插入图片描述
landmark_pose_list
在这里插入图片描述
constraint_list
在这里插入图片描述

tf_static
在这里插入图片描述
joint_state
在这里插入图片描述
initial_pose
在这里插入图片描述

运行的service
在这里插入图片描述
约束
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

最终地图:
在这里插入图片描述

3 跑自己的bag

4 跑实际机器人

5 算法分析

<think>好的,我现在遇到了一个错误信息:“Resource not found: cartographer_ros”。我需要解决这个问题。首先,我得理解这个错误是什么意思。Cartographer_ros应该是ROS(Robot Operating System)中的一个包,用于SLAM(同步定位与地图构建)。当系统提示找不到这个资源时,通常是因为相关的软件包没有正确安装或者环境变量没有配置好。 接下来,我应该考虑可能的原因。首先,检查是否安装了cartographer_ros。如果用户是通过源码安装的,可能需要使用catkin_make或者catkin build来编译。如果没有安装,需要按照官方文档进行安装。其次,环境变量是否正确设置,特别是ROS_PACKAGE_PATH是否包含了cartographer_ros的路径。另外,可能依赖项没有安装完全,导致编译或运行时出错。 然后,我需要一步步排查问题。第一步是确认cartographer_ros是否已经安装在系统中。可以尝试在终端中使用rospack find cartographer_ros命令,如果返回找不到,说明确实没有安装或者路径不对。如果已经通过源码安装,可能需要重新编译并source setup.bash文件。如果使用的是二进制安装,可能需要通过apt-get来安装。 第二步是检查ROS的工作空间配置。用户是否在正确的workspace下工作?是否在编译后source了devel/setup.bash?有时候,多个workspace可能导致路径冲突,需要确认当前的shell环境是否正确加载了所需的包。 第三步是检查依赖项。Cartographer可能有其他依赖的ROS包,比如protobuf、ceres-solver等,这些是否都已正确安装。如果有缺失,需要先安装这些依赖。 第四步,查看官方文档和社区资源。Cartographer的GitHub页面或者ROS Wiki上可能有具体的安装指南和常见问题解答。用户是否按照官方推荐的步骤进行安装?有没有可能漏掉了某些步骤? 另外,还需要考虑ROS的版本是否兼容。Cartographer可能只支持特定版本的ROS,比如Melodic或Noetic。用户当前的ROS版本是否符合要求?如果版本不匹配,可能需要升级或降级ROS,或者寻找对应版本的cartographer_ros。 如果以上步骤都确认无误,还是出现错误,可能需要查看更详细的日志信息。尝试重新编译并观察编译过程中的错误输出,或者在运行时启用详细日志模式,找到具体的失败原因。有时候,编译错误可能因为编译器版本不兼容,或者缺少某些头文件。 最后,如果自己无法解决,可以考虑在ROS Answers论坛或者GitHub的issue页面搜索类似的问题,看看其他开发者是如何解决的。如果找不到相关信息,可以提交一个新的issue,详细描述问题环境和重现步骤,寻求社区的帮助。 总结下来,解决这个错误需要系统性地检查安装、环境变量、依赖项、版本兼容性,以及查阅文档和社区资源。一步步排除可能的原因,最终定位到问题所在并进行修复。</think>遇到`Resource not found: cartographer_ros`错误时,通常是由于ROS系统中未正确安装或配置Cartographer相关包。以下是逐步排查和解决方案: --- ### **1. 确认Cartographer安装状态** Cartographer包含两个核心部分: - **`cartographer`**:算法库 - **`cartographer_ros`**:ROS接口包 **检查是否安装:** ```bash rospack find cartographer_ros # 若返回"Not found",说明未安装 ``` --- ### **2. 安装Cartographer** #### **方法1:二进制安装(推荐)** 适用于ROS Melodic/Noetic: ```bash sudo apt-get install ros-${ROS_DISTRO}-cartographer-ros ``` 替换`${ROS_DISTRO}`为你的ROS版本(如`melodic`、`noetic`)。 #### **方法2:源码编译安装** 若需最新版本,按官方步骤从源码编译: ```bash # 创建工作空间 mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src # 克隆仓库 git clone https://github.com/cartographer-project/cartographer_ros.git git clone https://github.com/cartographer-project/cartographer.git # 安装依赖 rosdep update rosdep install --from-paths src --ignore-src -y # 编译 catkin_make_isolated --install --use-ninja source install_isolated/setup.bash ``` --- ### **3. 配置环境变量** 确保每次打开终端时加载Cartographer: ```bash echo "source ~/catkin_ws/install_isolated/setup.bash" >> ~/.bashrc source ~/.bashrc ``` --- ### **4. 验证安装** ```bash roscd cartographer_ros # 应进入包目录 roslaunch cartographer_ros demo_backpack_2d.launch # 尝试启动示例 ``` --- ### **5. 常见问题排查** #### **问题1:依赖缺失** 若编译失败,检查是否安装以下依赖: - `protobuf` (>= 3.0.0) - `ceres-solver` (>= 1.13.0) - `libabsl-dev` 安装命令: ```bash sudo apt-get install -y libprotobuf-dev protobuf-compiler libceres-dev libabsl-dev ``` #### **问题2:ROS版本不兼容** CartographerROS版本有要求: - **Melodic**:Ubuntu 18.04 + ROS Melodic - **Noetic**:Ubuntu 20.04 + ROS Noetic 确认你的系统与ROS版本匹配。 #### **问题3:工作空间冲突** 若存在多个ROS工作空间,确保正确`source`目标工作空间的`setup.bash`。 --- ### **6. 参考资源** - **官方文档**:[Cartographer ROS Integration](https://google-cartographer-ros.readthedocs.io/) - **GitHub仓库**:[cartographer_ros](https://github.com/cartographer-project/cartographer_ros) 通过以上步骤,可解决`Resource not found: cartographer_ros`错误。若仍存在问题,建议查阅ROS社区或提交Issue。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值