client.py
Go to the documentation of this file.
00001 import roslib; roslib.load_manifest('dynamic_reconfigure')
00002 import rospy
00003 import time
00004 from dynamic_reconfigure.client import Client as DynamicReconfigureClient
00005 
00006 class Client:
00007     def __init__(self, name, timeout=None):
00008         self.name = name
00009         self.client = DynamicReconfigureClient(name, timeout)
00010 
00011     def update(self, config):
00012         # send data out no greater than 10 times
00013         # revisit this and determine if this is actually needed
00014         c = 0
00015         new_config = {}
00016         while c < 10:
00017             # fuerte: update_configuration returns the configuration in a different format
00018             # get new_config and compare with sent out config
00019             updated_config = self.client.update_configuration(config)
00020             for key,val in config.iteritems():
00021                 new_config[key] = updated_config[key]
00022             c += 1
00023             if new_config == config:
00024                 break
00025 
00026         if c == 10:
00027             pre = 'failed to set '
00028         else:
00029             pre = 'successfully set '
00030 
00031         sleep_time = 0.05
00032         rospy.loginfo(pre + self.name + ' in ' + str(c) + ' attempt(s) and sleeping for ' + str(sleep_time) + 's')
00033         time.sleep(sleep_time)


r2_dynamic_reconfigure
Author(s): Paul Dinh
autogenerated on Fri Jan 3 2014 11:34:13