7 from ddynamic_reconfigure_python.ddynamic_reconfigure
import DDynamicReconfigure
10 rospy.wait_for_service(
'/gazebo/advertise_joint_params')
13 advertise_params = rospy.ServiceProxy(
'/gazebo/advertise_joint_params', ParamListRequest)
14 res = advertise_params()
16 except rospy.ServiceException, e:
17 print "Service call failed: %s"%e
21 rospy.wait_for_service(
"gazebo/" + service_name)
23 set_param_ = rospy.ServiceProxy(
"gazebo/" + service_name, SetParamFloat)
24 res = set_param_(value)
26 except rospy.ServiceException, e:
27 print "Service call failed: %s"%e
31 for service_name
in services:
43 service_name =
''.join([param_ns,
"/", key])
44 print service_name, key, config[key]
50 if __name__ ==
'__main__':
51 rospy.init_node(
'ddynrec')
64 services = rospy.get_param(
"/optimizable_params")
72 for service_name
in services:
76 index = service_name.rfind(
"/")
77 param_ns = service_name[:index]
78 param_name = service_name[index+1:]
84 if param_ns
not in ddyns:
85 ddyns[param_ns] = DDynamicReconfigure(param_ns)
87 ddynrec = ddyns[param_ns]
89 ddynrec.add_variable(param_name, service_name, 0.0, 0.0, 10.0)
93 for param_ns
in ddyns:
99 ddynrec = ddyns[param_ns]
100 ddynrec.start(_dyn_rec_callback)
def set_param(service_name, value)
def _dyn_rec_callback(config, level, _param_ns=param_ns)
def dyn_rec_callback(config, level, param_ns)