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

相关文章

深度解析Python装饰器常见用法与进阶技巧

《深度解析Python装饰器常见用法与进阶技巧》Python装饰器(Decorator)是提升代码可读性与复用性的强大工具,本文将深入解析Python装饰器的原理,常见用法,进阶技巧与最佳实践,希望可... 目录装饰器的基本原理函数装饰器的常见用法带参数的装饰器类装饰器与方法装饰器装饰器的嵌套与组合进阶技巧

从基础到进阶详解Pandas时间数据处理指南

《从基础到进阶详解Pandas时间数据处理指南》Pandas构建了完整的时间数据处理生态,核心由四个基础类构成,Timestamp,DatetimeIndex,Period和Timedelta,下面我... 目录1. 时间数据类型与基础操作1.1 核心时间对象体系1.2 时间数据生成技巧2. 时间索引与数据

Go学习记录之runtime包深入解析

《Go学习记录之runtime包深入解析》Go语言runtime包管理运行时环境,涵盖goroutine调度、内存分配、垃圾回收、类型信息等核心功能,:本文主要介绍Go学习记录之runtime包的... 目录前言:一、runtime包内容学习1、作用:① Goroutine和并发控制:② 垃圾回收:③ 栈和

Android学习总结之Java和kotlin区别超详细分析

《Android学习总结之Java和kotlin区别超详细分析》Java和Kotlin都是用于Android开发的编程语言,它们各自具有独特的特点和优势,:本文主要介绍Android学习总结之Ja... 目录一、空安全机制真题 1:Kotlin 如何解决 Java 的 NullPointerExceptio

重新对Java的类加载器的学习方式

《重新对Java的类加载器的学习方式》:本文主要介绍重新对Java的类加载器的学习方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、介绍1.1、简介1.2、符号引用和直接引用1、符号引用2、直接引用3、符号转直接的过程2、加载流程3、类加载的分类3.1、显示

Java学习手册之Filter和Listener使用方法

《Java学习手册之Filter和Listener使用方法》:本文主要介绍Java学习手册之Filter和Listener使用方法的相关资料,Filter是一种拦截器,可以在请求到达Servl... 目录一、Filter(过滤器)1. Filter 的工作原理2. Filter 的配置与使用二、Listen

利用Python快速搭建Markdown笔记发布系统

《利用Python快速搭建Markdown笔记发布系统》这篇文章主要为大家详细介绍了使用Python生态的成熟工具,在30分钟内搭建一个支持Markdown渲染、分类标签、全文搜索的私有化知识发布系统... 目录引言:为什么要自建知识博客一、技术选型:极简主义开发栈二、系统架构设计三、核心代码实现(分步解析

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx

MySQL进阶之路索引失效的11种情况详析

《MySQL进阶之路索引失效的11种情况详析》:本文主要介绍MySQL查询优化中的11种常见情况,包括索引的使用和优化策略,通过这些策略,开发者可以显著提升查询性能,需要的朋友可以参考下... 目录前言图示1. 使用不等式操作符(!=, <, >)2. 使用 OR 连接多个条件3. 对索引字段进行计算操作4