change_ronex_configuration.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # ####################################################################
00004 # Copyright (c) 2013, Shadow Robot Company, All rights reserved.
00005 # 
00006 # This library is free software; you can redistribute it and/or
00007 # modify it under the terms of the GNU Lesser General Public
00008 # License as published by the Free Software Foundation; either
00009 # version 3.0 of the License, or (at your option) any later version.
00010 #
00011 # This library is distributed in the hope that it will be useful,
00012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014 # Lesser General Public License for more details.
00015 #
00016 # You should have received a copy of the GNU Lesser General Public
00017 # License along with this library.
00018 # ####################################################################
00019 
00020 import roslib; roslib.load_manifest('sr_ronex_examples')
00021 import rospy
00022 import dynamic_reconfigure.client
00023 
00024 from time import sleep
00025 
00026 #--------------------------------------------------------------------------------
00027 
00028 """
00029 This class demonstrate how to change the configuration parameters of a running ronex module.
00030 """
00031 class ChangeRonexConfigurationExample(object):
00032 
00033     def __init__(self):
00034         #Define the ronex id of the module to be configured
00035         ronex_id = "test_ronex"
00036         ronex_path = "/ronex/general_io/" + ronex_id + "/"
00037         self.configure_ronex(ronex_path)
00038         
00039     def configure_ronex(self, path):
00040         """
00041         In this example we are using the dynamic_reconfigure.client.
00042         It could also be done by calling the /ronex/general_io/X/set_parameters service directly (as in the c++ example)
00043         """
00044         client = dynamic_reconfigure.client.Client(path)
00045         
00046         # calling update_configuration with a dictionary of changes to make
00047         params = { 'input_mode_0' : False, 'input_mode_1' : False, 'pwm_period_0' : 200 , 'pwm_clock_divider' : 3000}
00048         config = client.update_configuration(params)
00049         
00050         # config now contains the full configuration of the node after the parameter update
00051 
00052 
00053 #--------------------------------------------------------------------------------
00054 
00055 if __name__ == "__main__":
00056     rospy.init_node("change_ronex_configuration_py")
00057     ChangeRonexConfigurationExample()
00058 
00059 #--------------------------------------------------------------------------------


sr_ronex_examples
Author(s): Ugo Cupcic, Toni Oliver, Mark Pitchless, Yi Li
autogenerated on Fri Aug 28 2015 13:12:34