$search
00001 """autogenerated by genmsg_py from sub20_ADC_meas.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class sub20_ADC_meas(roslib.message.Message): 00008 _md5sum = "e5a875ce6bb2d936bd7c1ae33b9699ad" 00009 _type = "adc_sub20/sub20_ADC_meas" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 string strIdSubDev 00013 uint16[] uiRaw 00014 float64[] fVolts 00015 ================================================================================ 00016 MSG: std_msgs/Header 00017 # Standard metadata for higher-level stamped data types. 00018 # This is generally used to communicate timestamped data 00019 # in a particular coordinate frame. 00020 # 00021 # sequence ID: consecutively increasing ID 00022 uint32 seq 00023 #Two-integer timestamp that is expressed as: 00024 # * stamp.secs: seconds (stamp_secs) since epoch 00025 # * stamp.nsecs: nanoseconds since stamp_secs 00026 # time-handling sugar is provided by the client library 00027 time stamp 00028 #Frame this data is associated with 00029 # 0: no frame 00030 # 1: global frame 00031 string frame_id 00032 00033 """ 00034 __slots__ = ['header','strIdSubDev','uiRaw','fVolts'] 00035 _slot_types = ['Header','string','uint16[]','float64[]'] 00036 00037 def __init__(self, *args, **kwds): 00038 """ 00039 Constructor. Any message fields that are implicitly/explicitly 00040 set to None will be assigned a default value. The recommend 00041 use is keyword arguments as this is more robust to future message 00042 changes. You cannot mix in-order arguments and keyword arguments. 00043 00044 The available fields are: 00045 header,strIdSubDev,uiRaw,fVolts 00046 00047 @param args: complete set of field values, in .msg order 00048 @param kwds: use keyword arguments corresponding to message field names 00049 to set specific fields. 00050 """ 00051 if args or kwds: 00052 super(sub20_ADC_meas, self).__init__(*args, **kwds) 00053 #message fields cannot be None, assign default values for those that are 00054 if self.header is None: 00055 self.header = std_msgs.msg._Header.Header() 00056 if self.strIdSubDev is None: 00057 self.strIdSubDev = '' 00058 if self.uiRaw is None: 00059 self.uiRaw = [] 00060 if self.fVolts is None: 00061 self.fVolts = [] 00062 else: 00063 self.header = std_msgs.msg._Header.Header() 00064 self.strIdSubDev = '' 00065 self.uiRaw = [] 00066 self.fVolts = [] 00067 00068 def _get_types(self): 00069 """ 00070 internal API method 00071 """ 00072 return self._slot_types 00073 00074 def serialize(self, buff): 00075 """ 00076 serialize message into buffer 00077 @param buff: buffer 00078 @type buff: StringIO 00079 """ 00080 try: 00081 _x = self 00082 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00083 _x = self.header.frame_id 00084 length = len(_x) 00085 buff.write(struct.pack('<I%ss'%length, length, _x)) 00086 _x = self.strIdSubDev 00087 length = len(_x) 00088 buff.write(struct.pack('<I%ss'%length, length, _x)) 00089 length = len(self.uiRaw) 00090 buff.write(_struct_I.pack(length)) 00091 pattern = '<%sH'%length 00092 buff.write(struct.pack(pattern, *self.uiRaw)) 00093 length = len(self.fVolts) 00094 buff.write(_struct_I.pack(length)) 00095 pattern = '<%sd'%length 00096 buff.write(struct.pack(pattern, *self.fVolts)) 00097 except struct.error as se: self._check_types(se) 00098 except TypeError as te: self._check_types(te) 00099 00100 def deserialize(self, str): 00101 """ 00102 unpack serialized message in str into this message instance 00103 @param str: byte array of serialized message 00104 @type str: str 00105 """ 00106 try: 00107 if self.header is None: 00108 self.header = std_msgs.msg._Header.Header() 00109 end = 0 00110 _x = self 00111 start = end 00112 end += 12 00113 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00114 start = end 00115 end += 4 00116 (length,) = _struct_I.unpack(str[start:end]) 00117 start = end 00118 end += length 00119 self.header.frame_id = str[start:end] 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.strIdSubDev = str[start:end] 00126 start = end 00127 end += 4 00128 (length,) = _struct_I.unpack(str[start:end]) 00129 pattern = '<%sH'%length 00130 start = end 00131 end += struct.calcsize(pattern) 00132 self.uiRaw = struct.unpack(pattern, str[start:end]) 00133 start = end 00134 end += 4 00135 (length,) = _struct_I.unpack(str[start:end]) 00136 pattern = '<%sd'%length 00137 start = end 00138 end += struct.calcsize(pattern) 00139 self.fVolts = struct.unpack(pattern, str[start:end]) 00140 return self 00141 except struct.error as e: 00142 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00143 00144 00145 def serialize_numpy(self, buff, numpy): 00146 """ 00147 serialize message with numpy array types into buffer 00148 @param buff: buffer 00149 @type buff: StringIO 00150 @param numpy: numpy python module 00151 @type numpy module 00152 """ 00153 try: 00154 _x = self 00155 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00156 _x = self.header.frame_id 00157 length = len(_x) 00158 buff.write(struct.pack('<I%ss'%length, length, _x)) 00159 _x = self.strIdSubDev 00160 length = len(_x) 00161 buff.write(struct.pack('<I%ss'%length, length, _x)) 00162 length = len(self.uiRaw) 00163 buff.write(_struct_I.pack(length)) 00164 pattern = '<%sH'%length 00165 buff.write(self.uiRaw.tostring()) 00166 length = len(self.fVolts) 00167 buff.write(_struct_I.pack(length)) 00168 pattern = '<%sd'%length 00169 buff.write(self.fVolts.tostring()) 00170 except struct.error as se: self._check_types(se) 00171 except TypeError as te: self._check_types(te) 00172 00173 def deserialize_numpy(self, str, numpy): 00174 """ 00175 unpack serialized message in str into this message instance using numpy for array types 00176 @param str: byte array of serialized message 00177 @type str: str 00178 @param numpy: numpy python module 00179 @type numpy: module 00180 """ 00181 try: 00182 if self.header is None: 00183 self.header = std_msgs.msg._Header.Header() 00184 end = 0 00185 _x = self 00186 start = end 00187 end += 12 00188 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00189 start = end 00190 end += 4 00191 (length,) = _struct_I.unpack(str[start:end]) 00192 start = end 00193 end += length 00194 self.header.frame_id = str[start:end] 00195 start = end 00196 end += 4 00197 (length,) = _struct_I.unpack(str[start:end]) 00198 start = end 00199 end += length 00200 self.strIdSubDev = str[start:end] 00201 start = end 00202 end += 4 00203 (length,) = _struct_I.unpack(str[start:end]) 00204 pattern = '<%sH'%length 00205 start = end 00206 end += struct.calcsize(pattern) 00207 self.uiRaw = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=length) 00208 start = end 00209 end += 4 00210 (length,) = _struct_I.unpack(str[start:end]) 00211 pattern = '<%sd'%length 00212 start = end 00213 end += struct.calcsize(pattern) 00214 self.fVolts = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00215 return self 00216 except struct.error as e: 00217 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00218 00219 _struct_I = roslib.message.struct_I 00220 _struct_3I = struct.Struct("<3I")