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