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


map_msgs
Author(s): Stéphane Magnenat
autogenerated on Fri May 31 2013 08:22:01