00001 """autogenerated by genpy from tk_draft_msgs/SegmentObstacles.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 tk_draft_msgs.msg
00008 import geometry_msgs.msg
00009 import std_msgs.msg
00010
00011 class SegmentObstacles(genpy.Message):
00012 _md5sum = "305fa80ec6215e24feb22bec9e3f8fde"
00013 _type = "tk_draft_msgs/SegmentObstacles"
00014 _has_header = True
00015 _full_text = """#
00016 # Copyright 2012 Authors: Johannes Laechele and Thomas Nestmeyer
00017 #
00018 # This file is part of TeleKyb.
00019 #
00020 # TeleKyb is free software: you can redistribute it and/or modify
00021 # it under the terms of the GNU General Public License as published by
00022 # the Free Software Foundation, either version 3 of the License, or
00023 # (at your option) any later version.
00024 #
00025 # TeleKyb is distributed in the hope that it will be useful,
00026 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00027 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00028 # GNU General Public License for more details.
00029 #
00030 # You should have received a copy of the GNU General Public License
00031 # along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00032
00033 Header header
00034
00035 # all the distances of all segments to all obstacles in the whole environment
00036 tk_draft_msgs/ClosestPointHit[] closestPointHits
00037
00038
00039 ================================================================================
00040 MSG: std_msgs/Header
00041 # Standard metadata for higher-level stamped data types.
00042 # This is generally used to communicate timestamped data
00043 # in a particular coordinate frame.
00044 #
00045 # sequence ID: consecutively increasing ID
00046 uint32 seq
00047 #Two-integer timestamp that is expressed as:
00048 # * stamp.secs: seconds (stamp_secs) since epoch
00049 # * stamp.nsecs: nanoseconds since stamp_secs
00050 # time-handling sugar is provided by the client library
00051 time stamp
00052 #Frame this data is associated with
00053 # 0: no frame
00054 # 1: global frame
00055 string frame_id
00056
00057 ================================================================================
00058 MSG: tk_draft_msgs/ClosestPointHit
00059 #
00060 # Copyright 2012 Authors: Johannes Laechele and Thomas Nestmeyer
00061 #
00062 # This file is part of TeleKyb.
00063 #
00064 # TeleKyb is free software: you can redistribute it and/or modify
00065 # it under the terms of the GNU General Public License as published by
00066 # the Free Software Foundation, either version 3 of the License, or
00067 # (at your option) any later version.
00068 #
00069 # TeleKyb is distributed in the hope that it will be useful,
00070 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00071 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00072 # GNU General Public License for more details.
00073 #
00074 # You should have received a copy of the GNU General Public License
00075 # along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00076
00077 #both form the ID of segment:
00078 #(id1,id2) = (id2,id1)
00079 uint8 id1
00080 uint8 id2
00081
00082 # Point on segment
00083 geometry_msgs/Point[] pointSeg
00084
00085 # Point on segment
00086 geometry_msgs/Point[] pointObs
00087
00088 # Distances
00089 float64[] distance
00090
00091
00092 ================================================================================
00093 MSG: geometry_msgs/Point
00094 # This contains the position of a point in free space
00095 float64 x
00096 float64 y
00097 float64 z
00098
00099 """
00100 __slots__ = ['header','closestPointHits']
00101 _slot_types = ['std_msgs/Header','tk_draft_msgs/ClosestPointHit[]']
00102
00103 def __init__(self, *args, **kwds):
00104 """
00105 Constructor. Any message fields that are implicitly/explicitly
00106 set to None will be assigned a default value. The recommend
00107 use is keyword arguments as this is more robust to future message
00108 changes. You cannot mix in-order arguments and keyword arguments.
00109
00110 The available fields are:
00111 header,closestPointHits
00112
00113 :param args: complete set of field values, in .msg order
00114 :param kwds: use keyword arguments corresponding to message field names
00115 to set specific fields.
00116 """
00117 if args or kwds:
00118 super(SegmentObstacles, self).__init__(*args, **kwds)
00119
00120 if self.header is None:
00121 self.header = std_msgs.msg.Header()
00122 if self.closestPointHits is None:
00123 self.closestPointHits = []
00124 else:
00125 self.header = std_msgs.msg.Header()
00126 self.closestPointHits = []
00127
00128 def _get_types(self):
00129 """
00130 internal API method
00131 """
00132 return self._slot_types
00133
00134 def serialize(self, buff):
00135 """
00136 serialize message into buffer
00137 :param buff: buffer, ``StringIO``
00138 """
00139 try:
00140 _x = self
00141 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00142 _x = self.header.frame_id
00143 length = len(_x)
00144 if python3 or type(_x) == unicode:
00145 _x = _x.encode('utf-8')
00146 length = len(_x)
00147 buff.write(struct.pack('<I%ss'%length, length, _x))
00148 length = len(self.closestPointHits)
00149 buff.write(_struct_I.pack(length))
00150 for val1 in self.closestPointHits:
00151 _x = val1
00152 buff.write(_struct_2B.pack(_x.id1, _x.id2))
00153 length = len(val1.pointSeg)
00154 buff.write(_struct_I.pack(length))
00155 for val2 in val1.pointSeg:
00156 _x = val2
00157 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00158 length = len(val1.pointObs)
00159 buff.write(_struct_I.pack(length))
00160 for val2 in val1.pointObs:
00161 _x = val2
00162 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00163 length = len(val1.distance)
00164 buff.write(_struct_I.pack(length))
00165 pattern = '<%sd'%length
00166 buff.write(struct.pack(pattern, *val1.distance))
00167 except struct.error as se: self._check_types(se)
00168 except TypeError as te: self._check_types(te)
00169
00170 def deserialize(self, str):
00171 """
00172 unpack serialized message in str into this message instance
00173 :param str: byte array of serialized message, ``str``
00174 """
00175 try:
00176 if self.header is None:
00177 self.header = std_msgs.msg.Header()
00178 if self.closestPointHits is None:
00179 self.closestPointHits = None
00180 end = 0
00181 _x = self
00182 start = end
00183 end += 12
00184 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 start = end
00189 end += length
00190 if python3:
00191 self.header.frame_id = str[start:end].decode('utf-8')
00192 else:
00193 self.header.frame_id = str[start:end]
00194 start = end
00195 end += 4
00196 (length,) = _struct_I.unpack(str[start:end])
00197 self.closestPointHits = []
00198 for i in range(0, length):
00199 val1 = tk_draft_msgs.msg.ClosestPointHit()
00200 _x = val1
00201 start = end
00202 end += 2
00203 (_x.id1, _x.id2,) = _struct_2B.unpack(str[start:end])
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 val1.pointSeg = []
00208 for i in range(0, length):
00209 val2 = geometry_msgs.msg.Point()
00210 _x = val2
00211 start = end
00212 end += 24
00213 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00214 val1.pointSeg.append(val2)
00215 start = end
00216 end += 4
00217 (length,) = _struct_I.unpack(str[start:end])
00218 val1.pointObs = []
00219 for i in range(0, length):
00220 val2 = geometry_msgs.msg.Point()
00221 _x = val2
00222 start = end
00223 end += 24
00224 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00225 val1.pointObs.append(val2)
00226 start = end
00227 end += 4
00228 (length,) = _struct_I.unpack(str[start:end])
00229 pattern = '<%sd'%length
00230 start = end
00231 end += struct.calcsize(pattern)
00232 val1.distance = struct.unpack(pattern, str[start:end])
00233 self.closestPointHits.append(val1)
00234 return self
00235 except struct.error as e:
00236 raise genpy.DeserializationError(e)
00237
00238
00239 def serialize_numpy(self, buff, numpy):
00240 """
00241 serialize message with numpy array types into buffer
00242 :param buff: buffer, ``StringIO``
00243 :param numpy: numpy python module
00244 """
00245 try:
00246 _x = self
00247 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00248 _x = self.header.frame_id
00249 length = len(_x)
00250 if python3 or type(_x) == unicode:
00251 _x = _x.encode('utf-8')
00252 length = len(_x)
00253 buff.write(struct.pack('<I%ss'%length, length, _x))
00254 length = len(self.closestPointHits)
00255 buff.write(_struct_I.pack(length))
00256 for val1 in self.closestPointHits:
00257 _x = val1
00258 buff.write(_struct_2B.pack(_x.id1, _x.id2))
00259 length = len(val1.pointSeg)
00260 buff.write(_struct_I.pack(length))
00261 for val2 in val1.pointSeg:
00262 _x = val2
00263 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00264 length = len(val1.pointObs)
00265 buff.write(_struct_I.pack(length))
00266 for val2 in val1.pointObs:
00267 _x = val2
00268 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00269 length = len(val1.distance)
00270 buff.write(_struct_I.pack(length))
00271 pattern = '<%sd'%length
00272 buff.write(val1.distance.tostring())
00273 except struct.error as se: self._check_types(se)
00274 except TypeError as te: self._check_types(te)
00275
00276 def deserialize_numpy(self, str, numpy):
00277 """
00278 unpack serialized message in str into this message instance using numpy for array types
00279 :param str: byte array of serialized message, ``str``
00280 :param numpy: numpy python module
00281 """
00282 try:
00283 if self.header is None:
00284 self.header = std_msgs.msg.Header()
00285 if self.closestPointHits is None:
00286 self.closestPointHits = None
00287 end = 0
00288 _x = self
00289 start = end
00290 end += 12
00291 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00292 start = end
00293 end += 4
00294 (length,) = _struct_I.unpack(str[start:end])
00295 start = end
00296 end += length
00297 if python3:
00298 self.header.frame_id = str[start:end].decode('utf-8')
00299 else:
00300 self.header.frame_id = str[start:end]
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 self.closestPointHits = []
00305 for i in range(0, length):
00306 val1 = tk_draft_msgs.msg.ClosestPointHit()
00307 _x = val1
00308 start = end
00309 end += 2
00310 (_x.id1, _x.id2,) = _struct_2B.unpack(str[start:end])
00311 start = end
00312 end += 4
00313 (length,) = _struct_I.unpack(str[start:end])
00314 val1.pointSeg = []
00315 for i in range(0, length):
00316 val2 = geometry_msgs.msg.Point()
00317 _x = val2
00318 start = end
00319 end += 24
00320 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00321 val1.pointSeg.append(val2)
00322 start = end
00323 end += 4
00324 (length,) = _struct_I.unpack(str[start:end])
00325 val1.pointObs = []
00326 for i in range(0, length):
00327 val2 = geometry_msgs.msg.Point()
00328 _x = val2
00329 start = end
00330 end += 24
00331 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00332 val1.pointObs.append(val2)
00333 start = end
00334 end += 4
00335 (length,) = _struct_I.unpack(str[start:end])
00336 pattern = '<%sd'%length
00337 start = end
00338 end += struct.calcsize(pattern)
00339 val1.distance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00340 self.closestPointHits.append(val1)
00341 return self
00342 except struct.error as e:
00343 raise genpy.DeserializationError(e)
00344
00345 _struct_I = genpy.struct_I
00346 _struct_3I = struct.Struct("<3I")
00347 _struct_2B = struct.Struct("<2B")
00348 _struct_3d = struct.Struct("<3d")