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