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

转载于:https://www.cnblogs.com/sdu20112013/p/10570485.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值