00001 """autogenerated by genpy from burst_calc/burst.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import neuro_recv.msg
00008 import genpy
00009 import std_msgs.msg
00010
00011 class burst(genpy.Message):
00012 _md5sum = "9fc444266caceed83ebba28b36c432e7"
00013 _type = "burst_calc/burst"
00014 _has_header = True
00015 _full_text = """# Burst message
00016 Header header
00017 time end
00018 int8[] channels
00019 neuro_recv/dish_state[] dishes
00020 ================================================================================
00021 MSG: std_msgs/Header
00022 # Standard metadata for higher-level stamped data types.
00023 # This is generally used to communicate timestamped data
00024 # in a particular coordinate frame.
00025 #
00026 # sequence ID: consecutively increasing ID
00027 uint32 seq
00028 #Two-integer timestamp that is expressed as:
00029 # * stamp.secs: seconds (stamp_secs) since epoch
00030 # * stamp.nsecs: nanoseconds since stamp_secs
00031 # time-handling sugar is provided by the client library
00032 time stamp
00033 #Frame this data is associated with
00034 # 0: no frame
00035 # 1: global frame
00036 string frame_id
00037
00038 ================================================================================
00039 MSG: neuro_recv/dish_state
00040 # Dish state message
00041 Header header
00042 float64[60] samples
00043 bool last_dish
00044 """
00045 __slots__ = ['header','end','channels','dishes']
00046 _slot_types = ['std_msgs/Header','time','int8[]','neuro_recv/dish_state[]']
00047
00048 def __init__(self, *args, **kwds):
00049 """
00050 Constructor. Any message fields that are implicitly/explicitly
00051 set to None will be assigned a default value. The recommend
00052 use is keyword arguments as this is more robust to future message
00053 changes. You cannot mix in-order arguments and keyword arguments.
00054
00055 The available fields are:
00056 header,end,channels,dishes
00057
00058 :param args: complete set of field values, in .msg order
00059 :param kwds: use keyword arguments corresponding to message field names
00060 to set specific fields.
00061 """
00062 if args or kwds:
00063 super(burst, self).__init__(*args, **kwds)
00064
00065 if self.header is None:
00066 self.header = std_msgs.msg.Header()
00067 if self.end is None:
00068 self.end = genpy.Time()
00069 if self.channels is None:
00070 self.channels = []
00071 if self.dishes is None:
00072 self.dishes = []
00073 else:
00074 self.header = std_msgs.msg.Header()
00075 self.end = genpy.Time()
00076 self.channels = []
00077 self.dishes = []
00078
00079 def _get_types(self):
00080 """
00081 internal API method
00082 """
00083 return self._slot_types
00084
00085 def serialize(self, buff):
00086 """
00087 serialize message into buffer
00088 :param buff: buffer, ``StringIO``
00089 """
00090 try:
00091 _x = self
00092 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00093 _x = self.header.frame_id
00094 length = len(_x)
00095 if python3 or type(_x) == unicode:
00096 _x = _x.encode('utf-8')
00097 length = len(_x)
00098 buff.write(struct.pack('<I%ss'%length, length, _x))
00099 _x = self
00100 buff.write(_struct_2I.pack(_x.end.secs, _x.end.nsecs))
00101 length = len(self.channels)
00102 buff.write(_struct_I.pack(length))
00103 pattern = '<%sb'%length
00104 buff.write(struct.pack(pattern, *self.channels))
00105 length = len(self.dishes)
00106 buff.write(_struct_I.pack(length))
00107 for val1 in self.dishes:
00108 _v1 = val1.header
00109 buff.write(_struct_I.pack(_v1.seq))
00110 _v2 = _v1.stamp
00111 _x = _v2
00112 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00113 _x = _v1.frame_id
00114 length = len(_x)
00115 if python3 or type(_x) == unicode:
00116 _x = _x.encode('utf-8')
00117 length = len(_x)
00118 buff.write(struct.pack('<I%ss'%length, length, _x))
00119 buff.write(_struct_60d.pack(*val1.samples))
00120 buff.write(_struct_B.pack(val1.last_dish))
00121 except struct.error as se: self._check_types(se)
00122 except TypeError as te: self._check_types(te)
00123
00124 def deserialize(self, str):
00125 """
00126 unpack serialized message in str into this message instance
00127 :param str: byte array of serialized message, ``str``
00128 """
00129 try:
00130 if self.header is None:
00131 self.header = std_msgs.msg.Header()
00132 if self.end is None:
00133 self.end = genpy.Time()
00134 if self.dishes is None:
00135 self.dishes = None
00136 end = 0
00137 _x = self
00138 start = end
00139 end += 12
00140 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 if python3:
00147 self.header.frame_id = str[start:end].decode('utf-8')
00148 else:
00149 self.header.frame_id = str[start:end]
00150 _x = self
00151 start = end
00152 end += 8
00153 (_x.end.secs, _x.end.nsecs,) = _struct_2I.unpack(str[start:end])
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 pattern = '<%sb'%length
00158 start = end
00159 end += struct.calcsize(pattern)
00160 self.channels = struct.unpack(pattern, str[start:end])
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 self.dishes = []
00165 for i in range(0, length):
00166 val1 = neuro_recv.msg.dish_state()
00167 _v3 = val1.header
00168 start = end
00169 end += 4
00170 (_v3.seq,) = _struct_I.unpack(str[start:end])
00171 _v4 = _v3.stamp
00172 _x = _v4
00173 start = end
00174 end += 8
00175 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 start = end
00180 end += length
00181 if python3:
00182 _v3.frame_id = str[start:end].decode('utf-8')
00183 else:
00184 _v3.frame_id = str[start:end]
00185 start = end
00186 end += 480
00187 val1.samples = _struct_60d.unpack(str[start:end])
00188 start = end
00189 end += 1
00190 (val1.last_dish,) = _struct_B.unpack(str[start:end])
00191 val1.last_dish = bool(val1.last_dish)
00192 self.dishes.append(val1)
00193 self.end.canon()
00194 return self
00195 except struct.error as e:
00196 raise genpy.DeserializationError(e)
00197
00198
00199 def serialize_numpy(self, buff, numpy):
00200 """
00201 serialize message with numpy array types into buffer
00202 :param buff: buffer, ``StringIO``
00203 :param numpy: numpy python module
00204 """
00205 try:
00206 _x = self
00207 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00208 _x = self.header.frame_id
00209 length = len(_x)
00210 if python3 or type(_x) == unicode:
00211 _x = _x.encode('utf-8')
00212 length = len(_x)
00213 buff.write(struct.pack('<I%ss'%length, length, _x))
00214 _x = self
00215 buff.write(_struct_2I.pack(_x.end.secs, _x.end.nsecs))
00216 length = len(self.channels)
00217 buff.write(_struct_I.pack(length))
00218 pattern = '<%sb'%length
00219 buff.write(self.channels.tostring())
00220 length = len(self.dishes)
00221 buff.write(_struct_I.pack(length))
00222 for val1 in self.dishes:
00223 _v5 = val1.header
00224 buff.write(_struct_I.pack(_v5.seq))
00225 _v6 = _v5.stamp
00226 _x = _v6
00227 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00228 _x = _v5.frame_id
00229 length = len(_x)
00230 if python3 or type(_x) == unicode:
00231 _x = _x.encode('utf-8')
00232 length = len(_x)
00233 buff.write(struct.pack('<I%ss'%length, length, _x))
00234 buff.write(val1.samples.tostring())
00235 buff.write(_struct_B.pack(val1.last_dish))
00236 except struct.error as se: self._check_types(se)
00237 except TypeError as te: self._check_types(te)
00238
00239 def deserialize_numpy(self, str, numpy):
00240 """
00241 unpack serialized message in str into this message instance using numpy for array types
00242 :param str: byte array of serialized message, ``str``
00243 :param numpy: numpy python module
00244 """
00245 try:
00246 if self.header is None:
00247 self.header = std_msgs.msg.Header()
00248 if self.end is None:
00249 self.end = genpy.Time()
00250 if self.dishes is None:
00251 self.dishes = None
00252 end = 0
00253 _x = self
00254 start = end
00255 end += 12
00256 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 start = end
00261 end += length
00262 if python3:
00263 self.header.frame_id = str[start:end].decode('utf-8')
00264 else:
00265 self.header.frame_id = str[start:end]
00266 _x = self
00267 start = end
00268 end += 8
00269 (_x.end.secs, _x.end.nsecs,) = _struct_2I.unpack(str[start:end])
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 pattern = '<%sb'%length
00274 start = end
00275 end += struct.calcsize(pattern)
00276 self.channels = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00277 start = end
00278 end += 4
00279 (length,) = _struct_I.unpack(str[start:end])
00280 self.dishes = []
00281 for i in range(0, length):
00282 val1 = neuro_recv.msg.dish_state()
00283 _v7 = val1.header
00284 start = end
00285 end += 4
00286 (_v7.seq,) = _struct_I.unpack(str[start:end])
00287 _v8 = _v7.stamp
00288 _x = _v8
00289 start = end
00290 end += 8
00291 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00292 start = end
00293 end += 4
00294 (length,) = _struct_I.unpack(str[start:end])
00295 start = end
00296 end += length
00297 if python3:
00298 _v7.frame_id = str[start:end].decode('utf-8')
00299 else:
00300 _v7.frame_id = str[start:end]
00301 start = end
00302 end += 480
00303 val1.samples = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=60)
00304 start = end
00305 end += 1
00306 (val1.last_dish,) = _struct_B.unpack(str[start:end])
00307 val1.last_dish = bool(val1.last_dish)
00308 self.dishes.append(val1)
00309 self.end.canon()
00310 return self
00311 except struct.error as e:
00312 raise genpy.DeserializationError(e)
00313
00314 _struct_I = genpy.struct_I
00315 _struct_60d = struct.Struct("<60d")
00316 _struct_3I = struct.Struct("<3I")
00317 _struct_B = struct.Struct("<B")
00318 _struct_2I = struct.Struct("<2I")