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


iri_perception_msgs
Author(s):
autogenerated on Fri Dec 6 2013 20:02:15