fake_reconfigure_server.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 import roslib; roslib.load_manifest('r2_dynamic_reconfigure')
00003 import rospy
00004 import dynamic_reconfigure.server
00005 import threading
00006 import sys
00007 import os
00008 from dynamic_reconfigure.client import Client as DynamicReconfigureClient
00009 
00010 # we don't know available configurations until at runtime, so import modules dynamically
00011 import r2_dynamic_reconfigure.cfg
00012 modules = []
00013 for module in os.listdir(r2_dynamic_reconfigure.cfg.__path__[0]):
00014     if module[-3:] == '.py' and module != '__init__.py':
00015         modules.append(module[:-3])
00016 _modules = __import__('r2_dynamic_reconfigure.cfg', globals(), locals(), modules, -1)
00017 
00018 class FakeReconfigureServer():
00019     def __init__(self, param):
00020         rospy.init_node(param)
00021         self.param_config = {}
00022         for module in modules:
00023             self.param_config[module.split('Config')[0]] = getattr(_modules, module)
00024         self.server = dynamic_reconfigure.server.Server(self.param_config[param], self.reconfigure)
00025         while not rospy.is_shutdown():
00026             rospy.spin()
00027 
00028     def reconfigure(self, config, level):
00029         return config # Returns the updated configuration.
00030 
00031 if __name__ == '__main__':
00032     try:
00033         # Get desired configuration from command-line argument
00034         param = sys.argv[1]
00035         FakeReconfigureServer(param)
00036     except rospy.ROSInterruptException:
00037         print 'broke'
00038 
00039 


r2_dynamic_reconfigure
Author(s): Paul Dinh
autogenerated on Mon Oct 6 2014 02:42:29