00001 """autogenerated by genpy from spline_smoother/LSPBTrajectoryMsg.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 genpy
00008 import spline_smoother.msg
00009 import std_msgs.msg
00010
00011 class LSPBTrajectoryMsg(genpy.Message):
00012 _md5sum = "ce1139991f603c3d37b77cd9b60c5c3d"
00013 _type = "spline_smoother/LSPBTrajectoryMsg"
00014 _has_header = True
00015 _full_text = """Header header
00016 string[] names
00017 LSPBTrajectorySegmentMsg[] segments
00018
00019 ================================================================================
00020 MSG: std_msgs/Header
00021 # Standard metadata for higher-level stamped data types.
00022 # This is generally used to communicate timestamped data
00023 # in a particular coordinate frame.
00024 #
00025 # sequence ID: consecutively increasing ID
00026 uint32 seq
00027 #Two-integer timestamp that is expressed as:
00028 # * stamp.secs: seconds (stamp_secs) since epoch
00029 # * stamp.nsecs: nanoseconds since stamp_secs
00030 # time-handling sugar is provided by the client library
00031 time stamp
00032 #Frame this data is associated with
00033 # 0: no frame
00034 # 1: global frame
00035 string frame_id
00036
00037 ================================================================================
00038 MSG: spline_smoother/LSPBTrajectorySegmentMsg
00039 duration duration
00040 LSPBSplineCoefficients[] joints
00041
00042 ================================================================================
00043 MSG: spline_smoother/LSPBSplineCoefficients
00044 float64[] coefficients
00045 float64 linear_segment_duration
00046 float64 quadratic_segment_duration
00047 """
00048 __slots__ = ['header','names','segments']
00049 _slot_types = ['std_msgs/Header','string[]','spline_smoother/LSPBTrajectorySegmentMsg[]']
00050
00051 def __init__(self, *args, **kwds):
00052 """
00053 Constructor. Any message fields that are implicitly/explicitly
00054 set to None will be assigned a default value. The recommend
00055 use is keyword arguments as this is more robust to future message
00056 changes. You cannot mix in-order arguments and keyword arguments.
00057
00058 The available fields are:
00059 header,names,segments
00060
00061 :param args: complete set of field values, in .msg order
00062 :param kwds: use keyword arguments corresponding to message field names
00063 to set specific fields.
00064 """
00065 if args or kwds:
00066 super(LSPBTrajectoryMsg, self).__init__(*args, **kwds)
00067
00068 if self.header is None:
00069 self.header = std_msgs.msg.Header()
00070 if self.names is None:
00071 self.names = []
00072 if self.segments is None:
00073 self.segments = []
00074 else:
00075 self.header = std_msgs.msg.Header()
00076 self.names = []
00077 self.segments = []
00078
00079 def _get_types(self):
00080 """
00081 internal API method
00082 """
00083 return self._slot_types
00084
00085 def serialize(self, buff):
00086 """
00087 serialize message into buffer
00088 :param buff: buffer, ``StringIO``
00089 """
00090 try:
00091 _x = self
00092 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00093 _x = self.header.frame_id
00094 length = len(_x)
00095 if python3 or type(_x) == unicode:
00096 _x = _x.encode('utf-8')
00097 length = len(_x)
00098 buff.write(struct.pack('<I%ss'%length, length, _x))
00099 length = len(self.names)
00100 buff.write(_struct_I.pack(length))
00101 for val1 in self.names:
00102 length = len(val1)
00103 if python3 or type(val1) == unicode:
00104 val1 = val1.encode('utf-8')
00105 length = len(val1)
00106 buff.write(struct.pack('<I%ss'%length, length, val1))
00107 length = len(self.segments)
00108 buff.write(_struct_I.pack(length))
00109 for val1 in self.segments:
00110 _v1 = val1.duration
00111 _x = _v1
00112 buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00113 length = len(val1.joints)
00114 buff.write(_struct_I.pack(length))
00115 for val2 in val1.joints:
00116 length = len(val2.coefficients)
00117 buff.write(_struct_I.pack(length))
00118 pattern = '<%sd'%length
00119 buff.write(struct.pack(pattern, *val2.coefficients))
00120 _x = val2
00121 buff.write(_struct_2d.pack(_x.linear_segment_duration, _x.quadratic_segment_duration))
00122 except struct.error as se: self._check_types(se)
00123 except TypeError as te: self._check_types(te)
00124
00125 def deserialize(self, str):
00126 """
00127 unpack serialized message in str into this message instance
00128 :param str: byte array of serialized message, ``str``
00129 """
00130 try:
00131 if self.header is None:
00132 self.header = std_msgs.msg.Header()
00133 if self.segments is None:
00134 self.segments = None
00135 end = 0
00136 _x = self
00137 start = end
00138 end += 12
00139 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 start = end
00144 end += length
00145 if python3:
00146 self.header.frame_id = str[start:end].decode('utf-8')
00147 else:
00148 self.header.frame_id = str[start:end]
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 self.names = []
00153 for i in range(0, length):
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 start = end
00158 end += length
00159 if python3:
00160 val1 = str[start:end].decode('utf-8')
00161 else:
00162 val1 = str[start:end]
00163 self.names.append(val1)
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 self.segments = []
00168 for i in range(0, length):
00169 val1 = spline_smoother.msg.LSPBTrajectorySegmentMsg()
00170 _v2 = val1.duration
00171 _x = _v2
00172 start = end
00173 end += 8
00174 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00175 start = end
00176 end += 4
00177 (length,) = _struct_I.unpack(str[start:end])
00178 val1.joints = []
00179 for i in range(0, length):
00180 val2 = spline_smoother.msg.LSPBSplineCoefficients()
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 pattern = '<%sd'%length
00185 start = end
00186 end += struct.calcsize(pattern)
00187 val2.coefficients = struct.unpack(pattern, str[start:end])
00188 _x = val2
00189 start = end
00190 end += 16
00191 (_x.linear_segment_duration, _x.quadratic_segment_duration,) = _struct_2d.unpack(str[start:end])
00192 val1.joints.append(val2)
00193 self.segments.append(val1)
00194 return self
00195 except struct.error as e:
00196 raise genpy.DeserializationError(e)
00197
00198
00199 def serialize_numpy(self, buff, numpy):
00200 """
00201 serialize message with numpy array types into buffer
00202 :param buff: buffer, ``StringIO``
00203 :param numpy: numpy python module
00204 """
00205 try:
00206 _x = self
00207 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00208 _x = self.header.frame_id
00209 length = len(_x)
00210 if python3 or type(_x) == unicode:
00211 _x = _x.encode('utf-8')
00212 length = len(_x)
00213 buff.write(struct.pack('<I%ss'%length, length, _x))
00214 length = len(self.names)
00215 buff.write(_struct_I.pack(length))
00216 for val1 in self.names:
00217 length = len(val1)
00218 if python3 or type(val1) == unicode:
00219 val1 = val1.encode('utf-8')
00220 length = len(val1)
00221 buff.write(struct.pack('<I%ss'%length, length, val1))
00222 length = len(self.segments)
00223 buff.write(_struct_I.pack(length))
00224 for val1 in self.segments:
00225 _v3 = val1.duration
00226 _x = _v3
00227 buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00228 length = len(val1.joints)
00229 buff.write(_struct_I.pack(length))
00230 for val2 in val1.joints:
00231 length = len(val2.coefficients)
00232 buff.write(_struct_I.pack(length))
00233 pattern = '<%sd'%length
00234 buff.write(val2.coefficients.tostring())
00235 _x = val2
00236 buff.write(_struct_2d.pack(_x.linear_segment_duration, _x.quadratic_segment_duration))
00237 except struct.error as se: self._check_types(se)
00238 except TypeError as te: self._check_types(te)
00239
00240 def deserialize_numpy(self, str, numpy):
00241 """
00242 unpack serialized message in str into this message instance using numpy for array types
00243 :param str: byte array of serialized message, ``str``
00244 :param numpy: numpy python module
00245 """
00246 try:
00247 if self.header is None:
00248 self.header = std_msgs.msg.Header()
00249 if self.segments is None:
00250 self.segments = None
00251 end = 0
00252 _x = self
00253 start = end
00254 end += 12
00255 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00256 start = end
00257 end += 4
00258 (length,) = _struct_I.unpack(str[start:end])
00259 start = end
00260 end += length
00261 if python3:
00262 self.header.frame_id = str[start:end].decode('utf-8')
00263 else:
00264 self.header.frame_id = str[start:end]
00265 start = end
00266 end += 4
00267 (length,) = _struct_I.unpack(str[start:end])
00268 self.names = []
00269 for i in range(0, length):
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 start = end
00274 end += length
00275 if python3:
00276 val1 = str[start:end].decode('utf-8')
00277 else:
00278 val1 = str[start:end]
00279 self.names.append(val1)
00280 start = end
00281 end += 4
00282 (length,) = _struct_I.unpack(str[start:end])
00283 self.segments = []
00284 for i in range(0, length):
00285 val1 = spline_smoother.msg.LSPBTrajectorySegmentMsg()
00286 _v4 = val1.duration
00287 _x = _v4
00288 start = end
00289 end += 8
00290 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 val1.joints = []
00295 for i in range(0, length):
00296 val2 = spline_smoother.msg.LSPBSplineCoefficients()
00297 start = end
00298 end += 4
00299 (length,) = _struct_I.unpack(str[start:end])
00300 pattern = '<%sd'%length
00301 start = end
00302 end += struct.calcsize(pattern)
00303 val2.coefficients = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00304 _x = val2
00305 start = end
00306 end += 16
00307 (_x.linear_segment_duration, _x.quadratic_segment_duration,) = _struct_2d.unpack(str[start:end])
00308 val1.joints.append(val2)
00309 self.segments.append(val1)
00310 return self
00311 except struct.error as e:
00312 raise genpy.DeserializationError(e)
00313
00314 _struct_I = genpy.struct_I
00315 _struct_2d = struct.Struct("<2d")
00316 _struct_3I = struct.Struct("<3I")
00317 _struct_2i = struct.Struct("<2i")