(写在前面: 这里参考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的更多相关文章

  1. ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM - ROSMapModify - ROS地图修改

    ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM - 2 - MapModify地图修改 We can use gmapping model to genera ...

  2. ROS进阶学习笔记(10)- 搭建自己的Turtlebot(5) - Interactive Makers

    用interactive_makers控制Turtlebot移动 interactive_makers 是Willow Garage公司开发的一个虚拟控制工具,可通过鼠标在虚拟环境中的操作,完成实际机 ...

  3. ROS 进阶学习笔记(13) - Combine Subscriber and Publisher in Python, ROS

    Combine Subscriber and Publisher in Python, ROS This article will describe an example of Combining S ...

  4. ROS 进阶学习笔记(12) - Communication with ROS through USART Serial Port

    Communication with ROS through USART Serial Port We always need to communicate with ROS through seri ...

  5. Learning ROS for Robotics Programming Second Edition学习笔记(十) indigo Gazebo rviz slam navigation

    中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 moveit是书的最后一章,由于对机械臂完全不知,看不懂 ...

  6. Ext.Net学习笔记11:Ext.Net GridPanel的用法

    Ext.Net学习笔记11:Ext.Net GridPanel的用法 GridPanel是用来显示数据的表格,与ASP.NET中的GridView类似. GridPanel用法 直接看代码: < ...

  7. Learning ROS for Robotics Programming Second Edition学习笔记(三) indigo rplidar rviz slam

    中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS for Robotics Pr ...

  8. SQL反模式学习笔记11 限定列的有效值

    目标:限定列的有效值,将一列的有效字段值约束在一个固定的集合中.类似于数据字典. 反模式:在列定义上指定可选值 1. 对某一列定义一个检查约束项,这个约束不允许往列中插入或者更新任何会导致约束失败的值 ...

  9. golang学习笔记11 golang要用jetbrain的golang这个IDE工具开发才好

    golang学习笔记11   golang要用jetbrain的golang这个IDE工具开发才好  jetbrain家的全套ide都很好用,一定要dark背景风格才装B   从File-->s ...

随机推荐

  1. 基于tensorflow的MNIST手写识别

    这个例子,是学习tensorflow的人员通常会用到的,也是基本的学习曲线中的一环.我也是! 这个例子很简单,这里,就是简单的说下,不同的tensorflow版本,相关的接口函数,可能会有不一样哟.在 ...

  2. position 分层固定在屏幕某位置

    很多网站我们看到在屏幕右下角有一个,返回顶部,始终在那儿,还有些网站顶部菜单栏永远也是固定的不动,就是通过今天学习的position来做的. 在style中加入 positon:fixed;top 0 ...

  3. java 菜单 中文 乱码问题解决方案(使用idea/eclipse) swing MenuItem乱码

    java swing MenuItem乱码 2016年12月30日 13:32:08751人阅读 评论(0) 收藏 举报   用java开发一个带有托盘图标的程序, 其它模块的中文显示都是正常的,比如 ...

  4. ALGO-22_蓝桥杯_算法训练_数的划分(DP)

    问题描述 将整数n分成k份,且每份不能为空,任意两份不能相同(不考虑顺序). 例如:n=,k=,下面三种分法被认为是相同的. ,,; ,,; ,,; 问有多少种不同的分法. 输入格式 n,k 输出格式 ...

  5. C++11--随机数引擎和随机数分布<random>

    /* 随机数引擎: * 有状态的随机数发生器,生成在预定义的最大小值之间的随机数 * 不是真正的随机数--伪随机 */ int main () { std::default_random_engine ...

  6. Qt error: stray '\241' in program

    转载:iGoforward 报错的意思是c++中的产生了编译错误. 该错误是指源程序中有非法字符,需要将非法字符去掉.一般是由于编程者(不用程序员这个名词是因为这种错误太低级)使用中文输入法 或者从别 ...

  7. Apple公司Darwin流式服务器源代码分析

    当前,伴随着Internet的飞速发展,计算机网络已经进入到每一个普通人的家庭.在这个过程中,一个值得我们关注的现象是:Internet中存储和传输内容的构成已经发生了本质的改变,从传统的基于文本或少 ...

  8. bzoj5003: 与链 5004: 开锁魔法II 5005:乒乓游戏

    www.lydsy.com/JudgeOnline/upload/task.pdf 第一题题意可以转为选一个长度k的序列,每一项二进制的1的位置被下一项包含,且总和为1,考虑每个二进制位的出现位置,可 ...

  9. 【IIS错误】IIS各种错误

    IIS简介 当用户试图通过HTTP或文件传输协议(FTP)访问一台正在运行Internet信息服务 (IIS)的服务器上的内容时,IIS返回一个表示该请求的状态的数字代码.该状态代码 记录在IIS日志 ...

  10. PAT 乙级 1063 计算谱半径(20) C++版

    1063. 计算谱半径(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 在数学中,矩阵的“谱半径”是指其特 ...