00001 """autogenerated by genmsg_py from OctomapBinary.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class OctomapBinary(roslib.message.Message):
00008 _md5sum = "76e8caca558be0db7a08d3479289f362"
00009 _type = "octomap_ros/OctomapBinary"
00010 _has_header = True
00011 _full_text = """# A 3D map in binary format, as Octree
00012 Header header
00013 int8[] data
00014 ================================================================================
00015 MSG: std_msgs/Header
00016 # Standard metadata for higher-level stamped data types.
00017 # This is generally used to communicate timestamped data
00018 # in a particular coordinate frame.
00019 #
00020 # sequence ID: consecutively increasing ID
00021 uint32 seq
00022 #Two-integer timestamp that is expressed as:
00023 # * stamp.secs: seconds (stamp_secs) since epoch
00024 # * stamp.nsecs: nanoseconds since stamp_secs
00025 # time-handling sugar is provided by the client library
00026 time stamp
00027 #Frame this data is associated with
00028 # 0: no frame
00029 # 1: global frame
00030 string frame_id
00031
00032 """
00033 __slots__ = ['header','data']
00034 _slot_types = ['Header','int8[]']
00035
00036 def __init__(self, *args, **kwds):
00037 """
00038 Constructor. Any message fields that are implicitly/explicitly
00039 set to None will be assigned a default value. The recommend
00040 use is keyword arguments as this is more robust to future message
00041 changes. You cannot mix in-order arguments and keyword arguments.
00042
00043 The available fields are:
00044 header,data
00045
00046 @param args: complete set of field values, in .msg order
00047 @param kwds: use keyword arguments corresponding to message field names
00048 to set specific fields.
00049 """
00050 if args or kwds:
00051 super(OctomapBinary, self).__init__(*args, **kwds)
00052
00053 if self.header is None:
00054 self.header = std_msgs.msg._Header.Header()
00055 if self.data is None:
00056 self.data = []
00057 else:
00058 self.header = std_msgs.msg._Header.Header()
00059 self.data = []
00060
00061 def _get_types(self):
00062 """
00063 internal API method
00064 """
00065 return self._slot_types
00066
00067 def serialize(self, buff):
00068 """
00069 serialize message into buffer
00070 @param buff: buffer
00071 @type buff: StringIO
00072 """
00073 try:
00074 _x = self
00075 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00076 _x = self.header.frame_id
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 length = len(self.data)
00080 buff.write(_struct_I.pack(length))
00081 pattern = '<%sb'%length
00082 buff.write(struct.pack(pattern, *self.data))
00083 except struct.error, se: self._check_types(se)
00084 except TypeError, te: self._check_types(te)
00085
00086 def deserialize(self, str):
00087 """
00088 unpack serialized message in str into this message instance
00089 @param str: byte array of serialized message
00090 @type str: str
00091 """
00092 try:
00093 if self.header is None:
00094 self.header = std_msgs.msg._Header.Header()
00095 end = 0
00096 _x = self
00097 start = end
00098 end += 12
00099 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00100 start = end
00101 end += 4
00102 (length,) = _struct_I.unpack(str[start:end])
00103 start = end
00104 end += length
00105 self.header.frame_id = str[start:end]
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 pattern = '<%sb'%length
00110 start = end
00111 end += struct.calcsize(pattern)
00112 self.data = struct.unpack(pattern, str[start:end])
00113 return self
00114 except struct.error, e:
00115 raise roslib.message.DeserializationError(e)
00116
00117
00118 def serialize_numpy(self, buff, numpy):
00119 """
00120 serialize message with numpy array types into buffer
00121 @param buff: buffer
00122 @type buff: StringIO
00123 @param numpy: numpy python module
00124 @type numpy module
00125 """
00126 try:
00127 _x = self
00128 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00129 _x = self.header.frame_id
00130 length = len(_x)
00131 buff.write(struct.pack('<I%ss'%length, length, _x))
00132 length = len(self.data)
00133 buff.write(_struct_I.pack(length))
00134 pattern = '<%sb'%length
00135 buff.write(self.data.tostring())
00136 except struct.error, se: self._check_types(se)
00137 except TypeError, te: self._check_types(te)
00138
00139 def deserialize_numpy(self, str, numpy):
00140 """
00141 unpack serialized message in str into this message instance using numpy for array types
00142 @param str: byte array of serialized message
00143 @type str: str
00144 @param numpy: numpy python module
00145 @type numpy: module
00146 """
00147 try:
00148 if self.header is None:
00149 self.header = std_msgs.msg._Header.Header()
00150 end = 0
00151 _x = self
00152 start = end
00153 end += 12
00154 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00155 start = end
00156 end += 4
00157 (length,) = _struct_I.unpack(str[start:end])
00158 start = end
00159 end += length
00160 self.header.frame_id = str[start:end]
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 pattern = '<%sb'%length
00165 start = end
00166 end += struct.calcsize(pattern)
00167 self.data = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00168 return self
00169 except struct.error, e:
00170 raise roslib.message.DeserializationError(e)
00171
00172 _struct_I = roslib.message.struct_I
00173 _struct_3I = struct.Struct("<3I")