[ROS]rplidar 学习笔记

本贴最后更新于 3058 天前,其中的信息可能已经斗转星移

###1.安装和运行
####1.1 安装和编译
按照下面的命令顺序依次执行:

mkdpr -p ~/rplidar_ws/src //创建工作目录 catkin_init_workspace //初始化工程 cd ~/rplidar_ws catkin_make //make工程 cd src git clone https://github.com/robopeak/rplidar_ros.git //下载rplidar的ros版本 cd rplidar_ros git fetch origin //更新代码 git checkout slam //切换slam分支 cd ../.. catkin_make //编译项目 source ./devel/setup.bash //设置环境变量

####1.2 编辑串口权限
执行:

sh ./scripts/create_udev_rules.sh //建立串口映射

注意默认的是/dev/ttyUSB0,如果不是的话需要在 rplidar.launch 文件中修改串口,对应需要修改的代码为:

<param name="serial_port" type="string" value="/dev/ttyUSB0"/>

####1.3 运行
下面的命令可选:
#####1.3.1 启动 rplidar

roslaunch rplidar_ros rplidar.launch

#####1.3.2.查看 rplidar 的数据

roslaunch rplidar_ros rplidar.launch rostopic echo /scan

可以看到类似的输出:

header: seq: 7816 stamp: secs: 1479129854 nsecs: 119316777 frame_id: laser angle_min: -3.12413907051 angle_max: 3.14159274101 angle_increment: 0.0174532923847 time_increment: 1.77664020384e-07 scan_time: 6.37813864159e-05 range_min: 0.15000000596 range_max: 6.0 ranges: [inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 2.4130001068115234, inf, 2.4839999675750732, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 6.394000053405762, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 11.430999755859375, 11.836000442504883, inf, inf, inf, inf, inf, inf, inf, 0.4020000100135803, 0.40700000524520874, inf, 0.41200000047683716, 0.4099999964237213, inf, 0.41499999165534973, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 1.2050000429153442, 1.1610000133514404, 1.1089999675750732, inf, 1.0640000104904175, 1.0240000486373901, inf, 0.9890000224113464, 0.9520000219345093, inf, 0.921999990940094, 0.8889999985694885, inf, 0.8640000224113464, 0.8659999966621399, inf, 0.8880000114440918, 0.9120000004768372, 0.9350000023841858, inf, 0.9620000123977661, 0.9919999837875366, inf, 1.0219999551773071, 1.0520000457763672, 1.0880000591278076, inf, 1.125, 1.1670000553131104, inf, 1.0540000200271606, inf, 1.0820000171661377, inf, inf, 1.652999997138977, inf, 1.0410000085830688, 1.5260000228881836, inf, inf, inf, 1.4739999771118164, inf, 1.4930000305175781, 1.5190000534057617, inf, inf, inf, 0.39399999380111694, inf, 0.4490000009536743, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 0.578000009059906, inf, 0.5799999833106995, 0.5839999914169312, inf, 0.5870000123977661, inf, inf, 1.159000039100647, inf, 1.1629999876022339, inf, 1.8530000448226929, 1.8650000095367432, 1.9509999752044678, inf, inf, inf, inf, inf, 3.2070000171661377, inf, inf, 0.7049999833106995, inf, inf, 0.3569999933242798, inf, 0.36800000071525574, 0.382999986410141, 0.39100000262260437, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 0.28999999165534973, 0.27900001406669617, inf, 0.2720000147819519, inf, 0.26600000262260437, 0.26100000739097595, 0.25600001215934753, inf, 0.25200000405311584, 0.24799999594688416, inf, inf, inf, 0.24199999868869781, inf, inf, 0.23999999463558197, 0.2409999966621399, inf, inf, 0.24300000071525574, 0.2460000067949295, 0.26100000739097595, inf, 0.2630000114440918, 0.2630000114440918, inf, 0.2549999952316284, inf, 0.2549999952316284, inf, inf, 0.25099998712539673, inf, 0.24799999594688416, inf, 0.24300000071525574, 0.24300000071525574, inf, 0.24799999594688416, inf, 0.24500000476837158, 0.24400000274181366, inf, 0.24400000274181366, 0.24500000476837158, inf, 0.2460000067949295, inf, 0.2460000067949295, inf, inf, 0.2409999966621399, 0.24199999868869781, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 1.6540000438690186, inf, inf, 1.6299999952316284, inf, 1.621999979019165, 1.621999979019165, inf, 1.6080000400543213, 1.6119999885559082, 1.6019999980926514, inf, 1.6019999980926514, 1.6019999980926514, inf, 1.6009999513626099, 1.6019999980926514, inf, 1.6030000448226929, 1.6030000448226929, 1.6139999628067017, inf, 1.6150000095367432, 1.621999979019165, inf, 1.6299999952316284, 1.6299999952316284, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf] intensities: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.0, 0.0, 47.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.0, 47.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 47.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 0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47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 47.0, 47.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

#####1.3.3.可视化 rplidar 的数据

roslaunch rplidar_ros view_rplidar.launch

#####1.3.4.hectormapping 建图

roslaunch rplidar_ros view_slam.launch

#####1.3.5.gmapping 建图
编辑 rplidar_ros/launch/view_slam.launch 文件,将 hectormapping 替换成 gmapping 文件,即是 gmapping 建图.

roslaunch rplidar_ros view_slam.launch

###2.其他相关
以上的步骤完成之后可以看到可以使用 rplidar 进行建图了。
以后需要进一步的工作包括:

1.建图中的node、topic、service,以及他们各自的作用。 2.gmapping的学习
  • ROS
    23 引用 • 2 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...

推荐标签 标签

  • API

    应用程序编程接口(Application Programming Interface)是一些预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件得以访问一组例程的能力,而又无需访问源码,或理解内部工作机制的细节。

    79 引用 • 431 回帖
  • Pipe

    Pipe 是一款小而美的开源博客平台。Pipe 有着非常活跃的社区,可将文章作为帖子推送到社区,来自社区的回帖将作为博客评论进行联动(具体细节请浏览 B3log 构思 - 分布式社区网络)。

    这是一种全新的网络社区体验,让热爱记录和分享的你不再感到孤单!

    132 引用 • 1115 回帖 • 120 关注
  • uTools

    uTools 是一个极简、插件化、跨平台的现代桌面软件。通过自由选配丰富的插件,打造你得心应手的工具集合。

    7 引用 • 27 回帖
  • 倾城之链
    23 引用 • 66 回帖 • 160 关注
  • Caddy

    Caddy 是一款默认自动启用 HTTPS 的 HTTP/2 Web 服务器。

    12 引用 • 54 回帖 • 165 关注
  • SOHO

    为成为自由职业者在家办公而努力吧!

    7 引用 • 55 回帖 • 5 关注
  • 机器学习

    机器学习(Machine Learning)是一门多领域交叉学科,涉及概率论、统计学、逼近论、凸分析、算法复杂度理论等多门学科。专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。

    83 引用 • 37 回帖
  • Excel
    31 引用 • 28 回帖
  • 电影

    这是一个不能说的秘密。

    122 引用 • 608 回帖
  • 链滴

    链滴是一个记录生活的地方。

    记录生活,连接点滴

    171 引用 • 3842 回帖
  • Hexo

    Hexo 是一款快速、简洁且高效的博客框架,使用 Node.js 编写。

    22 引用 • 148 回帖 • 9 关注
  • Ngui

    Ngui 是一个 GUI 的排版显示引擎和跨平台的 GUI 应用程序开发框架,基于
    Node.js / OpenGL。目标是在此基础上开发 GUI 应用程序可拥有开发 WEB 应用般简单与速度同时兼顾 Native 应用程序的性能与体验。

    7 引用 • 9 回帖 • 400 关注
  • V2EX

    V2EX 是创意工作者们的社区。这里目前汇聚了超过 400,000 名主要来自互联网行业、游戏行业和媒体行业的创意工作者。V2EX 希望能够成为创意工作者们的生活和事业的一部分。

    16 引用 • 236 回帖 • 269 关注
  • RESTful

    一种软件架构设计风格而不是标准,提供了一组设计原则和约束条件,主要用于客户端和服务器交互类的软件。基于这个风格设计的软件可以更简洁,更有层次,更易于实现缓存等机制。

    30 引用 • 114 回帖 • 8 关注
  • VirtualBox

    VirtualBox 是一款开源虚拟机软件,最早由德国 Innotek 公司开发,由 Sun Microsystems 公司出品的软件,使用 Qt 编写,在 Sun 被 Oracle 收购后正式更名成 Oracle VM VirtualBox。

    10 引用 • 2 回帖 • 13 关注
  • Outlook
    1 引用 • 5 回帖
  • MyBatis

    MyBatis 本是 Apache 软件基金会 的一个开源项目 iBatis,2010 年这个项目由 Apache 软件基金会迁移到了 google code,并且改名为 MyBatis ,2013 年 11 月再次迁移到了 GitHub。

    173 引用 • 414 回帖 • 367 关注
  • Mobi.css

    Mobi.css is a lightweight, flexible CSS framework that focus on mobile.

    1 引用 • 6 回帖 • 755 关注
  • C++

    C++ 是在 C 语言的基础上开发的一种通用编程语言,应用广泛。C++ 支持多种编程范式,面向对象编程、泛型编程和过程化编程。

    107 引用 • 153 回帖
  • 智能合约

    智能合约(Smart contract)是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。智能合约概念于 1994 年由 Nick Szabo 首次提出。

    1 引用 • 11 回帖
  • C

    C 语言是一门通用计算机编程语言,应用广泛。C 语言的设计目标是提供一种能以简易的方式编译、处理低级存储器、产生少量的机器码以及不需要任何运行环境支持便能运行的编程语言。

    85 引用 • 165 回帖 • 1 关注
  • 服务

    提供一个服务绝不仅仅是简单的把硬件和软件累加在一起,它包括了服务的可靠性、服务的标准化、以及对服务的监控、维护、技术支持等。

    41 引用 • 24 回帖
  • 以太坊

    以太坊(Ethereum)并不是一个机构,而是一款能够在区块链上实现智能合约、开源的底层系统。以太坊是一个平台和一种编程语言 Solidity,使开发人员能够建立和发布下一代去中心化应用。 以太坊可以用来编程、分散、担保和交易任何事物:投票、域名、金融交易所、众筹、公司管理、合同和知识产权等等。

    34 引用 • 367 回帖 • 1 关注
  • 学习

    “梦想从学习开始,事业从实践起步” —— 习近平

    172 引用 • 516 回帖
  • HTML

    HTML5 是 HTML 下一个的主要修订版本,现在仍处于发展阶段。广义论及 HTML5 时,实际指的是包括 HTML、CSS 和 JavaScript 在内的一套技术组合。

    108 引用 • 295 回帖 • 2 关注
  • Mac

    Mac 是苹果公司自 1984 年起以“Macintosh”开始开发的个人消费型计算机,如:iMac、Mac mini、Macbook Air、Macbook Pro、Macbook、Mac Pro 等计算机。

    167 引用 • 595 回帖 • 1 关注
  • 运维

    互联网运维工作,以服务为中心,以稳定、安全、高效为三个基本点,确保公司的互联网业务能够 7×24 小时为用户提供高质量的服务。

    151 引用 • 257 回帖 • 1 关注