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