_ClosestPointHit.py
Go to the documentation of this file.
00001 """autogenerated by genpy from tk_draft_msgs/ClosestPointHit.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 geometry_msgs.msg
00008 
00009 class ClosestPointHit(genpy.Message):
00010   _md5sum = "151538e55e3c575ad8e4f5756accfa6d"
00011   _type = "tk_draft_msgs/ClosestPointHit"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """#
00014 # Copyright 2012 Authors: Johannes Laechele and Thomas Nestmeyer
00015 #
00016 # This file is part of TeleKyb.
00017 #
00018 # TeleKyb is free software: you can redistribute it and/or modify
00019 # it under the terms of the GNU General Public License as published by
00020 # the Free Software Foundation, either version 3 of the License, or
00021 # (at your option) any later version.
00022 #
00023 # TeleKyb is distributed in the hope that it will be useful,
00024 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00026 # GNU General Public License for more details.
00027 #
00028 # You should have received a copy of the GNU General Public License
00029 # along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00030 
00031 #both form the ID of segment:
00032 #(id1,id2) = (id2,id1)
00033 uint8 id1
00034 uint8 id2
00035 
00036 # Point on segment
00037 geometry_msgs/Point[] pointSeg
00038 
00039 # Point on segment
00040 geometry_msgs/Point[] pointObs
00041 
00042 # Distances
00043 float64[] distance
00044 
00045 
00046 ================================================================================
00047 MSG: geometry_msgs/Point
00048 # This contains the position of a point in free space
00049 float64 x
00050 float64 y
00051 float64 z
00052 
00053 """
00054   __slots__ = ['id1','id2','pointSeg','pointObs','distance']
00055   _slot_types = ['uint8','uint8','geometry_msgs/Point[]','geometry_msgs/Point[]','float64[]']
00056 
00057   def __init__(self, *args, **kwds):
00058     """
00059     Constructor. Any message fields that are implicitly/explicitly
00060     set to None will be assigned a default value. The recommend
00061     use is keyword arguments as this is more robust to future message
00062     changes.  You cannot mix in-order arguments and keyword arguments.
00063 
00064     The available fields are:
00065        id1,id2,pointSeg,pointObs,distance
00066 
00067     :param args: complete set of field values, in .msg order
00068     :param kwds: use keyword arguments corresponding to message field names
00069     to set specific fields.
00070     """
00071     if args or kwds:
00072       super(ClosestPointHit, self).__init__(*args, **kwds)
00073       #message fields cannot be None, assign default values for those that are
00074       if self.id1 is None:
00075         self.id1 = 0
00076       if self.id2 is None:
00077         self.id2 = 0
00078       if self.pointSeg is None:
00079         self.pointSeg = []
00080       if self.pointObs is None:
00081         self.pointObs = []
00082       if self.distance is None:
00083         self.distance = []
00084     else:
00085       self.id1 = 0
00086       self.id2 = 0
00087       self.pointSeg = []
00088       self.pointObs = []
00089       self.distance = []
00090 
00091   def _get_types(self):
00092     """
00093     internal API method
00094     """
00095     return self._slot_types
00096 
00097   def serialize(self, buff):
00098     """
00099     serialize message into buffer
00100     :param buff: buffer, ``StringIO``
00101     """
00102     try:
00103       _x = self
00104       buff.write(_struct_2B.pack(_x.id1, _x.id2))
00105       length = len(self.pointSeg)
00106       buff.write(_struct_I.pack(length))
00107       for val1 in self.pointSeg:
00108         _x = val1
00109         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00110       length = len(self.pointObs)
00111       buff.write(_struct_I.pack(length))
00112       for val1 in self.pointObs:
00113         _x = val1
00114         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00115       length = len(self.distance)
00116       buff.write(_struct_I.pack(length))
00117       pattern = '<%sd'%length
00118       buff.write(struct.pack(pattern, *self.distance))
00119     except struct.error as se: self._check_types(se)
00120     except TypeError as te: self._check_types(te)
00121 
00122   def deserialize(self, str):
00123     """
00124     unpack serialized message in str into this message instance
00125     :param str: byte array of serialized message, ``str``
00126     """
00127     try:
00128       if self.pointSeg is None:
00129         self.pointSeg = None
00130       if self.pointObs is None:
00131         self.pointObs = None
00132       end = 0
00133       _x = self
00134       start = end
00135       end += 2
00136       (_x.id1, _x.id2,) = _struct_2B.unpack(str[start:end])
00137       start = end
00138       end += 4
00139       (length,) = _struct_I.unpack(str[start:end])
00140       self.pointSeg = []
00141       for i in range(0, length):
00142         val1 = geometry_msgs.msg.Point()
00143         _x = val1
00144         start = end
00145         end += 24
00146         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00147         self.pointSeg.append(val1)
00148       start = end
00149       end += 4
00150       (length,) = _struct_I.unpack(str[start:end])
00151       self.pointObs = []
00152       for i in range(0, length):
00153         val1 = geometry_msgs.msg.Point()
00154         _x = val1
00155         start = end
00156         end += 24
00157         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00158         self.pointObs.append(val1)
00159       start = end
00160       end += 4
00161       (length,) = _struct_I.unpack(str[start:end])
00162       pattern = '<%sd'%length
00163       start = end
00164       end += struct.calcsize(pattern)
00165       self.distance = struct.unpack(pattern, str[start:end])
00166       return self
00167     except struct.error as e:
00168       raise genpy.DeserializationError(e) #most likely buffer underfill
00169 
00170 
00171   def serialize_numpy(self, buff, numpy):
00172     """
00173     serialize message with numpy array types into buffer
00174     :param buff: buffer, ``StringIO``
00175     :param numpy: numpy python module
00176     """
00177     try:
00178       _x = self
00179       buff.write(_struct_2B.pack(_x.id1, _x.id2))
00180       length = len(self.pointSeg)
00181       buff.write(_struct_I.pack(length))
00182       for val1 in self.pointSeg:
00183         _x = val1
00184         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00185       length = len(self.pointObs)
00186       buff.write(_struct_I.pack(length))
00187       for val1 in self.pointObs:
00188         _x = val1
00189         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00190       length = len(self.distance)
00191       buff.write(_struct_I.pack(length))
00192       pattern = '<%sd'%length
00193       buff.write(self.distance.tostring())
00194     except struct.error as se: self._check_types(se)
00195     except TypeError as te: self._check_types(te)
00196 
00197   def deserialize_numpy(self, str, numpy):
00198     """
00199     unpack serialized message in str into this message instance using numpy for array types
00200     :param str: byte array of serialized message, ``str``
00201     :param numpy: numpy python module
00202     """
00203     try:
00204       if self.pointSeg is None:
00205         self.pointSeg = None
00206       if self.pointObs is None:
00207         self.pointObs = None
00208       end = 0
00209       _x = self
00210       start = end
00211       end += 2
00212       (_x.id1, _x.id2,) = _struct_2B.unpack(str[start:end])
00213       start = end
00214       end += 4
00215       (length,) = _struct_I.unpack(str[start:end])
00216       self.pointSeg = []
00217       for i in range(0, length):
00218         val1 = geometry_msgs.msg.Point()
00219         _x = val1
00220         start = end
00221         end += 24
00222         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00223         self.pointSeg.append(val1)
00224       start = end
00225       end += 4
00226       (length,) = _struct_I.unpack(str[start:end])
00227       self.pointObs = []
00228       for i in range(0, length):
00229         val1 = geometry_msgs.msg.Point()
00230         _x = val1
00231         start = end
00232         end += 24
00233         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00234         self.pointObs.append(val1)
00235       start = end
00236       end += 4
00237       (length,) = _struct_I.unpack(str[start:end])
00238       pattern = '<%sd'%length
00239       start = end
00240       end += struct.calcsize(pattern)
00241       self.distance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00242       return self
00243     except struct.error as e:
00244       raise genpy.DeserializationError(e) #most likely buffer underfill
00245 
00246 _struct_I = genpy.struct_I
00247 _struct_2B = struct.Struct("<2B")
00248 _struct_3d = struct.Struct("<3d")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


tk_draft_msgs
Author(s): Martin Riedel
autogenerated on Mon Nov 11 2013 11:12:57