Go to the documentation of this file.00001
00002
00003 """
00004 Dynamic dynamic reconfigure server example.
00005
00006 Author: Sammy Pfeiffer
00007 """
00008
00009 import rospy
00010 from ddynamic_reconfigure_python.ddynamic_reconfigure import DDynamicReconfigure
00011
00012 def dyn_rec_callback(config, level):
00013 rospy.loginfo("Received reconf call: " + str(config))
00014 return config
00015
00016 if __name__ == '__main__':
00017 rospy.init_node('test_ddynrec')
00018
00019
00020 ddynrec = DDynamicReconfigure("example_dyn_rec")
00021
00022
00023 ddynrec.add_variable("decimal", "float/double variable", 0.0, -1.0, 1.0)
00024 ddynrec.add_variable("integer", "integer variable", 0, -1, 1)
00025 ddynrec.add_variable("bool", "bool variable", True)
00026 ddynrec.add_variable("string", "string variable", "string dynamic variable")
00027 enum_method = ddynrec.enum([ ddynrec.const("Small", "int", 0, "A small constant"),
00028 ddynrec.const("Medium", "int", 1, "A medium constant"),
00029 ddynrec.const("Large", "int", 2, "A large constant"),
00030 ddynrec.const("ExtraLarge", "int", 3, "An extra large constant")],
00031 "An enum example")
00032 ddynrec.add_variable("enumerate", "enumerate variable", 1, 0, 3, edit_method=enum_method)
00033
00034
00035 ddynrec.start(dyn_rec_callback)
00036
00037 rospy.spin()