1、创建工作空间

mkdir cartographer_ws
cd cartographer_ws
wstool init src

2、下载cartographer源码包

wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src

第一步是下载cartographer源码,总共有三个文件夹,国内的话第三个包 ceres-solver的网址会招到拦截所以会下载失败,此时的解决办法为:从github网址下载后,将其放入到工作空间,三个包可以直接打开网络下载放进src工作区间,自己下载完放进去的可以不用执行第二步

参考网址:

cartographer_ros

cartographer

ceres-solver

3、安装依赖的ROS包

src/cartographer/scripts/install_proto3.sh
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=melodic -y -i -r

        如果安装ROS的时候执行过'sudo rosdep init',那么这里会报错,报错可以忽略

4、安装abseil-cpp librar

src/cartographer/scripts/install_abseil.sh

5、编译并安装

catkin_make_isolated --install --use-ninja

由于编译的内容比较大,首次编译会比较慢,耐心等待即可,正常情况下可以编译,如果abseil安装没有成功会报错:

CMake Error at CMakeLists.txt:32 (find_package):By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project hasasked CMake to find a package configuration file provided by "absl", butCMake did not find one.Could not find a package configuration file provided by "absl" with any ofthe following names:abslConfig.cmakeabsl-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 beeninstalled.

此时解决步骤如下:

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

编译完成过后把环境变量写进.bashrc方便以后运行

sudo gedit ~/.bashrc

在.bashrc中添加环境变量

source /home/gongmeifang/cartographer_ws/install_isolated/setup.bash

刷新使环境变量生效后 关闭所有终端

source ~/.bashrc

6、修改revo_lds.lua文件

修改cartographer下的文件,文件路径:cartographer_ws/src/cartographer_ros/cartographer_ros/configuration_files/revo_lds.lua

只需要修改以下两句里面的horizontal_laser_link,改成自己激光雷达的frame_id,修改为laser即可,一般都是laser,其余的不要动。

tracking_frame = "horizontal_laser_link",
published_frame = "horizontal_laser_link",

修改后的文件代码如下:

-- Copyright 2016 The Cartographer Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.include "map_builder.lua"
include "trajectory_builder.lua"options = {map_builder = MAP_BUILDER,trajectory_builder = TRAJECTORY_BUILDER,map_frame = "map",tracking_frame = "laser",published_frame = "laser",odom_frame = "odom",provide_odom_frame = true,publish_frame_projected_to_2d = false,use_pose_extrapolator = true,use_odometry = false,use_nav_sat = false,use_landmarks = false,num_laser_scans = 1,num_multi_echo_laser_scans = 0,num_subdivisions_per_laser_scan = 1,num_point_clouds = 0,lookup_transform_timeout_sec = 0.2,submap_publish_period_sec = 0.3,pose_publish_period_sec = 5e-3,trajectory_publish_period_sec = 30e-3,rangefinder_sampling_ratio = 1.,odometry_sampling_ratio = 1.,fixed_frame_pose_sampling_ratio = 1.,imu_sampling_ratio = 1.,landmarks_sampling_ratio = 1.,
}MAP_BUILDER.use_trajectory_builder_2d = trueTRAJECTORY_BUILDER_2D.submaps.num_range_data = 35
TRAJECTORY_BUILDER_2D.min_range = 0.3
TRAJECTORY_BUILDER_2D.max_range = 8.
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.optimize_every_n_nodes = 35
POSE_GRAPH.constraint_builder.min_score = 0.65return options

7、修改demo_revo_lds.launch文件

修改cartographer下的文件,文件路径:cartographer_ws/src/cartographer_ros/cartographer_ros/launch/demo_revo_lds.launch文件。打开demo_revo_lds.launch并修改代码如下:

<!--Copyright 2016 The Cartographer AuthorsLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
--><launch><param name="/use_sim_time" value="true" /><node name="cartographer_node" pkg="cartographer_ros"type="cartographer_node" args="-configuration_directory $(find cartographer_ros)/configuration_files-configuration_basename revo_lds.lua"output="screen"><remap from="scan" to="scan" /></node><node name="rviz" pkg="rviz" type="rviz" required="true"args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />"
</launch>

修改完之后,回到cartographer_ws 目录下再次编译

catkin_make_isolated --install --use-ninja

8、启动测试

首先运行激光雷达节点launch文件

roslaunch rplidar_ros rplidar.launch

运行cartographer框架

roslaunch cartographer_ros demo_revo_lds.launch

运行正常将打开rviz,并且显示正常,如下

参考:

Ubuntu 16.04 ROS Kinetic安装Cartographer 及使用RPLIDAR A2建图测试_苏沛东的博客-CSDN博客

Ubuntu1804上源码安装cartographer问题整理 - 创客智造社区

【RPLIDAR】ubuntu18.04安装cartographer源码并使用RPLIDAR A2M8 - R4建图相关推荐

  1. Ubuntu18.04搭建Android源码编译环境

    一.前言 使用Ubuntu18.04搭建Android源码的编译,本文是参考Android系统源码编译文章撰写的. 二.步骤 1.下载Android源码.Ubuntu环境搭建.git安装请参考其他文章 ...

  2. 源码编译Ros, Ubuntu18.04系统使用源码编译Ros1,出错集合及其解决办法

    官方的介绍http://wiki.ros.org/kinetic/Installation中提到了,脚本安装的方法it is available for Ubuntu Wily (15.10) and ...

  3. win10+ubuntu18.04搭建Android源码编译环境

    一.基本配置 本机硬件配置:cpu 4.0GHZ  6核12线程)+ RAM 32g ddr4 + 512G SSD(机械硬盘也行) 操作系统/软件环境配置:win10+VMware 16 + ubu ...

  4. Ubuntu18.04编译Android源码openssl版本过高

    报错:*FAILED:/bin/bash -c "(rm -rf out/target/product/FJDEV061/signed )报错原因:Ubuntu18.04的openssl1. ...

  5. Ubuntu18.04版本——netfilter源码分析

    网上一些netfilter的例子比较老,而netfliter新版本中有很多东西改动较大,例如hook函数的定义原型完全不一样,这里记录一下18.04的代码. 对应内核源码<uapi/linux/ ...

  6. 多激光雷达外参标定算法与源码解析(一):基于BLAM的建图模块

    前言 原理文字介绍略微简介,但是在代码注释中非常详细.我相信在代码中学习原理才能理解更加通透. 代码参考自livox sdk: gitcode 一.算法原理 二.源码解析 函数流:main->B ...

  7. (02)Cartographer源码无死角解析-(01) 环境搭建,demo运行,ROS一键安装_清除各种疑难杂症

    讲解关于slam一系列文章汇总链接:史上最全slam从零开始,针对于本栏目讲解(02)Cartographer源码无死角解析链接如下: (02)Cartographer源码无死角解析-(00)目录_最 ...

  8. drcom linux最新版,Ubuntu高于8.04版本的源码安装drcom

    Ubuntu高于8.04版本的源码安装drcom注意点,这里借用别个的,我的早安装好了,为了方便记忆,把别人的copy过来,方便找用源码安装drcom时候,make报错,9.10和10.04都此问题. ...

  9. (02)Cartographer源码无死角解析-(04) 熟悉bag文件,配置.launch与.lua文件,初步调参

    讲解关于slam一系列文章汇总链接:史上最全slam从零开始,针对于本栏目讲解(02)Cartographer源码无死角解析-链接如下: (02)Cartographer源码无死角解析- (00)目录 ...

最新文章

  1. 通过三个直观步骤理解ROC曲线
  2. Oracle 与SQL Server 2000常用函数对照 [摘抄]
  3. java for index_Java增强for循环中获取index
  4. 认清楚服务器的真正身份--深入ARP工作原理
  5. 数据分片排序oracle,Oracle数据库的优化
  6. ICML2021|超越SE、CBAM,中山大学开源SAM:无参Attention!
  7. C++实现桶排序——十大经典排序算法之九【GIF动画+完整代码+详细注释】
  8. c语言中外部变量的使用方法,C语言外部变量的使用以及erxtern的用法
  9. Oracle 数据怎么实时同步到 MySQL | 亲测干货分享建议收藏
  10. a = 3 中3在栈还是堆_阳台要不要装推拉门?纠结3次后还是装错了,返工中
  11. python transform(img)_pytorch之ImageFolder使用详解
  12. 【电路仿真】基于matlab Simulink光伏电池仿真模型【含Matlab源码 486期】
  13. Mac大文件分包split与合并cat,加密压缩zip
  14. 华为电脑管家最新(11.1.1.95)版安装教程(适合 未安装| 补充说明)
  15. Winclone快速安装苹果电脑双系统教程
  16. 区块链学习笔记20——权益证明
  17. Springboot实现remember-me记住我功能
  18. #二维差分# [ssloj 1467] U
  19. jzoj6366. 【NOIP2019模拟2019.9.25】化学(chem)
  20. 那个男人他不装了,他必须硬卷!

热门文章

  1. Prometheus 基于k8s服务发现通过Cadvisor监控Kubernetes
  2. 通过实验对比十大排序算法
  3. delphi 对金额double类型向上取整,保留小数位
  4. 100个国家的数字货币政策大全
  5. 大学物理-麦克斯韦电磁理论及电磁波
  6. 给出某一个日期,用SQL分别计算日、月、季度、年下的同比环比
  7. 美国兰德公司《未来战争2030》(The Future of Warfare in 2030)系列研究报告概述(下)
  8. android json分页,移动测试之异步任务+JSON解析+ListView分页
  9. html磨砂效果,使用css制作磨砂效果
  10. R语言dplyr包的select函数和everthing函数筛选dataframe中的所有数据列(all columns of the dataframe)