00001 """autogenerated by genmsg_py from PolygonalMap.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import sensor_msgs.msg
00006 import geometry_msgs.msg
00007 import std_msgs.msg
00008
00009 class PolygonalMap(roslib.message.Message):
00010 _md5sum = "3ef041ea9abaaa9dac3e5aec60c68a99"
00011 _type = "mapping_msgs/PolygonalMap"
00012 _has_header = True
00013 _full_text = """Header header
00014 geometry_msgs/Polygon[] polygons
00015 sensor_msgs/ChannelFloat32[] chan
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 ================================================================================
00036 MSG: geometry_msgs/Polygon
00037 #A specification of a polygon where the first and last points are assumed to be connected
00038 geometry_msgs/Point32[] points
00039
00040 ================================================================================
00041 MSG: geometry_msgs/Point32
00042 # This contains the position of a point in free space(with 32 bits of precision).
00043 # It is recommeded to use Point wherever possible instead of Point32.
00044 #
00045 # This recommendation is to promote interoperability.
00046 #
00047 # This message is designed to take up less space when sending
00048 # lots of points at once, as in the case of a PointCloud.
00049
00050 float32 x
00051 float32 y
00052 float32 z
00053 ================================================================================
00054 MSG: sensor_msgs/ChannelFloat32
00055 # This message is used by the PointCloud message to hold optional data
00056 # associated with each point in the cloud. The length of the values
00057 # array should be the same as the length of the points array in the
00058 # PointCloud, and each value should be associated with the corresponding
00059 # point.
00060
00061 # Channel names in existing practice include:
00062 # "u", "v" - row and column (respectively) in the left stereo image.
00063 # This is opposite to usual conventions but remains for
00064 # historical reasons. The newer PointCloud2 message has no
00065 # such problem.
00066 # "rgb" - For point clouds produced by color stereo cameras. uint8
00067 # (R,G,B) values packed into the least significant 24 bits,
00068 # in order.
00069 # "intensity" - laser or pixel intensity.
00070 # "distance"
00071
00072 # The channel name should give semantics of the channel (e.g.
00073 # "intensity" instead of "value").
00074 string name
00075
00076 # The values array should be 1-1 with the elements of the associated
00077 # PointCloud.
00078 float32[] values
00079
00080 """
00081 __slots__ = ['header','polygons','chan']
00082 _slot_types = ['Header','geometry_msgs/Polygon[]','sensor_msgs/ChannelFloat32[]']
00083
00084 def __init__(self, *args, **kwds):
00085 """
00086 Constructor. Any message fields that are implicitly/explicitly
00087 set to None will be assigned a default value. The recommend
00088 use is keyword arguments as this is more robust to future message
00089 changes. You cannot mix in-order arguments and keyword arguments.
00090
00091 The available fields are:
00092 header,polygons,chan
00093
00094 @param args: complete set of field values, in .msg order
00095 @param kwds: use keyword arguments corresponding to message field names
00096 to set specific fields.
00097 """
00098 if args or kwds:
00099 super(PolygonalMap, self).__init__(*args, **kwds)
00100 #message fields cannot be None, assign default values for those that are
00101 if self.header is None:
00102 self.header = std_msgs.msg._Header.Header()
00103 if self.polygons is None:
00104 self.polygons = []
00105 if self.chan is None:
00106 self.chan = []
00107 else:
00108 self.header = std_msgs.msg._Header.Header()
00109 self.polygons = []
00110 self.chan = []
00111
00112 def _get_types(self):
00113 """
00114 internal API method
00115 """
00116 return self._slot_types
00117
00118 def serialize(self, buff):
00119 """
00120 serialize message into buffer
00121 @param buff: buffer
00122 @type buff: StringIO
00123 """
00124 try:
00125 _x = self
00126 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00127 _x = self.header.frame_id
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 length = len(self.polygons)
00131 buff.write(_struct_I.pack(length))
00132 for val1 in self.polygons:
00133 length = len(val1.points)
00134 buff.write(_struct_I.pack(length))
00135 for val2 in val1.points:
00136 _x = val2
00137 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00138 length = len(self.chan)
00139 buff.write(_struct_I.pack(length))
00140 for val1 in self.chan:
00141 _x = val1.name
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 length = len(val1.values)
00145 buff.write(_struct_I.pack(length))
00146 pattern = '<%sf'%length
00147 buff.write(struct.pack(pattern, *val1.values))
00148 except struct.error, se: self._check_types(se)
00149 except TypeError, te: self._check_types(te)
00150
00151 def deserialize(self, str):
00152 """
00153 unpack serialized message in str into this message instance
00154 @param str: byte array of serialized message
00155 @type str: str
00156 """
00157 try:
00158 if self.header is None:
00159 self.header = std_msgs.msg._Header.Header()
00160 end = 0
00161 _x = self
00162 start = end
00163 end += 12
00164 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00165 start = end
00166 end += 4
00167 (length,) = _struct_I.unpack(str[start:end])
00168 start = end
00169 end += length
00170 self.header.frame_id = str[start:end]
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 self.polygons = []
00175 for i in xrange(0, length):
00176 val1 = geometry_msgs.msg.Polygon()
00177 start = end
00178 end += 4
00179 (length,) = _struct_I.unpack(str[start:end])
00180 val1.points = []
00181 for i in xrange(0, length):
00182 val2 = geometry_msgs.msg.Point32()
00183 _x = val2
00184 start = end
00185 end += 12
00186 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00187 val1.points.append(val2)
00188 self.polygons.append(val1)
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 self.chan = []
00193 for i in xrange(0, length):
00194 val1 = sensor_msgs.msg.ChannelFloat32()
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 start = end
00199 end += length
00200 val1.name = str[start:end]
00201 start = end
00202 end += 4
00203 (length,) = _struct_I.unpack(str[start:end])
00204 pattern = '<%sf'%length
00205 start = end
00206 end += struct.calcsize(pattern)
00207 val1.values = struct.unpack(pattern, str[start:end])
00208 self.chan.append(val1)
00209 return self
00210 except struct.error, e:
00211 raise roslib.message.DeserializationError(e) #most likely buffer underfill
00212
00213
00214 def serialize_numpy(self, buff, numpy):
00215 """
00216 serialize message with numpy array types into buffer
00217 @param buff: buffer
00218 @type buff: StringIO
00219 @param numpy: numpy python module
00220 @type numpy module
00221 """
00222 try:
00223 _x = self
00224 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00225 _x = self.header.frame_id
00226 length = len(_x)
00227 buff.write(struct.pack('<I%ss'%length, length, _x))
00228 length = len(self.polygons)
00229 buff.write(_struct_I.pack(length))
00230 for val1 in self.polygons:
00231 length = len(val1.points)
00232 buff.write(_struct_I.pack(length))
00233 for val2 in val1.points:
00234 _x = val2
00235 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00236 length = len(self.chan)
00237 buff.write(_struct_I.pack(length))
00238 for val1 in self.chan:
00239 _x = val1.name
00240 length = len(_x)
00241 buff.write(struct.pack('<I%ss'%length, length, _x))
00242 length = len(val1.values)
00243 buff.write(_struct_I.pack(length))
00244 pattern = '<%sf'%length
00245 buff.write(val1.values.tostring())
00246 except struct.error, se: self._check_types(se)
00247 except TypeError, te: self._check_types(te)
00248
00249 def deserialize_numpy(self, str, numpy):
00250 """
00251 unpack serialized message in str into this message instance using numpy for array types
00252 @param str: byte array of serialized message
00253 @type str: str
00254 @param numpy: numpy python module
00255 @type numpy: module
00256 """
00257 try:
00258 if self.header is None:
00259 self.header = std_msgs.msg._Header.Header()
00260 end = 0
00261 _x = self
00262 start = end
00263 end += 12
00264 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00265 start = end
00266 end += 4
00267 (length,) = _struct_I.unpack(str[start:end])
00268 start = end
00269 end += length
00270 self.header.frame_id = str[start:end]
00271 start = end
00272 end += 4
00273 (length,) = _struct_I.unpack(str[start:end])
00274 self.polygons = []
00275 for i in xrange(0, length):
00276 val1 = geometry_msgs.msg.Polygon()
00277 start = end
00278 end += 4
00279 (length,) = _struct_I.unpack(str[start:end])
00280 val1.points = []
00281 for i in xrange(0, length):
00282 val2 = geometry_msgs.msg.Point32()
00283 _x = val2
00284 start = end
00285 end += 12
00286 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00287 val1.points.append(val2)
00288 self.polygons.append(val1)
00289 start = end
00290 end += 4
00291 (length,) = _struct_I.unpack(str[start:end])
00292 self.chan = []
00293 for i in xrange(0, length):
00294 val1 = sensor_msgs.msg.ChannelFloat32()
00295 start = end
00296 end += 4
00297 (length,) = _struct_I.unpack(str[start:end])
00298 start = end
00299 end += length
00300 val1.name = str[start:end]
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 pattern = '<%sf'%length
00305 start = end
00306 end += struct.calcsize(pattern)
00307 val1.values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00308 self.chan.append(val1)
00309 return self
00310 except struct.error, e:
00311 raise roslib.message.DeserializationError(e) #most likely buffer underfill
00312
00313 _struct_I = roslib.message.struct_I
00314 _struct_3I = struct.Struct("<3I")
00315 _struct_3f = struct.Struct("<3f")