00001 """autogenerated by genpy from tk_draft_msgs/TKSpline.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 TKSpline(genpy.Message):
00011 _md5sum = "dcd11f4aea11a0b57993e79a0ab63167"
00012 _type = "tk_draft_msgs/TKSpline"
00013 _has_header = True
00014 _full_text = """#
00015 # Copyright 2011 Carlo Masone
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 # Contains the set point for the low-lever controller of the gripper
00033
00034 Header header
00035
00036 # Points
00037 geometry_msgs/Point[] controlPoints
00038
00039 # Knots
00040 float64[] knots
00041
00042 # Indices of the portion of spline to draw
00043 float64[] indices
00044
00045 # Order
00046 uint8 order
00047
00048 # Color
00049 geometry_msgs/Point[] color
00050
00051 # Number of lines to be drawn to approximate the spline
00052 uint8 nLines
00053
00054 ================================================================================
00055 MSG: std_msgs/Header
00056 # Standard metadata for higher-level stamped data types.
00057 # This is generally used to communicate timestamped data
00058 # in a particular coordinate frame.
00059 #
00060 # sequence ID: consecutively increasing ID
00061 uint32 seq
00062 #Two-integer timestamp that is expressed as:
00063 # * stamp.secs: seconds (stamp_secs) since epoch
00064 # * stamp.nsecs: nanoseconds since stamp_secs
00065 # time-handling sugar is provided by the client library
00066 time stamp
00067 #Frame this data is associated with
00068 # 0: no frame
00069 # 1: global frame
00070 string frame_id
00071
00072 ================================================================================
00073 MSG: geometry_msgs/Point
00074 # This contains the position of a point in free space
00075 float64 x
00076 float64 y
00077 float64 z
00078
00079 """
00080 __slots__ = ['header','controlPoints','knots','indices','order','color','nLines']
00081 _slot_types = ['std_msgs/Header','geometry_msgs/Point[]','float64[]','float64[]','uint8','geometry_msgs/Point[]','uint8']
00082
00083 def __init__(self, *args, **kwds):
00084 """
00085 Constructor. Any message fields that are implicitly/explicitly
00086 set to None will be assigned a default value. The recommend
00087 use is keyword arguments as this is more robust to future message
00088 changes. You cannot mix in-order arguments and keyword arguments.
00089
00090 The available fields are:
00091 header,controlPoints,knots,indices,order,color,nLines
00092
00093 :param args: complete set of field values, in .msg order
00094 :param kwds: use keyword arguments corresponding to message field names
00095 to set specific fields.
00096 """
00097 if args or kwds:
00098 super(TKSpline, self).__init__(*args, **kwds)
00099
00100 if self.header is None:
00101 self.header = std_msgs.msg.Header()
00102 if self.controlPoints is None:
00103 self.controlPoints = []
00104 if self.knots is None:
00105 self.knots = []
00106 if self.indices is None:
00107 self.indices = []
00108 if self.order is None:
00109 self.order = 0
00110 if self.color is None:
00111 self.color = []
00112 if self.nLines is None:
00113 self.nLines = 0
00114 else:
00115 self.header = std_msgs.msg.Header()
00116 self.controlPoints = []
00117 self.knots = []
00118 self.indices = []
00119 self.order = 0
00120 self.color = []
00121 self.nLines = 0
00122
00123 def _get_types(self):
00124 """
00125 internal API method
00126 """
00127 return self._slot_types
00128
00129 def serialize(self, buff):
00130 """
00131 serialize message into buffer
00132 :param buff: buffer, ``StringIO``
00133 """
00134 try:
00135 _x = self
00136 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00137 _x = self.header.frame_id
00138 length = len(_x)
00139 if python3 or type(_x) == unicode:
00140 _x = _x.encode('utf-8')
00141 length = len(_x)
00142 buff.write(struct.pack('<I%ss'%length, length, _x))
00143 length = len(self.controlPoints)
00144 buff.write(_struct_I.pack(length))
00145 for val1 in self.controlPoints:
00146 _x = val1
00147 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00148 length = len(self.knots)
00149 buff.write(_struct_I.pack(length))
00150 pattern = '<%sd'%length
00151 buff.write(struct.pack(pattern, *self.knots))
00152 length = len(self.indices)
00153 buff.write(_struct_I.pack(length))
00154 pattern = '<%sd'%length
00155 buff.write(struct.pack(pattern, *self.indices))
00156 buff.write(_struct_B.pack(self.order))
00157 length = len(self.color)
00158 buff.write(_struct_I.pack(length))
00159 for val1 in self.color:
00160 _x = val1
00161 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00162 buff.write(_struct_B.pack(self.nLines))
00163 except struct.error as se: self._check_types(se)
00164 except TypeError as te: self._check_types(te)
00165
00166 def deserialize(self, str):
00167 """
00168 unpack serialized message in str into this message instance
00169 :param str: byte array of serialized message, ``str``
00170 """
00171 try:
00172 if self.header is None:
00173 self.header = std_msgs.msg.Header()
00174 if self.controlPoints is None:
00175 self.controlPoints = None
00176 if self.color is None:
00177 self.color = None
00178 end = 0
00179 _x = self
00180 start = end
00181 end += 12
00182 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00183 start = end
00184 end += 4
00185 (length,) = _struct_I.unpack(str[start:end])
00186 start = end
00187 end += length
00188 if python3:
00189 self.header.frame_id = str[start:end].decode('utf-8')
00190 else:
00191 self.header.frame_id = str[start:end]
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 self.controlPoints = []
00196 for i in range(0, length):
00197 val1 = geometry_msgs.msg.Point()
00198 _x = val1
00199 start = end
00200 end += 24
00201 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00202 self.controlPoints.append(val1)
00203 start = end
00204 end += 4
00205 (length,) = _struct_I.unpack(str[start:end])
00206 pattern = '<%sd'%length
00207 start = end
00208 end += struct.calcsize(pattern)
00209 self.knots = struct.unpack(pattern, str[start:end])
00210 start = end
00211 end += 4
00212 (length,) = _struct_I.unpack(str[start:end])
00213 pattern = '<%sd'%length
00214 start = end
00215 end += struct.calcsize(pattern)
00216 self.indices = struct.unpack(pattern, str[start:end])
00217 start = end
00218 end += 1
00219 (self.order,) = _struct_B.unpack(str[start:end])
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 self.color = []
00224 for i in range(0, length):
00225 val1 = geometry_msgs.msg.Point()
00226 _x = val1
00227 start = end
00228 end += 24
00229 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00230 self.color.append(val1)
00231 start = end
00232 end += 1
00233 (self.nLines,) = _struct_B.unpack(str[start:end])
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.controlPoints)
00255 buff.write(_struct_I.pack(length))
00256 for val1 in self.controlPoints:
00257 _x = val1
00258 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00259 length = len(self.knots)
00260 buff.write(_struct_I.pack(length))
00261 pattern = '<%sd'%length
00262 buff.write(self.knots.tostring())
00263 length = len(self.indices)
00264 buff.write(_struct_I.pack(length))
00265 pattern = '<%sd'%length
00266 buff.write(self.indices.tostring())
00267 buff.write(_struct_B.pack(self.order))
00268 length = len(self.color)
00269 buff.write(_struct_I.pack(length))
00270 for val1 in self.color:
00271 _x = val1
00272 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00273 buff.write(_struct_B.pack(self.nLines))
00274 except struct.error as se: self._check_types(se)
00275 except TypeError as te: self._check_types(te)
00276
00277 def deserialize_numpy(self, str, numpy):
00278 """
00279 unpack serialized message in str into this message instance using numpy for array types
00280 :param str: byte array of serialized message, ``str``
00281 :param numpy: numpy python module
00282 """
00283 try:
00284 if self.header is None:
00285 self.header = std_msgs.msg.Header()
00286 if self.controlPoints is None:
00287 self.controlPoints = None
00288 if self.color is None:
00289 self.color = None
00290 end = 0
00291 _x = self
00292 start = end
00293 end += 12
00294 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00295 start = end
00296 end += 4
00297 (length,) = _struct_I.unpack(str[start:end])
00298 start = end
00299 end += length
00300 if python3:
00301 self.header.frame_id = str[start:end].decode('utf-8')
00302 else:
00303 self.header.frame_id = str[start:end]
00304 start = end
00305 end += 4
00306 (length,) = _struct_I.unpack(str[start:end])
00307 self.controlPoints = []
00308 for i in range(0, length):
00309 val1 = geometry_msgs.msg.Point()
00310 _x = val1
00311 start = end
00312 end += 24
00313 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00314 self.controlPoints.append(val1)
00315 start = end
00316 end += 4
00317 (length,) = _struct_I.unpack(str[start:end])
00318 pattern = '<%sd'%length
00319 start = end
00320 end += struct.calcsize(pattern)
00321 self.knots = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00322 start = end
00323 end += 4
00324 (length,) = _struct_I.unpack(str[start:end])
00325 pattern = '<%sd'%length
00326 start = end
00327 end += struct.calcsize(pattern)
00328 self.indices = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00329 start = end
00330 end += 1
00331 (self.order,) = _struct_B.unpack(str[start:end])
00332 start = end
00333 end += 4
00334 (length,) = _struct_I.unpack(str[start:end])
00335 self.color = []
00336 for i in range(0, length):
00337 val1 = geometry_msgs.msg.Point()
00338 _x = val1
00339 start = end
00340 end += 24
00341 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00342 self.color.append(val1)
00343 start = end
00344 end += 1
00345 (self.nLines,) = _struct_B.unpack(str[start:end])
00346 return self
00347 except struct.error as e:
00348 raise genpy.DeserializationError(e)
00349
00350 _struct_I = genpy.struct_I
00351 _struct_3I = struct.Struct("<3I")
00352 _struct_B = struct.Struct("<B")
00353 _struct_3d = struct.Struct("<3d")