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