ROS study notes 5- appreciated node (Node)

In this article comes from: http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes

  1. FIG. (Graph) Conceptual Overview
    • Nodes ( Nodes ): ROS following a node is an executable program, used to communicate with other nodes ROS.
    • Message ( the Messages ): subscribe or publish the data structure when using a data type to the subject matter.
    • Topics ( Topics ): nodes can publish messages to a topic, theme or subscribe to receive messages, in order to achieve data exchange with other nodes.
    • Host node ( Master ): host node provides naming services to help find the node to other nodes.
    • ROS output ( rosout ): In the ROS is equivalent to stdout or stderr (standard output in ROS)
    • ROS core ( roscore ): host node + + standard output parameter server.
  2. Core ROS (roscore)
    roscore is to use a command ros run, you need to run roscore before other nodes running.
    $ roscore
    ... logging to /home/shao/.ros/log/93b4e9f2-d146-11e9-a3fd-69f079ca327f/roslaunch-UAVlab1-13621.log
    Checking log directory for disk usage. This may take awhile.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.
    
    started roslaunch server http://UAVlab1:40901/
    ros_comm version 1.12.14
    
    
    SUMMARY
    ========
    
    PARAMETERS
     * /rosdistro: kinetic
     * /rosversion: 1.12.14
    
    NODES
    
    auto-starting new master
    process[master]: started with pid [13631]
    ROS_MASTER_URI=http://UAVlab1:11311/
    
    setting /run_id to 93b4e9f2-d146-11e9-a3fd-69f079ca327f
    process[rosout-1]: started with pid [13644]
    started core service [/rosout]
    

    After successful operation as shown in FIG.

  3. rosnode command
    using rosnode command can display information ros node. For example: rosnode list command lists ros nodes running.
    Opening a new terminal, run rosnode list, as follows:
    $ rosnode list
    /rosout
    

    As can be seen, there is a rosout node, start to roscore command.
    Use rosnode info command to view the information ros node:

    $ rosnode info /rosout
    --------------------------------------------------------------------------------
    Node [/rosout]
    Publications: 
     * /rosout_agg [rosgraph_msgs/Log]
    
    Subscriptions: 
     * /rosout [unknown type]
    
    Services: 
     * /rosout/get_loggers
     * /rosout/set_logger_level
    
    
    contacting node http://UAVlab1:42313/ ...
    Pid: 13644
    

     

  4.  rosrun run node

    rosrun ros node can run the command syntax is as follows:
    $ rosrun [package_name] [node_name]
    

    The official website of the document in question, the right should be:

    rosrun <package> <executable>
    

    That second argument is an executable program name, and node name is not necessarily the same.
    Open a new terminal and run:

    $ rosrun turtlesim turtlesim_node
    

     

     

     Small turtle appeared myself.

    Then use rosnode can see:
    $ rosnode list
    /rosout
    /turtlesim
    

    You can see more than a node of a turtlesim.
    Opens new terminal, then remapping parameters can be renamed to the node name.

    $ rosrun turtlesim turtlesim_node __name:=my_turtle
    

     Then run rosnode list

    $ rosnode list
    /my_turtle
    /rosout
    /turtlesim
    

    You can see more than one node my_turtle.
    Use rosnode ping command to check the communication between a node and, similar to the ping command.

    $ rosnode ping /my_turtle
    rosnode: node is [/my_turtle]
    pinging /my_turtle with a timeout of 3.0s
    xmlrpc reply from http://UAVlab1:43947/	time=0.296116ms
    xmlrpc reply from http://UAVlab1:43947/	time=0.949144ms
    xmlrpc reply from http://UAVlab1:43947/	time=0.707150ms
    xmlrpc reply from http://UAVlab1:43947/	time=0.704050ms
    xmlrpc reply from http://UAVlab1:43947/	time=1.071930ms
    

     

Guess you like

Origin www.cnblogs.com/spyplus/p/11481786.html
Recommended