#! /usr/bin/env python
#conding=utf-8
import rospy
if __name__ =='__main__':
#初始化节点
rospy.init_node('param_set')
#新增参数
rospy.set_param('type_p','xiaohuangche')
rospy.set_param('radius_p',0.15)
#修改参数
rospy.set_param('radius_p',0.2)
#3.get_param_name
names=rospy.get_param_names()
for name in names:
rospy.loginfo('name=%s',name)
查
#4.has_param
flag1=rospy.has_param('radius_p')
if flag1:
rospy.loginfo('radius_p存在')
else:
rospy.loginfo('radius_p不存在')
#5.search_param 查找某个参数的键
key=rospy.search_param('radius_p')
rospy.loginfo('key=%s',key)
删除
import rospy
if __name__ =='__main__':
rospy.init_node('del_param_p')
try:
rospy.delete_param('radius_p')
except Exception as e:
rospy.loginfo('被删除的参数不存在')