ROS study notes 8-rqt_console and roslaunch

This tutorial comes from: http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch

rqt_console and  rqt_logger_level is ros debugging tool (similar to the console and logs). roslaunch it may be used to start a plurality of nodes (a start node only differs rosrun).

  1. Use rqt_console and rqt_logger_level
    assumed rqt tools installed and ros, as well as examples of small packets turtle. The logging system associated rqt_console ros console display to output node, rqt_logger_level allow us to change their information level displayed during node operation.
    Information display level include: DEBUG (debug information), WARN (warning message), INFO (message), and ERROR (error message).
    Before running a small turtle example, running two new terminals statement are as follows, and open rqt_console rqt_logger_level interface:
    $ Rosrun rqt_console rqt_console 
    $ rosrun rqt_logger_level rqt_logger_level
    

    rqt_console interface

     

     rqt_logger_level interface

     

     Now we run the example of a small turtle in a new terminal:

    $ rosrun turtlesim turtlesim_node
    

    The console will come out the following information:

     

     Then we can change the level of information in rqt_logger_level in.

     

     The display level change Warning, and then run the following command, let the turtle hit the wall:

    rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'
    

     Then we look at the information rqt_console:

    It can be seen show a warning message.

    All log levels are as follows:

    Fatal
    Error
    Warn
    Info
    Debug
    

    Which, Debug is the lowest level, Fatal is the highest level, select a level, select the level will be displayed as well as lower than his level. For example, select Warn, appears Debug, Info and Warn level of information.

  2. roslaunch
    roslaunch start node through a startup file
    is used as follows:

    $ roslaunch [package] [filename.launch]
    

     Ros using the following command to a package, in this example enters beginner_tutorials

    $ roscd beginner_tutorials
    

     If the package is not prompted, reference documents create a ros package . Run the following command to establish ros environment.

    $ cd ~/catkin_ws
    $ source devel/setup.bash
    $ roscd beginner_tutorials
    

    Then create a boot file directory using the following command:

    $ mkdir launch
    $ cd launch
    

     In fact, do not create separate directories for storing boot files, startup files can be stored anywhere in the package directory, ros will automatically look for him, but for ease of file organization, or create a separate directory better.

    Then create a startup file named: turtlemimic.launch, reads as follows:
    <launch>
    
      <group ns="turtlesim1">
        <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
      </group>
    
      <group ns="turtlesim2">
        <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
      </group>
    
      <node pkg="turtlesim" name="mimic" type="mimic">
        <remap from="input" to="turtlesim1/turtle1"/>
        <remap from="output" to="turtlesim2/turtle1"/>
      </node>
    
    </launch>
    

    As can be seen from the label of the boot file, the file is XML syntax, there are two and a Node group, wherein two of the group tag has a specified namespace ns (namespace) of turtlesim1 and turtlesim2, the two group have a node, node name (name) for the sim. This allows us simultaneously start two emulators without naming conflicts. Then, we define a simulation (mimic) node, which has the theme input and output, the input and output are remapped to turtlesim1 and turtlesim2, the renaming will turtlesim2 analog turtlesim1 (output turtlesim1 directly to turtlesim2).
    Then we use roslaunch to start the file.

    $ roslaunch beginner_tutorials turtlemimic.launch
    

     Output is as follows:

    started roslaunch server http://UAVlab1:36470/
    
    SUMMARY
    ========
    
    PARAMETERS
     * /rosdistro: kinetic
     * /rosversion: 1.12.14
    
    NODES
      /
        mimic (turtlesim/mimic)
      /turtlesim1/
        sim (turtlesim/turtlesim_node)
      /turtlesim2/
        sim (turtlesim/turtlesim_node)
    
    ROS_MASTER_URI=http://localhost:11311
    
    process[turtlesim1/sim-1]: started with pid [4107]
    process[turtlesim2/sim-2]: started with pid [4108]
    process[mimic-3]: started with pid [4109]
    

    Can be seen, running three nodes, respectively / mimic, / turtlesim1 / sim and / turtlesim2 / sim.
    And there were two small turtles:

     

     Let us start a new terminal, in which the release of the news that turtlesim1 turtle begins to move:

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

     Two windows can be seen in the small turtles are beginning to move:

     

     Messaging can be seen therein:

     

     / Mimic message forwarding node played a role.




     

     

         


Guess you like

Origin www.cnblogs.com/spyplus/p/11539844.html