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

相关文章

HarmonyOS学习(七)——UI(五)常用布局总结

自适应布局 1.1、线性布局(LinearLayout) 通过线性容器Row和Column实现线性布局。Column容器内的子组件按照垂直方向排列,Row组件中的子组件按照水平方向排列。 属性说明space通过space参数设置主轴上子组件的间距,达到各子组件在排列上的等间距效果alignItems设置子组件在交叉轴上的对齐方式,且在各类尺寸屏幕上表现一致,其中交叉轴为垂直时,取值为Vert

Ilya-AI分享的他在OpenAI学习到的15个提示工程技巧

Ilya(不是本人,claude AI)在社交媒体上分享了他在OpenAI学习到的15个Prompt撰写技巧。 以下是详细的内容: 提示精确化:在编写提示时,力求表达清晰准确。清楚地阐述任务需求和概念定义至关重要。例:不用"分析文本",而用"判断这段话的情感倾向:积极、消极还是中性"。 快速迭代:善于快速连续调整提示。熟练的提示工程师能够灵活地进行多轮优化。例:从"总结文章"到"用

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

无人叉车3d激光slam多房间建图定位异常处理方案-墙体画线地图切分方案

墙体画线地图切分方案 针对问题:墙体两侧特征混淆误匹配,导致建图和定位偏差,表现为过门跳变、外月台走歪等 ·解决思路:预期的根治方案IGICP需要较长时间完成上线,先使用切分地图的工程化方案,即墙体两侧切分为不同地图,在某一侧只使用该侧地图进行定位 方案思路 切分原理:切分地图基于关键帧位置,而非点云。 理论基础:光照是直线的,一帧点云必定只能照射到墙的一侧,无法同时照到两侧实践考虑:关

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

Java进阶13讲__第12讲_1/2

多线程、线程池 1.  线程概念 1.1  什么是线程 1.2  线程的好处 2.   创建线程的三种方式 注意事项 2.1  继承Thread类 2.1.1 认识  2.1.2  编码实现  package cn.hdc.oop10.Thread;import org.slf4j.Logger;import org.slf4j.LoggerFactory

学习hash总结

2014/1/29/   最近刚开始学hash,名字很陌生,但是hash的思想却很熟悉,以前早就做过此类的题,但是不知道这就是hash思想而已,说白了hash就是一个映射,往往灵活利用数组的下标来实现算法,hash的作用:1、判重;2、统计次数;

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss

【学习笔记】 陈强-机器学习-Python-Ch15 人工神经网络(1)sklearn

系列文章目录 监督学习:参数方法 【学习笔记】 陈强-机器学习-Python-Ch4 线性回归 【学习笔记】 陈强-机器学习-Python-Ch5 逻辑回归 【课后题练习】 陈强-机器学习-Python-Ch5 逻辑回归(SAheart.csv) 【学习笔记】 陈强-机器学习-Python-Ch6 多项逻辑回归 【学习笔记 及 课后题练习】 陈强-机器学习-Python-Ch7 判别分析 【学