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

2023-05-16

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 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 ~/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 = true

TRAJECTORY_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-1


POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.optimize_every_n_nodes = 35
POSE_GRAPH.constraint_builder.min_score = 0.65

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

<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问题整理 - 创客智造社区

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐

  • Postman -中文版-安装教程

    一 下载 安装 Postman 下面是历史版本的下载链接地址 请把链接中的 34 版本号 34 替换为指定的版本号 xff08 根据自己的需求变更 xff09 Windows64位 xff1a https dl pstmn io downl
  • HTTP Digest authentication

    Digest authentication xff09 是一个简单的认证机制 xff0c 最初是为 HTTP 协议开发的 xff0c 因而也常叫做 HTTP 摘要 xff0c 在 RFC2671 中描述 其身份验证机制很简单 xff0c 它
  • ubuntu离线安装Gcc、G++、Make

    前期准备 xff1a 由于GCC G 43 43 Make等工具依赖项众多 xff0c 我们需要提前先把基础依赖库下载并安装 xff0c 才能安装以上工具 工具安装包或基础依赖库下载参加以下Ubuntu官网链接 xff1a xff08 注意
  • 教你轻松在Ubuntu 部署yolov5,胎儿级教程

    环境 xff1a Jetson xavier nx Ubuntu 18 04 python3 8 一 yolov5安装 git clone https codechina csdn net mirrors ultralytics yolov
  • LWIP之lwip_select函数

    代码如下 xff1a Processing exceptset is not yet implemented int lwip select int maxfdp1 fd set readset fd set writeset fd set
  • ubuntu下的c++编译

    刚开始使用ubuntu下的g 43 43 编译c 43 43 程序 xff0c 这里只是简单说以下自己的一些小小感受吧 1 环境准备 在ubuntu中要想编译c程序可以安装gcc编译器 xff0c 编译c 43 43 的话就不能使用gcc了
  • c++ vector的用法

    vector是STL的动态数组 xff0c 可以在运行中根据需要改变数组的大小 因为它以数组的形式储存 xff0c 所以它的内存空间是连续的 vector的头文件为 include lt vector gt 常用方法 xff1a 1 vec
  • 使用python将数据导出excel表格

    python可用于数据分析 xff0c 有时候获得了数据需要导出以作其他作用 本文就介绍python导出excel表格的方法 导出excel表格 xff0c python提供了两个库 xff1a xlwt xlrd 本文只讨论下大致框架 s
  • matlab制作散点图及颜色调配

    散点图也是比较常用的数据分析图 xff0c 今天来聊聊用matlab如何画一个散点图出来 xff01 在matlab中 xff0c 对应散点图的函数是scatter 参数形式为scatter 横坐标 xff0c 纵坐标 xff0c 颜色 x
  • matlab——修改图中字体

    在画图的时候 xff0c 我们可以使用xlabel命名x轴的名字 xff0c 使用ylabel命名y轴的名字 xff0c 使用legend命名变量的名字 xff0c 使用title命名图片的标题 但标题的字体 xff0c 大小都是默认的 其
  • python绘制热力图

    在python中绘制热力图大致有两种方法通过matplotlib库的imshow函数以及seaborn库的heatmap函数 xff0c 通过笔者尝试 xff0c seaborn库更加灵活 xff0c 本篇以seaborn为准 源代码如下
  • 基址寻址和变址寻址区别(白话版)

    在寻址方式里面 xff0c 基址寻址和变址寻址是比较常用的两种寻址方式 但因为两种太像了 xff0c 总是搞不清楚 上网查到的描述太过专业看起来特别吃力 写这篇 xff0c 希望能用一种通俗易懂的方式对二者做个区分 为什么总容易搞混呢 xf
  • ROS修改pkg名和node名教程

    修改pkg名 有的时候最开始起了一个功能包package名 xff0c 但后来要进行修改 修改package名 xff0c 需要改两步然后重新catkin make即可 操作如下 xff1a 再回到工作空间执行catkin make即可 参
  • ROS-TCP-Connector and ROS-TCP-Endpoint

    Unity官方提供了和ROS交互的接口 xff1a ROS TCP Connector and ROS TCP Endpoint 有了这两个Unity就能够更好的和真实机器人做交互 两个接口的实现基于ROS ros bridge xff0c
  • Python 使用can模块(记录稿)

    直接安装 xff1a pip install python can 如果报这个错 更新一下pip pip3 install upgrade pip 或者是 pip install upgrade pip 再安装wrapt pip insta
  • Android Studio报错:W/System.err: java.net.SocketException: socket failed: EPERM (Operation not permitt

    解决方案 xff1a 在AndroidManifest xml中增加 xff1a span class token operator lt span uses span class token operator span permissio
  • C++简单实现http服务端客户端传输实例

    使用本代码有两个注意事项 xff1a 代码使用到了httplib库 xff0c 需要下载然后把 h文件放到自己的目录下 httplib下载地址 xff1a https gitcode net mirrors yhirose cpp http
  • VSCODE连接vmware虚拟机

    有时候想用VSOCDE中的ssh连接虚拟机 桥接模式 的终端进行操作 xff0c 但是执行ssh命令后总是报错 xff1a Could not connect to span class token number 192 168 span
  • 字符串加密工具

    可用于密码加密 xff0c 代码上阵 xff1a package com util import java security MessageDigest import java security NoSuchAlgorithmExcepti
  • 【RPLIDAR】ubuntu18.04安装cartographer源码并使用RPLIDAR A2M8 - R4建图

    1 创建工作空间 mkdir cartographer ws cd cartographer ws wstool init src 2 下载cartographer源码包 wstool merge t src https raw githu