zoukankan      html  css  js  c++  java
  • Understanding ROS Services and Parameters

    service是nodes之间通信的一种方式,允许nodes send a request and recieve a response。

    • rosservice
    • rosparam

    roservice

    rosservice list         print information about active services   #展示有哪些service
    rosservice call         call the service with the provided args   #rosservice call [service] [args]
    rosservice type         print service type                        #rosservice type [service]
    rosservice find         find services by service type
    rosservice uri          print service ROSRPC uri
    

    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:

    rosparam set            set parameter       # rosparam set /background_r 150
    rosparam get            get parameter       # rosparam get /background_g 
    rosparam load           load parameters from file
    rosparam dump           dump parameters to file
    rosparam delete         delete parameter
    rosparam list           list parameter names   
    

    dump load用法举例

    rosparam dump [file_name] [namespace]
    rosparam load [file_name] [namespace]
    
    rosparam dump params.yaml  #把所有的参数写入params.yaml
    rosparam load params.yaml copy #加载param.yaml的参数到新的namespace(新的namespace名字为copy)
    rosparam get /copy/background_b #获取上一步中的新的namespace中的参数信息
    

    在set parameter以后必须调用rosservice call /clear使其生效
    This changes the parameter value, now we have to call the clear service for the parameter change to take effect:

    rosservice call /clear
    

    rosparam用来存储及操作位于Parameter Server的数据.

  • 相关阅读:
    BZOJ1862: [Zjoi2006]GameZ游戏排名系统
    BZOJXXXX: [IOI2000]邮局——四边形不等式优化初探
    BZOJ1801: [Ahoi2009]chess 中国象棋
    BZOJ1505: [NOI2004]小H的小屋
    BZOJ1899: [Zjoi2004]Lunch 午餐
    BZOJ1057: [ZJOI2007]棋盘制作
    BZOJ1100: [POI2007]对称轴osi
    BZOJ1123: [POI2008]BLO
    线性规划之单纯形讲解
    BZOJ 3265 志愿者招募加强版(单纯形)
  • 原文地址:https://www.cnblogs.com/sdu20112013/p/10570485.html
Copyright © 2011-2022 走看看