$search
00001 """autogenerated by genmsg_py from PortControl.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import applanix_msgs.msg 00006 00007 class PortControl(roslib.message.Message): 00008 _md5sum = "580f01d560eac7e9f65f2de16e8d84ca" 00009 _type = "applanix_msgs/PortControl" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# Msg 51, 52, 61 00012 uint16 transaction 00013 00014 uint16 groups_count 00015 OutputGroup[] groups 00016 00017 # Valid only for primary/secondary data port. 00018 # 1, 2, 10, 20, 25, 50, 100, 200 00019 uint16 rate 00020 00021 ================================================================================ 00022 MSG: applanix_msgs/OutputGroup 00023 uint16 group 00024 00025 """ 00026 __slots__ = ['transaction','groups_count','groups','rate'] 00027 _slot_types = ['uint16','uint16','applanix_msgs/OutputGroup[]','uint16'] 00028 00029 def __init__(self, *args, **kwds): 00030 """ 00031 Constructor. Any message fields that are implicitly/explicitly 00032 set to None will be assigned a default value. The recommend 00033 use is keyword arguments as this is more robust to future message 00034 changes. You cannot mix in-order arguments and keyword arguments. 00035 00036 The available fields are: 00037 transaction,groups_count,groups,rate 00038 00039 @param args: complete set of field values, in .msg order 00040 @param kwds: use keyword arguments corresponding to message field names 00041 to set specific fields. 00042 """ 00043 if args or kwds: 00044 super(PortControl, self).__init__(*args, **kwds) 00045 #message fields cannot be None, assign default values for those that are 00046 if self.transaction is None: 00047 self.transaction = 0 00048 if self.groups_count is None: 00049 self.groups_count = 0 00050 if self.groups is None: 00051 self.groups = [] 00052 if self.rate is None: 00053 self.rate = 0 00054 else: 00055 self.transaction = 0 00056 self.groups_count = 0 00057 self.groups = [] 00058 self.rate = 0 00059 00060 def _get_types(self): 00061 """ 00062 internal API method 00063 """ 00064 return self._slot_types 00065 00066 def serialize(self, buff): 00067 """ 00068 serialize message into buffer 00069 @param buff: buffer 00070 @type buff: StringIO 00071 """ 00072 try: 00073 _x = self 00074 buff.write(_struct_2H.pack(_x.transaction, _x.groups_count)) 00075 length = len(self.groups) 00076 buff.write(_struct_I.pack(length)) 00077 for val1 in self.groups: 00078 buff.write(_struct_H.pack(val1.group)) 00079 buff.write(_struct_H.pack(self.rate)) 00080 except struct.error as se: self._check_types(se) 00081 except TypeError as te: self._check_types(te) 00082 00083 def deserialize(self, str): 00084 """ 00085 unpack serialized message in str into this message instance 00086 @param str: byte array of serialized message 00087 @type str: str 00088 """ 00089 try: 00090 end = 0 00091 _x = self 00092 start = end 00093 end += 4 00094 (_x.transaction, _x.groups_count,) = _struct_2H.unpack(str[start:end]) 00095 start = end 00096 end += 4 00097 (length,) = _struct_I.unpack(str[start:end]) 00098 self.groups = [] 00099 for i in range(0, length): 00100 val1 = applanix_msgs.msg.OutputGroup() 00101 start = end 00102 end += 2 00103 (val1.group,) = _struct_H.unpack(str[start:end]) 00104 self.groups.append(val1) 00105 start = end 00106 end += 2 00107 (self.rate,) = _struct_H.unpack(str[start:end]) 00108 return self 00109 except struct.error as e: 00110 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00111 00112 00113 def serialize_numpy(self, buff, numpy): 00114 """ 00115 serialize message with numpy array types into buffer 00116 @param buff: buffer 00117 @type buff: StringIO 00118 @param numpy: numpy python module 00119 @type numpy module 00120 """ 00121 try: 00122 _x = self 00123 buff.write(_struct_2H.pack(_x.transaction, _x.groups_count)) 00124 length = len(self.groups) 00125 buff.write(_struct_I.pack(length)) 00126 for val1 in self.groups: 00127 buff.write(_struct_H.pack(val1.group)) 00128 buff.write(_struct_H.pack(self.rate)) 00129 except struct.error as se: self._check_types(se) 00130 except TypeError as te: self._check_types(te) 00131 00132 def deserialize_numpy(self, str, numpy): 00133 """ 00134 unpack serialized message in str into this message instance using numpy for array types 00135 @param str: byte array of serialized message 00136 @type str: str 00137 @param numpy: numpy python module 00138 @type numpy: module 00139 """ 00140 try: 00141 end = 0 00142 _x = self 00143 start = end 00144 end += 4 00145 (_x.transaction, _x.groups_count,) = _struct_2H.unpack(str[start:end]) 00146 start = end 00147 end += 4 00148 (length,) = _struct_I.unpack(str[start:end]) 00149 self.groups = [] 00150 for i in range(0, length): 00151 val1 = applanix_msgs.msg.OutputGroup() 00152 start = end 00153 end += 2 00154 (val1.group,) = _struct_H.unpack(str[start:end]) 00155 self.groups.append(val1) 00156 start = end 00157 end += 2 00158 (self.rate,) = _struct_H.unpack(str[start:end]) 00159 return self 00160 except struct.error as e: 00161 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00162 00163 _struct_I = roslib.message.struct_I 00164 _struct_H = struct.Struct("<H") 00165 _struct_2H = struct.Struct("<2H")