ROS学习手记 - 5 理解ROS中的基本概念_Services and Parameters

上一节完成了对nodes, Topic的理解,再深入一步: Services and Parameters

我不理解为何 ROS wiki 要把service与parameter放在一起介绍, 很想分开说,但限于 csdn blog 没有文章顺序调整功能。只能罢了~~

-----------------以下是我作的关于ROS Service的总结-------------------

关于ROS Service的总结:

  • 什么是ROS Service: 在wiki/tutorials/1.7 中,有“Understanding ROS Services and Parameters”一节, 我不理解为何要把service与parameter放在一起介绍。
    [概念concepts] ROS Service: Another way that Nodes communicate with nodes. A_node send a request to B_node, and B_node give a response.
    [命令Commands] sorservice list/call/type/find/uri    &   rossrv - this command is mainly for the .srv files operations

  • 什么定义了ROS Service: *.srv file - srv文件: 在wiki/tutorials/1.10  中,有“Creating Msg & Srv” 一节,我还是没理解为何要把srv文件和msg文件放在一起介绍。
    The function of srv file: Discribe/define the data type for a service. The data type of Req. & Resp. divided by '---'
    the srv file typically stored under ../workspace/src/package_name/srv/ path.
    [Create the srv file]: step1. echo "..." ./srv/filename.srv          step2. uncomment "gen_srv()" in CMakeList.txt file.
    [Use the srv file]: $rossrv show filename.srv , rossrv -- info of service definitions
  • 什么程序实现了ROS Servie: 在 wiki/tutorials/1.14 中,有“Writing a simpleService and Client(C++)” 一节, 其中详细介绍了Service_node & Client_node的程序实现。

-----------------以上是我作的关于ROS Service的总结-------------------

关于ROS Parameters的总结:

  • 什么是ROS Parameters: ROS Parameters 是ROS程序运行时所需要的参数,比如你的机器人的轮子的半径,你的gyro传感器是否具备等。

  • 如何修改和操作ROS Parameters: 这里我要引用一些高级的东东,简单的就不说了。link 是关于改了parameter没反应时的方法。还有要注意:
    rosparam set use_sim_time true
    rosparam delete /move_base

    以上俩关于rosparam 命令的使用方法mentioned in this blog: link

  • 如何在命令行中指派parameter的值:这个叫“Dynamic Reconfigure” ,具体方法:1. Python: Link   2. C++ Link


-----------------以下是我最初学习它的时候的手记-----------------

  1. Understanding ROS Services and Parameters

    This tutorial introduces ROS services, and parameters as well as using therosservice androsparam commandline tools.

       Description: This tutorial introduces ROS services, and parameters as well as using the rosservice and rosparam commandline tools.

ROS Services

    Services are another way that nodes can communicate with each other. Services allow nodes to send a request and receive a response.

Using rosservice


*rosservice* can easily attach to ROS's client/service framework with services. rosservice has many commands that can be used on topics, as shown below:

Usage:
    rosservice list         print information about active services
    rosservice call         call the service with the provided args
    rosservice type         print service type
    rosservice find         find services by service type
    rosservice uri          print service ROSRPC uri

    list
    type
    call
    

Using rosparam


*rosparam* allows you to store and manipulate data on the ROS Parameter Server. The Parameter Server can store integers, floats, boolean, dictionaries, and lists. rosparam uses the YAML markup language for syntax. In simple cases, YAML looks very natural: 1 is an integer, 1.0 is a float, one is a string, true is a boolean, [1, 2, 3] is a list of integers, and {a: b, c: d} is a dictionary. rosparam has many commands that can be used on parameters, as shown below:

Usage:

    rosparam set            set parameter
    rosparam get            get parameter
    rosparam load           load parameters from file
    rosparam dump           dump parameters to file
    rosparam delete         delete parameter
    rosparam list           list parameter names

    list
    set/get
    dump/load

   

Stack, Package, Nodes/Messages/Services/Libraries/Tools, 关系复习图如下:



Published At
comments powered by Disqus