_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 include/sensor_msgs/image_encodings.h
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       self.image.data = str[start:end]
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 
00206   def serialize_numpy(self, buff, numpy):
00207     """
00208     serialize message with numpy array types into buffer
00209     :param buff: buffer, ``StringIO``
00210     :param numpy: numpy python module
00211     """
00212     try:
00213       buff.write(_struct_i.pack(self.objectId))
00214       _x = self.description
00215       length = len(_x)
00216       if python3 or type(_x) == unicode:
00217         _x = _x.encode('utf-8')
00218         length = len(_x)
00219       buff.write(struct.pack('<I%ss'%length, length, _x))
00220       _x = self
00221       buff.write(_struct_3I.pack(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs))
00222       _x = self.image.header.frame_id
00223       length = len(_x)
00224       if python3 or type(_x) == unicode:
00225         _x = _x.encode('utf-8')
00226         length = len(_x)
00227       buff.write(struct.pack('<I%ss'%length, length, _x))
00228       _x = self
00229       buff.write(_struct_2I.pack(_x.image.height, _x.image.width))
00230       _x = self.image.encoding
00231       length = len(_x)
00232       if python3 or type(_x) == unicode:
00233         _x = _x.encode('utf-8')
00234         length = len(_x)
00235       buff.write(struct.pack('<I%ss'%length, length, _x))
00236       _x = self
00237       buff.write(_struct_BI.pack(_x.image.is_bigendian, _x.image.step))
00238       _x = self.image.data
00239       length = len(_x)
00240       # - if encoded as a list instead, serialize as bytes instead of string
00241       if type(_x) in [list, tuple]:
00242         buff.write(struct.pack('<I%sB'%length, length, *_x))
00243       else:
00244         buff.write(struct.pack('<I%ss'%length, length, _x))
00245     except struct.error as se: self._check_types(se)
00246     except TypeError as te: self._check_types(te)
00247 
00248   def deserialize_numpy(self, str, numpy):
00249     """
00250     unpack serialized message in str into this message instance using numpy for array types
00251     :param str: byte array of serialized message, ``str``
00252     :param numpy: numpy python module
00253     """
00254     try:
00255       if self.image is None:
00256         self.image = sensor_msgs.msg.Image()
00257       end = 0
00258       start = end
00259       end += 4
00260       (self.objectId,) = _struct_i.unpack(str[start:end])
00261       start = end
00262       end += 4
00263       (length,) = _struct_I.unpack(str[start:end])
00264       start = end
00265       end += length
00266       if python3:
00267         self.description = str[start:end].decode('utf-8')
00268       else:
00269         self.description = str[start:end]
00270       _x = self
00271       start = end
00272       end += 12
00273       (_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00274       start = end
00275       end += 4
00276       (length,) = _struct_I.unpack(str[start:end])
00277       start = end
00278       end += length
00279       if python3:
00280         self.image.header.frame_id = str[start:end].decode('utf-8')
00281       else:
00282         self.image.header.frame_id = str[start:end]
00283       _x = self
00284       start = end
00285       end += 8
00286       (_x.image.height, _x.image.width,) = _struct_2I.unpack(str[start:end])
00287       start = end
00288       end += 4
00289       (length,) = _struct_I.unpack(str[start:end])
00290       start = end
00291       end += length
00292       if python3:
00293         self.image.encoding = str[start:end].decode('utf-8')
00294       else:
00295         self.image.encoding = str[start:end]
00296       _x = self
00297       start = end
00298       end += 5
00299       (_x.image.is_bigendian, _x.image.step,) = _struct_BI.unpack(str[start:end])
00300       start = end
00301       end += 4
00302       (length,) = _struct_I.unpack(str[start:end])
00303       start = end
00304       end += length
00305       self.image.data = str[start:end]
00306       return self
00307     except struct.error as e:
00308       raise genpy.DeserializationError(e) #most likely buffer underfill
00309 
00310 _struct_I = genpy.struct_I
00311 _struct_i = struct.Struct("<i")
00312 _struct_3I = struct.Struct("<3I")
00313 _struct_2I = struct.Struct("<2I")
00314 _struct_BI = struct.Struct("<BI")


srs_object_database_msgs
Author(s): Georg Arbeiter
autogenerated on Wed Nov 27 2013 14:14:38