美文网首页
了解ROS Nodes(节点/结点)

了解ROS Nodes(节点/结点)

作者: 网路元素 | 来源:发表于2019-10-02 08:18 被阅读0次

1.相关概念

Nodes:A node is an executable that uses ROS to communicate with other nodes.
Messages: ROS data type used when subscribing or publishing to a topic.
Topics: Nodes canpublishmessagesto a topic as well assubscribetoa topic to receive messages.
Master: Name service for ROS (i.e. helps nodes find each other)
rosout: ROS equivalent of stdout/stderr
roscore: Master + rosout + parameter server

2.Nodes

    A node really isn't much more than an executable file within a ROS package. ROS nodes use a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a Topic. Nodes can also provide or use a Service.

3.客户端库

   根据编程语言不同有:

    rospy = python client library
    roscpp = c++ client library

4.roscore

    当运行ROS时第一件事就是运行roscore命令。

5.使用rosnode

    由于执行了roscore命令后Terminal界面就被占用了,此时需要再打开一个新Terminal再进行如下操作才能有相应结果(即操作依赖于roscore的运行):

    rosnode list

    此时会看到:

    /rosout

    当前只有rosout这个node在运行,运行roscore就一直存在,用于调试或打印输出信息。

    rosnode info /rosout

    该命令可以看到rosout这个node的更多信息。

6.使用rosrun

    运行ROS自带的turtle例子:

    rosrun turtlesim turtlesim_node

    其中,turtlesim是包名,turtlesim_node是节点名。

    命令运行后有如下输出:

    [ INFO] [1495245056.523181709]: Startingturtlesim with node name /turtlesim
    [ INFO] [1495245056.543466285]: Spawningturtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]

    对应的运行界面如下:

turtle

    此时执行rosnode list命令,会有如下输出:

    /rosout
    /turtlesim

    多了一个turtlesim结点,对于结点名,我们也可以指定,如下命令:

    rosrun turtlesim turtlesim_node __name:=slam_turtle

    即在使用rosrun时通过__name参数来设定,执行该命令后再执行rosnode

list,会有如下返回值:

    /rosout
    /slam_turtle

    接下来使用rosnode ping slam_turtle命令可以测试该结点的运行状况,命令执行返回值:

    rosnode: node is [/slam_turtle]
    pinging /slam_turtle with a timeout of 3.0s
    xmlrpc reply from http://slam:46576/    time=3.997087ms
    xmlrpc reply from http://slam:46576/    time=1.501083ms
    xmlrpc reply from http://slam:46576/    time=1.564980ms
    xmlrpc reply from http://slam:46576/    time=1.533031ms
    xmlrpc reply from http://slam:46576/    time=1.444101ms
    ^Cping average: 2.008057ms

7.回顾

roscore = ros+core : master (provides name service for ROS) + rosout (stdout/stderr) +parameter server
rosnode = ros+node : ROS tool toget information about a node.
rosrun = ros+run : runs a node from a given package.

参考网址:http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes

相关文章

  • 了解ROS Nodes(节点/结点)

    1.相关概念 Nodes:A node is an executable that uses ROS to com...

  • 【ROS学习-5】了解ROS Nodes(节点/结点)

    1.相关概念 Nodes: A node is an executable that uses ROS to co...

  • ROS tutorials.2

    图概念简介 Nodes:节点,一个节点即为一个可执行文件,它可以通过ROS与其它节点进行通信 Messages:消...

  • 2018-11-05

    以根节点的右结点为新的根节点,根节点的右结点指向新根节点的左结点,再将新根节点的左结点指向元根节点!这种无人能懂的饶舌…

  • 数据结构_知识点_树

    关于树的基本术语 祖先结点,子孙结点 双亲结点,孩子结点 兄弟结点 结点的度 分支节点(度为0),叶子节点(又称终...

  • mappingTree构造

    添加结点MappingNode 增加子结点策略:每个结点下面有多个子节点,每个节点主要记录最左子结点和右兄弟结点,...

  • ROS学习笔记(七)- 理解ROS Nodes

    这一篇介绍ROS graph的概念,并且讨论roscore,rosnode和rosrun命令行工具的用法 1 预备...

  • 二叉树基础

    相关概念 根节点:没有父节点的结点。 叶子节点:没有子节点的结点。 高度:节点到叶子节点的“最长路径”(边数)。 ...

  • 初探jQuery

    实现一个jQuery的API 传一个选择器或节点 为nodes添加类,并且遍历nodes 遍历nodes,并且改变...

  • Elasticsearch的节点特点

    节点 Master-eligible nodes & Master Node 每个节点启动后,默认就是Master...

网友评论

      本文标题:了解ROS Nodes(节点/结点)

      本文链接:https://www.haomeiwen.com/subject/hjtfpctx.html