00001 """autogenerated by genpy from burst_calc/cat.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 burst_calc.msg
00008 import genpy
00009 import std_msgs.msg
00010
00011 class cat(genpy.Message):
00012 _md5sum = "a9e7efbd18f40d368e9f31f27d0c183b"
00013 _type = "burst_calc/cat"
00014 _has_header = True
00015 _full_text = """# Center of activity trajectory message
00016 Header header
00017 time end
00018 int8[] channels
00019 ca[] cas
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: burst_calc/ca
00040 # Center of activity message
00041 Header header
00042 float64 x
00043 float64 y
00044 """
00045 __slots__ = ['header','end','channels','cas']
00046 _slot_types = ['std_msgs/Header','time','int8[]','burst_calc/ca[]']
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,cas
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(cat, 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.cas is None:
00072 self.cas = []
00073 else:
00074 self.header = std_msgs.msg.Header()
00075 self.end = genpy.Time()
00076 self.channels = []
00077 self.cas = []
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.cas)
00106 buff.write(_struct_I.pack(length))
00107 for val1 in self.cas:
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 _x = val1
00120 buff.write(_struct_2d.pack(_x.x, _x.y))
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.cas is None:
00135 self.cas = 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.cas = []
00165 for i in range(0, length):
00166 val1 = burst_calc.msg.ca()
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 _x = val1
00186 start = end
00187 end += 16
00188 (_x.x, _x.y,) = _struct_2d.unpack(str[start:end])
00189 self.cas.append(val1)
00190 self.end.canon()
00191 return self
00192 except struct.error as e:
00193 raise genpy.DeserializationError(e)
00194
00195
00196 def serialize_numpy(self, buff, numpy):
00197 """
00198 serialize message with numpy array types into buffer
00199 :param buff: buffer, ``StringIO``
00200 :param numpy: numpy python module
00201 """
00202 try:
00203 _x = self
00204 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00205 _x = self.header.frame_id
00206 length = len(_x)
00207 if python3 or type(_x) == unicode:
00208 _x = _x.encode('utf-8')
00209 length = len(_x)
00210 buff.write(struct.pack('<I%ss'%length, length, _x))
00211 _x = self
00212 buff.write(_struct_2I.pack(_x.end.secs, _x.end.nsecs))
00213 length = len(self.channels)
00214 buff.write(_struct_I.pack(length))
00215 pattern = '<%sb'%length
00216 buff.write(self.channels.tostring())
00217 length = len(self.cas)
00218 buff.write(_struct_I.pack(length))
00219 for val1 in self.cas:
00220 _v5 = val1.header
00221 buff.write(_struct_I.pack(_v5.seq))
00222 _v6 = _v5.stamp
00223 _x = _v6
00224 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00225 _x = _v5.frame_id
00226 length = len(_x)
00227 if python3 or type(_x) == unicode:
00228 _x = _x.encode('utf-8')
00229 length = len(_x)
00230 buff.write(struct.pack('<I%ss'%length, length, _x))
00231 _x = val1
00232 buff.write(_struct_2d.pack(_x.x, _x.y))
00233 except struct.error as se: self._check_types(se)
00234 except TypeError as te: self._check_types(te)
00235
00236 def deserialize_numpy(self, str, numpy):
00237 """
00238 unpack serialized message in str into this message instance using numpy for array types
00239 :param str: byte array of serialized message, ``str``
00240 :param numpy: numpy python module
00241 """
00242 try:
00243 if self.header is None:
00244 self.header = std_msgs.msg.Header()
00245 if self.end is None:
00246 self.end = genpy.Time()
00247 if self.cas is None:
00248 self.cas = None
00249 end = 0
00250 _x = self
00251 start = end
00252 end += 12
00253 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00254 start = end
00255 end += 4
00256 (length,) = _struct_I.unpack(str[start:end])
00257 start = end
00258 end += length
00259 if python3:
00260 self.header.frame_id = str[start:end].decode('utf-8')
00261 else:
00262 self.header.frame_id = str[start:end]
00263 _x = self
00264 start = end
00265 end += 8
00266 (_x.end.secs, _x.end.nsecs,) = _struct_2I.unpack(str[start:end])
00267 start = end
00268 end += 4
00269 (length,) = _struct_I.unpack(str[start:end])
00270 pattern = '<%sb'%length
00271 start = end
00272 end += struct.calcsize(pattern)
00273 self.channels = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00274 start = end
00275 end += 4
00276 (length,) = _struct_I.unpack(str[start:end])
00277 self.cas = []
00278 for i in range(0, length):
00279 val1 = burst_calc.msg.ca()
00280 _v7 = val1.header
00281 start = end
00282 end += 4
00283 (_v7.seq,) = _struct_I.unpack(str[start:end])
00284 _v8 = _v7.stamp
00285 _x = _v8
00286 start = end
00287 end += 8
00288 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00289 start = end
00290 end += 4
00291 (length,) = _struct_I.unpack(str[start:end])
00292 start = end
00293 end += length
00294 if python3:
00295 _v7.frame_id = str[start:end].decode('utf-8')
00296 else:
00297 _v7.frame_id = str[start:end]
00298 _x = val1
00299 start = end
00300 end += 16
00301 (_x.x, _x.y,) = _struct_2d.unpack(str[start:end])
00302 self.cas.append(val1)
00303 self.end.canon()
00304 return self
00305 except struct.error as e:
00306 raise genpy.DeserializationError(e)
00307
00308 _struct_I = genpy.struct_I
00309 _struct_2d = struct.Struct("<2d")
00310 _struct_3I = struct.Struct("<3I")
00311 _struct_2I = struct.Struct("<2I")