ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM

2024-01-23 03:08

本文主要是介绍ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

(写在前面: 这里参考rbx书中第八章和ROS社区教程进行学习,先看社区教程)

  ===  Doing the Turtlebot Navigation   ===

ref ros wiki: http://wiki.ros.org/turtlebot_navigation/Tutorials


1. Create the Data under remote control

Referring the RBX book(8.4.2 Collecting and Recording Scan Data),
then log into the TurtleBot's laptop and run:
  $ roslaunch rbx1_bringup turtlebot_minimal_create.launch
Replace the above command with the appropriate launch file for your own robot if you have one.
Next, log into the TurtleBot using another terminal window and run the command:
  $ roslaunch rbx1_bringup fake_laser.launch
(If you have a real laser scanner, you would run its launch file here instead of the fake
laser launch file.)
Next, launch the gmapping_demo.launch launch file. You can launch this file on your desktop workstation or the robot's laptop:
  $ roslaunch rbx1_nav gmapping_demo.launch
  or follow ros wiki: exbot@my_robot1:~$ roslaunch rbx1_nav gmapping_demo.launch

Then bring up RViz with the included gmapping configuration file On_Desktop:
  $ rosrun rviz rviz -d `rospack find rbx1_nav`/gmapping.rviz
  or follow ros wiki: exbot@my_desktop:~$ roslaunch turtlebot_rviz_launchers view_navigation.launch  # I used this, cuz the above causes problem.

Next, launch a teleop node On_Desktop for either the keyboard or joystick depending on your hardware:
  $ roslaunch rbx1_nav keyboard_teleop.launch

The final step is to start recording the data to a bag file. You can create the file
anywhere you like, but there is a folder called bag_files in the rbx1_nav package for
this purpose if you want to use it:
  $ roscd rbx1_nav/bag_files

Now start the recording process:
  $ rosbag record -O my_scan_data /scan /tf

where my_scan_data can be any filename you like. The only data we need to record is
the laser scan data and the tf transforms. (Thetf transform tree includes the
transformation from the /odom frame to the/base_link or/base_footprint frame
which gives us the needed odometry data.)

You are now ready to drive the robot around the area you'd like to map. Be sure to
move the robot slowly, especially when rotating. Stay relatively close to walls and
furniture so that there is always something within range of the scanner. Finally, plan to
drive a closed loop and continue past the starting point for several meters to ensure a
good overlap between the beginning and ending scan data.

Use the Steps above can let your turtlebot move under your control and create the map of the environment.


2. Create the map simutanlously.

There are at least two ways to create the map: Recording or rePlaying the bag data file. Let's see the first here and second next section.

When you are finished driving the robot, type Ctrl-C in the rosbag terminal window
to stop the recording process. Then save the current map as follows:
  $ roscd rbx1_nav/maps
  $ rosrun map_server map_saver -f my_map

where " my_map" can be any name you like. This will save the generated map into the
current directory under the name you specified on the command line. If you look at the
contents of the rbx1_nav/maps directory, you will see two new files: my_map.pgm
which is the map image and my_map.yaml that describes the dimensions of the map. It
is this latter file that you will point to in subsequent launch files when you want to usethe map for navigation.

To view the new map, you can use any image viewer program to bring up the .pgm file
created above. For example, to use the Ubuntu eog viewer ("eye of Gnome") run the

command:
  $ roscd rbx1_nav/maps
  $ eog my_map.pgm

You can zoom the map using your scroll wheel or the +/- buttons.

Here is a video demonstrating the gmapping process using Pi Robot and a Hokuyo laser scanner: http://youtu.be/7iIDdvCXIFM

3. Create the map by bag data file.

You can also create the map from the bag data you stored during the scanning phase
above. This is a useful technique since you can try out different gmapping parameters
on the same scan data without having to drive the robot around again.
当你想调试gmapping 参数的时候,不用每次都重新跑一遍机器人。

把所有的Terminal中运行的node,launch关掉;Next, turn on simulated time by setting the use_sim_time parameter to true:
  $ rosparam set use_sim_time true

Then clear the move_base parameters and re-launch the gmapping_demo.launch file
again:
  $ rosparam delete /move_base
  $ roslaunch rbx1_nav gmapping_demo.launch
You can monitor the process in RViz using the gmapping configuration file:
  $ rosrun rviz rviz -d `rospack find rbx1_nav`/gmapping.rviz
Finally, play back your recorded data:
  $ roscd rbx1_nav/bag_files
  $ rosbag play my_scan_data.bag
You will probably have to zoom and/or pan the display to keep the entire scan area in
view.
When the rosbag file has played all the way through, you save the generated map the
same way we did with the live data:
  $ roscd rbx1_nav/maps
  $ rosrun map_server map_saver -f my_map

where "my_map" can be any name you like.

This will save the generated map into the current directory under the name you specified on the command line. If you look at the
contents of the rbx1_nav/maps directory, you will see two files: my_map.pgm which is the map image and my_map.yamlthat describes the dimensions of the map. It is this latter file that you will point to in subsequent launch files when you want to use the map
for navigation.

To view the map created, you can use any image viewer program to bring up the .pgm
file created above. For example, to use the Ubuntu eog viewer ("eye of Gnome") run
the command:
  $ roscd rbx1_nav/maps
  $ eog my_map.pgm

You can zoom the map using your scroll wheel or the +/- buttons.
NOTE: Don't forget to reset the use_sim_time parameter after you are finished map
building. Use the command:
  $ rosparam set use_sim_time false


4. Conclusion

Now that your map is saved we will learn how to use it for localization in the next section.
For additional details about gmapping, take a look at the gmapping_demo.launch file
in the rbx1_nav/launch directory.  There you will see many parameters that can be
tweaked if needed.  This particular launch file is a copied from the
turtlebot_navigation package and the folks at OSRG have already dialed in the
settings that should work for you.  To learn more about each parameter, you can check
out the gmapping Wiki page.


视频: 结构化环境中机器人导航 - Navigation with Structured Env.SLA  https://youtu.be/EwNl1cfNjt4



这篇关于ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/635055

相关文章

51单片机学习记录———定时器

文章目录 前言一、定时器介绍二、STC89C52定时器资源三、定时器框图四、定时器模式五、定时器相关寄存器六、定时器练习 前言 一个学习嵌入式的小白~ 有问题评论区或私信指出~ 提示:以下是本篇文章正文内容,下面案例可供参考 一、定时器介绍 定时器介绍:51单片机的定时器属于单片机的内部资源,其电路的连接和运转均在单片机内部完成。 定时器作用: 1.用于计数系统,可

问题:第一次世界大战的起止时间是 #其他#学习方法#微信

问题:第一次世界大战的起止时间是 A.1913 ~1918 年 B.1913 ~1918 年 C.1914 ~1918 年 D.1914 ~1919 年 参考答案如图所示

[word] word设置上标快捷键 #学习方法#其他#媒体

word设置上标快捷键 办公中,少不了使用word,这个是大家必备的软件,今天给大家分享word设置上标快捷键,希望在办公中能帮到您! 1、添加上标 在录入一些公式,或者是化学产品时,需要添加上标内容,按下快捷键Ctrl+shift++就能将需要的内容设置为上标符号。 word设置上标快捷键的方法就是以上内容了,需要的小伙伴都可以试一试呢!

Tolua使用笔记(上)

目录   1.准备工作 2.运行例子 01.HelloWorld:在C#中,创建和销毁Lua虚拟机 和 简单调用。 02.ScriptsFromFile:在C#中,对一个lua文件的执行调用 03.CallLuaFunction:在C#中,对lua函数的操作 04.AccessingLuaVariables:在C#中,对lua变量的操作 05.LuaCoroutine:在Lua中,

AssetBundle学习笔记

AssetBundle是unity自定义的资源格式,通过调用引擎的资源打包接口对资源进行打包成.assetbundle格式的资源包。本文介绍了AssetBundle的生成,使用,加载,卸载以及Unity资源更新的一个基本步骤。 目录 1.定义: 2.AssetBundle的生成: 1)设置AssetBundle包的属性——通过编辑器界面 补充:分组策略 2)调用引擎接口API

RedHat运维-Linux文本操作基础-AWK进阶

你不用整理,跟着敲一遍,有个印象,然后把它保存到本地,以后要用再去看,如果有了新东西,你自个再添加。这是我参考牛客上的shell编程专项题,只不过换成了问答的方式而已。不用背,就算是我自己亲自敲,我现在好多也记不住。 1. 输出nowcoder.txt文件第5行的内容 2. 输出nowcoder.txt文件第6行的内容 3. 输出nowcoder.txt文件第7行的内容 4. 输出nowcode

Javascript高级程序设计(第四版)--学习记录之变量、内存

原始值与引用值 原始值:简单的数据即基础数据类型,按值访问。 引用值:由多个值构成的对象即复杂数据类型,按引用访问。 动态属性 对于引用值而言,可以随时添加、修改和删除其属性和方法。 let person = new Object();person.name = 'Jason';person.age = 42;console.log(person.name,person.age);//'J

【Linux进阶】UNIX体系结构分解——操作系统,内核,shell

1.什么是操作系统? 从严格意义上说,可将操作系统定义为一种软件,它控制计算机硬件资源,提供程序运行环境。我们通常将这种软件称为内核(kerel),因为它相对较小,而且位于环境的核心。  从广义上说,操作系统包括了内核和一些其他软件,这些软件使得计算机能够发挥作用,并使计算机具有自己的特生。这里所说的其他软件包括系统实用程序(system utility)、应用程序、shell以及公用函数库等

大学湖北中医药大学法医学试题及答案,分享几个实用搜题和学习工具 #微信#学习方法#职场发展

今天分享拥有拍照搜题、文字搜题、语音搜题、多重搜题等搜题模式,可以快速查找问题解析,加深对题目答案的理解。 1.快练题 这是一个网站 找题的网站海量题库,在线搜题,快速刷题~为您提供百万优质题库,直接搜索题库名称,支持多种刷题模式:顺序练习、语音听题、本地搜题、顺序阅读、模拟考试、组卷考试、赶快下载吧! 2.彩虹搜题 这是个老公众号了 支持手写输入,截图搜题,详细步骤,解题必备

《offer来了》第二章学习笔记

1.集合 Java四种集合:List、Queue、Set和Map 1.1.List:可重复 有序的Collection ArrayList: 基于数组实现,增删慢,查询快,线程不安全 Vector: 基于数组实现,增删慢,查询快,线程安全 LinkedList: 基于双向链实现,增删快,查询慢,线程不安全 1.2.Queue:队列 ArrayBlockingQueue: