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原创文章,转载注明,否则读者享用不了后续服务,感谢!

6、rqt_console和roslaunch

一、准备确保你已经安装了rqt和turtlesim包,没有的话,使用一下命令安装:sudo apt-get install ros--rqt ros--rqt-common-plugins ros--...

ROS应用2 2014年12月30日

Understanding ROS Topics  http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics $ roscore $ rosrun ...
  • sfe1012
  • sfe1012
  • 2014年12月30日 22:26
  • 610

ROS教程(八):使用 rqt_console 和 roslaunch

使用 rqt_console 和 roslaunch Description: 本教程介绍如何使用rqt_console和rqt_logger_level进行调试,以及如何使用roslaunch同时...

ROS的学习(十)rqt_console和roslaunch

打开一个新的终端在里面输入: sudo apt-get install ros-hydro-rqt ros-hydro-rqt-common-plugins ros-hydro-turtlesim ...

机器人操作系统ROS Indigo 入门学习(9)——理解ROS rqt_console和 roslaunch

1.使用rqt_console和roslaunch 这篇教程将介绍使用rqt_console和rqt_logger_level来调试以及使用roslaunch一次启动许多nodes.如果你使用R...

机器人操作系统ROS Indigo 入门学习(9)——理解ROS rqt_console和 roslaunch

1.使用rqt_console和roslaunch 这篇教程将介绍使用rqt_console和rqt_logger_level来调试以及使用roslaunch一次启动许多nodes.如果你使用ROS ...

ROS学习--(八)使用rqt控制台和roslaunch

rqt_console和rqt_logger_level是用来debug的。roslaunch可以一次启动多个节点(这就是他和rosrun的区别) 先说rqt_console 1.安装$ sudo...

学习ros wiki 中rqt的使用随手记录(二)

这些是由ROS的desktop-full debian软件包提供的手动维护的rqt插件列表。 对于完整的自动生成的列表,请参阅对应的元包。 ROS 后端工具(rqt_common_plugi...

ROS roslaunch 学习

转自http://blog.csdn.net/yiranhaiziqi/article/details/52949121 roslaunch 用处:将多个rosnode 结合起来,一起运行。这样就不...

使用ROS的rqt_plot对任意语言的程序进行可视化

简介经常做数据处理的同学可能比较熟悉MATLAB或者Python,而做图像或者机器人用到最多的其实是C和C++。经常需要在调试时实时看到某些数据的变化趋势,而C++却没有一套好的可视化库(或者需要很麻...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ROS学习手记 - 6 使用ROS中的工具:rqt_console & roslaunch & rosed
举报原因:
原因补充:

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