【第22期】观点:IT 行业加班,到底有没有价值?

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 Indigo 入门学习(9)——理解ROS rqt_console和 roslaunch

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

ROS使用DDNS

Winbox-system-Scheduler-添加:Name:随便 Interval:多少时间检测一次IP我设为00:20:00 On Event:/tool dns-update name=域名 address=127.0.0.255 key-name=用户名 key=密码

程序员升职加薪指南!还缺一个“证”!

CSDN出品,立即查看!

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

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

Esxi 5下ROS5.18+Panabit

  原计划是使用单网卡拨4 条 ADSL 的。 结果不幸买错了交换机,TPlink 的楼道交换机, TL-SF1016L <s
  • lilai
  • lilai
  • 2012-08-17 12:07
  • 2410

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

本节主要介绍在调试时使用的rqt_console和rqt_logger_level,以及一次性打开多个节点的工具roslaunch。使用rqt_console和rqt_logger_level rqt...
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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