_img.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_object_database_msgs/img.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 import sensor_msgs.msg
00009 
00010 class img(genpy.Message):
00011   _md5sum = "9da746f1baa4582f8aa96ba1de78088c"
00012   _type = "srs_object_database_msgs/img"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """int32 objectId
00015 string description
00016 sensor_msgs/Image image
00017 ================================================================================
00018 MSG: sensor_msgs/Image
00019 # This message contains an uncompressed image
00020 # (0, 0) is at top-left corner of image
00021 #
00022 
00023 Header header        # Header timestamp should be acquisition time of image
00024                      # Header frame_id should be optical frame of camera
00025                      # origin of frame should be optical center of cameara
00026                      # +x should point to the right in the image
00027                      # +y should point down in the image
00028                      # +z should point into to plane of the image
00029                      # If the frame_id here and the frame_id of the CameraInfo
00030                      # message associated with the image conflict
00031                      # the behavior is undefined
00032 
00033 uint32 height         # image height, that is, number of rows
00034 uint32 width          # image width, that is, number of columns
00035 
00036 # The legal values for encoding are in file src/image_encodings.cpp
00037 # If you want to standardize a new string format, join
00038 # ros-users@lists.sourceforge.net and send an email proposing a new encoding.
00039 
00040 string encoding       # Encoding of pixels -- channel meaning, ordering, size
00041                       # taken from the list of strings in src/image_encodings.cpp
00042 
00043 uint8 is_bigendian    # is this data bigendian?
00044 uint32 step           # Full row length in bytes
00045 uint8[] data          # actual matrix data, size is (step * rows)
00046 
00047 ================================================================================
00048 MSG: std_msgs/Header
00049 # Standard metadata for higher-level stamped data types.
00050 # This is generally used to communicate timestamped data 
00051 # in a particular coordinate frame.
00052 # 
00053 # sequence ID: consecutively increasing ID 
00054 uint32 seq
00055 #Two-integer timestamp that is expressed as:
00056 # * stamp.secs: seconds (stamp_secs) since epoch
00057 # * stamp.nsecs: nanoseconds since stamp_secs
00058 # time-handling sugar is provided by the client library
00059 time stamp
00060 #Frame this data is associated with
00061 # 0: no frame
00062 # 1: global frame
00063 string frame_id
00064 
00065 """
00066   __slots__ = ['objectId','description','image']
00067   _slot_types = ['int32','string','sensor_msgs/Image']
00068 
00069   def __init__(self, *args, **kwds):
00070     """
00071     Constructor. Any message fields that are implicitly/explicitly
00072     set to None will be assigned a default value. The recommend
00073     use is keyword arguments as this is more robust to future message
00074     changes.  You cannot mix in-order arguments and keyword arguments.
00075 
00076     The available fields are:
00077        objectId,description,image
00078 
00079     :param args: complete set of field values, in .msg order
00080     :param kwds: use keyword arguments corresponding to message field names
00081     to set specific fields.
00082     """
00083     if args or kwds:
00084       super(img, self).__init__(*args, **kwds)
00085       #message fields cannot be None, assign default values for those that are
00086       if self.objectId is None:
00087         self.objectId = 0
00088       if self.description is None:
00089         self.description = ''
00090       if self.image is None:
00091         self.image = sensor_msgs.msg.Image()
00092     else:
00093       self.objectId = 0
00094       self.description = ''
00095       self.image = sensor_msgs.msg.Image()
00096 
00097   def _get_types(self):
00098     """
00099     internal API method
00100     """
00101     return self._slot_types
00102 
00103   def serialize(self, buff):
00104     """
00105     serialize message into buffer
00106     :param buff: buffer, ``StringIO``
00107     """
00108     try:
00109       buff.write(_struct_i.pack(self.objectId))
00110       _x = self.description
00111       length = len(_x)
00112       if python3 or type(_x) == unicode:
00113         _x = _x.encode('utf-8')
00114         length = len(_x)
00115       buff.write(struct.pack('<I%ss'%length, length, _x))
00116       _x = self
00117       buff.write(_struct_3I.pack(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs))
00118       _x = self.image.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_2I.pack(_x.image.height, _x.image.width))
00126       _x = self.image.encoding
00127       length = len(_x)
00128       if python3 or type(_x) == unicode:
00129         _x = _x.encode('utf-8')
00130         length = len(_x)
00131       buff.write(struct.pack('<I%ss'%length, length, _x))
00132       _x = self
00133       buff.write(_struct_BI.pack(_x.image.is_bigendian, _x.image.step))
00134       _x = self.image.data
00135       length = len(_x)
00136       # - if encoded as a list instead, serialize as bytes instead of string
00137       if type(_x) in [list, tuple]:
00138         buff.write(struct.pack('<I%sB'%length, length, *_x))
00139       else:
00140         buff.write(struct.pack('<I%ss'%length, length, _x))
00141     except struct.error as se: self._check_types(se)
00142     except TypeError as te: self._check_types(te)
00143 
00144   def deserialize(self, str):
00145     """
00146     unpack serialized message in str into this message instance
00147     :param str: byte array of serialized message, ``str``
00148     """
00149     try:
00150       if self.image is None:
00151         self.image = sensor_msgs.msg.Image()
00152       end = 0
00153       start = end
00154       end += 4
00155       (self.objectId,) = _struct_i.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.description = str[start:end].decode('utf-8')
00163       else:
00164         self.description = str[start:end]
00165       _x = self
00166       start = end
00167       end += 12
00168       (_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       start = end
00173       end += length
00174       if python3:
00175         self.image.header.frame_id = str[start:end].decode('utf-8')
00176       else:
00177         self.image.header.frame_id = str[start:end]
00178       _x = self
00179       start = end
00180       end += 8
00181       (_x.image.height, _x.image.width,) = _struct_2I.unpack(str[start:end])
00182       start = end
00183       end += 4
00184       (length,) = _struct_I.unpack(str[start:end])
00185       start = end
00186       end += length
00187       if python3:
00188         self.image.encoding = str[start:end].decode('utf-8')
00189       else:
00190         self.image.encoding = str[start:end]
00191       _x = self
00192       start = end
00193       end += 5
00194       (_x.image.is_bigendian, _x.image.step,) = _struct_BI.unpack(str[start:end])
00195       start = end
00196       end += 4
00197       (length,) = _struct_I.unpack(str[start:end])
00198       start = end
00199       end += length
00200       if python3:
00201         self.image.data = str[start:end].decode('utf-8')
00202       else:
00203         self.image.data = str[start:end]
00204       return self
00205     except struct.error as e:
00206       raise genpy.DeserializationError(e) #most likely buffer underfill
00207 
00208 
00209   def serialize_numpy(self, buff, numpy):
00210     """
00211     serialize message with numpy array types into buffer
00212     :param buff: buffer, ``StringIO``
00213     :param numpy: numpy python module
00214     """
00215     try:
00216       buff.write(_struct_i.pack(self.objectId))
00217       _x = self.description
00218       length = len(_x)
00219       if python3 or type(_x) == unicode:
00220         _x = _x.encode('utf-8')
00221         length = len(_x)
00222       buff.write(struct.pack('<I%ss'%length, length, _x))
00223       _x = self
00224       buff.write(_struct_3I.pack(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs))
00225       _x = self.image.header.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 = self
00232       buff.write(_struct_2I.pack(_x.image.height, _x.image.width))
00233       _x = self.image.encoding
00234       length = len(_x)
00235       if python3 or type(_x) == unicode:
00236         _x = _x.encode('utf-8')
00237         length = len(_x)
00238       buff.write(struct.pack('<I%ss'%length, length, _x))
00239       _x = self
00240       buff.write(_struct_BI.pack(_x.image.is_bigendian, _x.image.step))
00241       _x = self.image.data
00242       length = len(_x)
00243       # - if encoded as a list instead, serialize as bytes instead of string
00244       if type(_x) in [list, tuple]:
00245         buff.write(struct.pack('<I%sB'%length, length, *_x))
00246       else:
00247         buff.write(struct.pack('<I%ss'%length, length, _x))
00248     except struct.error as se: self._check_types(se)
00249     except TypeError as te: self._check_types(te)
00250 
00251   def deserialize_numpy(self, str, numpy):
00252     """
00253     unpack serialized message in str into this message instance using numpy for array types
00254     :param str: byte array of serialized message, ``str``
00255     :param numpy: numpy python module
00256     """
00257     try:
00258       if self.image is None:
00259         self.image = sensor_msgs.msg.Image()
00260       end = 0
00261       start = end
00262       end += 4
00263       (self.objectId,) = _struct_i.unpack(str[start:end])
00264       start = end
00265       end += 4
00266       (length,) = _struct_I.unpack(str[start:end])
00267       start = end
00268       end += length
00269       if python3:
00270         self.description = str[start:end].decode('utf-8')
00271       else:
00272         self.description = str[start:end]
00273       _x = self
00274       start = end
00275       end += 12
00276       (_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00277       start = end
00278       end += 4
00279       (length,) = _struct_I.unpack(str[start:end])
00280       start = end
00281       end += length
00282       if python3:
00283         self.image.header.frame_id = str[start:end].decode('utf-8')
00284       else:
00285         self.image.header.frame_id = str[start:end]
00286       _x = self
00287       start = end
00288       end += 8
00289       (_x.image.height, _x.image.width,) = _struct_2I.unpack(str[start:end])
00290       start = end
00291       end += 4
00292       (length,) = _struct_I.unpack(str[start:end])
00293       start = end
00294       end += length
00295       if python3:
00296         self.image.encoding = str[start:end].decode('utf-8')
00297       else:
00298         self.image.encoding = str[start:end]
00299       _x = self
00300       start = end
00301       end += 5
00302       (_x.image.is_bigendian, _x.image.step,) = _struct_BI.unpack(str[start:end])
00303       start = end
00304       end += 4
00305       (length,) = _struct_I.unpack(str[start:end])
00306       start = end
00307       end += length
00308       if python3:
00309         self.image.data = str[start:end].decode('utf-8')
00310       else:
00311         self.image.data = str[start:end]
00312       return self
00313     except struct.error as e:
00314       raise genpy.DeserializationError(e) #most likely buffer underfill
00315 
00316 _struct_I = genpy.struct_I
00317 _struct_i = struct.Struct("<i")
00318 _struct_3I = struct.Struct("<3I")
00319 _struct_2I = struct.Struct("<2I")
00320 _struct_BI = struct.Struct("<BI")


srs_object_database_msgs
Author(s): Georg Arbeiter
autogenerated on Sun Jan 5 2014 11:36:25