Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 import roslib; roslib.load_manifest('sr_ronex_examples')
00021 import rospy
00022 from time import sleep
00023
00024
00025
00026 """
00027 Assume that your RoNeX consists of a Bridge (IN) module, and one or multiple
00028 General I/O module(s). This class demonstrates how to access the General I/O module(s)
00029 listed in the parameter server. For each General I/O module, the parameter server
00030 stores parameters such as its product_id, product_name, ronex_id, path, and serial.
00031 Note that the Python version is simpler than the C++ version, because parameters
00032 are stored as a dictionary in Python.
00033 """
00034 class SrRonexParseParamExample(object):
00035
00036 def __init__(self):
00037 self.find_general_io_modules()
00038
00039 def find_general_io_modules(self):
00040 """
00041 Find the General I/O modules present on the system.
00042 """
00043
00044 while True:
00045 try:
00046 rospy.get_param("/ronex/devices/0/ronex_id")
00047 break
00048 except:
00049 rospy.loginfo("Waiting for the General I/O module to be loaded properly.")
00050 sleep(0.1)
00051
00052
00053
00054 devices = rospy.get_param("/ronex/devices")
00055 for ronex_param_id in devices:
00056
00057
00058 rospy.loginfo( "*** General I/O Module %s ***", ronex_param_id );
00059 rospy.loginfo( "product_id = %s", devices[ronex_param_id]["product_id"] );
00060 rospy.loginfo( "product_name = %s", devices[ronex_param_id]["product_name"] );
00061 rospy.loginfo( "ronex_id = %s", devices[ronex_param_id]["ronex_id"] );
00062 rospy.loginfo( "path = %s", devices[ronex_param_id]["path"]);
00063 rospy.loginfo( "serial = %s", devices[ronex_param_id]["serial"] );
00064
00065
00066
00067 if __name__ == "__main__":
00068
00069 rospy.init_node("sr_ronex_parse_parameter_server")
00070
00071
00072
00073 SrRonexParseParamExample()
00074
00075