• 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的数据.

  • 相关阅读:
    Android滑动菜单框架完全解析,教你如何一分钟实现滑动菜单特效
    Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
    Android桌面悬浮窗效果实现,仿360手机卫士悬浮窗效果
    各产品编译及串口烧录
    C 语言代码规范
    烧录
    共享目录
    openwrt Makefile
    netfilter 参考pywj的《netfilter + nf_conntrack + iptables》
    iptables问题
  • 原文地址:https://www.cnblogs.com/sdu20112013/p/10570485.html
Copyright © 2020-2023  润新知