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的学习(十)rqt_console和roslaunch

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

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

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

ROS roslaunch 学习

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

ROS学习之 roslaunch

wiki链接: http://wiki.ros.org/roslaunch 一.概览     roslaunch程序包包含了可以读取roslaunch.launch/XML format的...

ROS使用教程--关于roslaunch

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

ROS(indigo) 安装和使用更新版本的Gazebo----3,4,5,6,7 附:中国机器人大赛中型组仿真比赛说明

ROS(indigo) 安装和使用更新版本的Gazebo----3,4,5,6,7 附:中国机器人大赛中型组仿真比赛说明 ROS(indigo) 安装和使用更新版本的Gazebo,本文以7为例。 ...

ROS的学习(二十一)使用时间和TF

rosserial_arduino这个包,包括了可以在arduino上产生时间戳的一个库,这个时间和运行roscore实例的PC或者是平板上的时间是同步的。下面使用一个例子来演示一下如何访问时间,并且...

ROS学习(四)——使用rosinstall下载源文件

ROS的stack库分作两部分,一部分为核心部分,即main部分,简而言之就是使用下面命令,安装ROS系统时就已经安装到我们用户电脑上的那部分。 $ sudo apt-get install ros...

ROS 学习系列 -- 使用urdf创建机器人模型在Rviz中3D观察 之一 link使用

使用ROS强大的机器人功能,建立ROS可以识别的机器人模型是第一步,也是无法绕过去的环节。Unified Robot Description Format (URDF) 就是描述机器人硬件尺寸布局的模...

ROS学习--如何结合launch文件使用参数服务器

ROS(Robot Operating System)接触了将近两年了,最常用的也就是发布话题与订阅话题,前一段时间刚刚把Rviz与/tf搞明白一些,都能够多掌握一些东西,都会特别开心,要想提高自己的...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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