ROS学习手记 - 6 使用ROS中的工具:rqt_console & roslaunch & rosed

原创 2015年07月09日 09:58:21


http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch

  1. Using rqt_console and roslaunch

    This tutorial introduces ROS using rqt_console and rqt_logger_level for debugging and roslaunch for starting many nodes at once. If you use ROS fuerte or ealier distros whererqt isn't fully available, please see this page withthis page that uses old rx based tools.

         

          rqt console工具的打开:

Using rqt_console and rqt_logger_level

rqt_console attaches to ROS's logging framework to display output from nodes.rqt_logger_level allows us to change the verbosity level (DEBUG, WARN, INFO, and ERROR) of nodes as they run.

Now let's look at the turtlesim output in rqt_console and switch logger levels in rqt_logger_level as we use turtlesim. Before we start the turtlesim,in two new terminals start rqt_console andrqt_logger_level:

$ rosrun rqt_console rqt_console

$ rosrun rqt_logger_level rqt_logger_level
这里面就可以看到正在运行的node的信息,message内容等 。

logger level工具可以查看报警信息,注意logger level是有层级的,Fatal has the highest priority andDebug has the lowest. By setting the logger level, you will get all messages of that priority level or higher。

Logging levels are prioritized in the following order:

Fatal
Error
Warn
Info
Debug

使用roslaunch工具

    roslaunch工具是按照launch文件开始运行nodes的工具,

Usage:

$ roslaunch [package] [filename.launch]
$ roslaunch beginner_tutorials turtlemimic.launch
    关于launch file :

    位置:在package根目录下,有 src, include, launch文件夹,package.xml文件, 在launch文件夹下,建立finename.launch文件。

    文件的内容怎么写,见文后附。

    这里有个问题是,roslaunch运行了这个文件以后,出来俩跟随的turtle。只能使用rostopic pub来驱动,为何不能用rosrun turtlesim turtle_teleop_key来驱动?

$ rostopic pub /turtlesim1/turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'
$ rosrun turtlesim turtle_teleop_key

========================================

The Launch File

Now let's create a launch file called turtlemimic.launch and paste the following:

切换行号显示
   1 <launch>
   2 
   3   <group ns="turtlesim1">
   4     <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
   5   </group>
   6 
   7   <group ns="turtlesim2">
   8     <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
   9   </group>
  10 
  11   <node pkg="turtlesim" name="mimic" type="mimic">
  12     <remap from="input" to="turtlesim1/turtle1"/>
  13     <remap from="output" to="turtlesim2/turtle1"/>
  14   </node>
  15 
  16 </launch>

The Launch File Explained

Now, let's break the launch xml down.

Here we start the launch file with the launch tag, so that the file is identified as a launch file.

切换行号显示
   3   <group ns="turtlesim1">
   4     <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
   5   </group>
   6 
   7   <group ns="turtlesim2">
   8     <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
   9   </group>

Here we start two groups with a namespace tag of turtlesim1 and turtlesim2 with a turtlesim node with a name of sim. This allows us to start two simulators without having name conflicts.

切换行号显示
  11   <node pkg="turtlesim" name="mimic" type="mimic">
  12     <remap from="input" to="turtlesim1/turtle1"/>
  13     <remap from="output" to="turtlesim2/turtle1"/>
  14   </node>

Here we start the mimic node with the topics input and output renamed to turtlesim1 and turtlesim2. This renaming will cause turtlesim2 to mimic turtlesim1.

This closes the xml tag for the launch file.





          

2. Using rosed

rosed is part of the rosbash suite. It allows you to directly edit a file within a package by using the package name rather than having to type the entire path to the package.

Usage:

$ rosed [package_name] [filename]

Example:

$ rosed roscpp Logger.msg

This example demonstrates how you would edit the Logger.msg file within the roscpp package.

If this example doesn't work is probably because you don't have the vim editor installed. Please refer to Editor section. If you don't know how to get out of vim, click here.

If the filename is not uniquely defined within the package, a menu will prompt you to choose which of the possible files you want to edit.

Using rosed with tab completion

This way you can easily see and optionally edit all files from a package without knowing its exact name.

Usage:

$ rosed [package_name] <tab><tab>

Example:

$ rosed roscpp <tab><tab>
  • Empty.srv                   package.xml
    GetLoggers.srv              roscpp-msg-extras.cmake
    Logger.msg                  roscpp-msg-paths.cmake
    SetLoggerLevel.srv          roscpp.cmake
    genmsg_cpp.py               roscppConfig-version.cmake
    gensrv_cpp.py               roscppConfig.cmake
    msg_gen.py                  

Editor

The default editor for rosed is vim. The more beginner-friendly editor nano is included with the default Ubuntu install. You can use it by editing your ~/.bashrc file to include:

export EDITOR='nano -w'

To set the default editor to emacs you can edit your ~/.bashrc file to include:

export EDITOR='emacs -nw'

NOTE: changes in .bashrc will only take effect for new terminals. Terminals that are already open will not see the new environmental variable.

Open a new terminal and see if EDITOR is defined:

$ echo $EDITOR
  • nano -w
    or
    emacs -nw
Now that you have successfully configured and used rosed, let's create a Msg and Srv.
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          


版权声明:sonictl原创文章,转载注明,否则读者享用不了后续服务,感谢!

ROS_launch("let's create a launch file called turtlemimic.launch")

ROS中可以把很多的命令以描述的形式写成launch文件,然后用roslaunch命令执行launch文件。它的使用方法如下: roslaunch [package] [filename.l...
  • cly609
  • cly609
  • 2016年09月21日 15:51
  • 172

ROS学习笔记七:使用rqt_console和roslaunch

本节主要介绍在调试时使用的rqt_console和rqt_logger_level,以及一次性打开多个节点的工具roslaunch。使用rqt_console和rqt_logger_level rqt...
  • mountzf
  • mountzf
  • 2016年08月26日 13:12
  • 2379

ROS学习--(九)使用rosed编辑ROS的文件

打开非常简单$ rosed [package_name] [filename] 让我们试试$ rosed roscpp Logger.msg 如果上面的没有成功打开,那就是没有安装vim编辑器 ...
  • BenjaminYoung29
  • BenjaminYoung29
  • 2015年07月28日 15:02
  • 1287

ROS使用教程--关于roslaunch

roslaunch工具十分方便,可以通过SSH远程启动节点以及本机的节点。roslaunch工具使用一个XML格式的文件,后缀名为.launch,可以指定节点的从参数和节点运行的机器。...
  • wendox
  • wendox
  • 2016年08月29日 23:07
  • 2731

ROS Launch使用总结

ROS Launch使用总结
  • x_r_su
  • x_r_su
  • 2017年02月09日 19:10
  • 4050

roslaunch的使用和编写

1、使用$ roslaunch package_name file.launch2、编写roslaunch文件是使用XML语言来描述节点以及相关参数的设置和软件的启动的。2.1 标签标签是任何ros...
  • Forrest_Z
  • Forrest_Z
  • 2016年09月22日 09:38
  • 2122

ROS入门_1.12 使用 rosed 编辑ROS中的文件

使用 rosed rosed 是 rosbash 的一部分。利用它可以直接通过package名来获取到待编辑的文件而无需指定该文件的存储路径了。 使用方法: $ rosed [packa...
  • ShuaiWangCSDN
  • ShuaiWangCSDN
  • 2017年01月14日 21:54
  • 474

ros源码分析(6)—roslaunch Commandline Tools

roslaunchroslaunch is an important tool that manages the start and stop of ROS nodes. It takes one o...
  • lewif
  • lewif
  • 2017年07月21日 18:48
  • 433

ROS中launch file基本介绍

在运行ros程序时我们往往需要在不同终端启动多个不同的节点,这会让人有些沮丧。幸运的是,ROS 提供了一个同时启动节点管理器(master)和多个节点的途径,即使用启动文件(launch file)。...
  • u013832707
  • u013832707
  • 2017年01月02日 16:48
  • 2276

ROS学习手记11 -- 记录和回放Topic中的数据

ROS学习手记11 -- 记录和回放Topic中的数据 详细请见百度文库: http://wenku.baidu.com/view/72ea14c6c850ad02de8041d2...
  • sonictl
  • sonictl
  • 2015年07月14日 17:25
  • 851
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ROS学习手记 - 6 使用ROS中的工具:rqt_console & roslaunch & rosed
举报原因:
原因补充:

(最多只允许输入30个字)