00001 """autogenerated by genpy from dmp/GetDMPPlanRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class GetDMPPlanRequest(genpy.Message):
00009 _md5sum = "bae6b051e2f7b80225be1fd25b5b705a"
00010 _type = "dmp/GetDMPPlanRequest"
00011 _has_header = False
00012 _full_text = """
00013 float64[] x_0
00014
00015
00016 float64[] x_dot_0
00017
00018
00019
00020 float64 t_0
00021
00022
00023 float64[] goal
00024
00025
00026
00027
00028
00029 float64[] goal_thresh
00030
00031
00032 float64 seg_length
00033
00034
00035 float64 tau
00036
00037
00038 float64 dt
00039
00040
00041 int32 integrate_iter
00042
00043
00044 """
00045 __slots__ = ['x_0','x_dot_0','t_0','goal','goal_thresh','seg_length','tau','dt','integrate_iter']
00046 _slot_types = ['float64[]','float64[]','float64','float64[]','float64[]','float64','float64','float64','int32']
00047
00048 def __init__(self, *args, **kwds):
00049 """
00050 Constructor. Any message fields that are implicitly/explicitly
00051 set to None will be assigned a default value. The recommend
00052 use is keyword arguments as this is more robust to future message
00053 changes. You cannot mix in-order arguments and keyword arguments.
00054
00055 The available fields are:
00056 x_0,x_dot_0,t_0,goal,goal_thresh,seg_length,tau,dt,integrate_iter
00057
00058 :param args: complete set of field values, in .msg order
00059 :param kwds: use keyword arguments corresponding to message field names
00060 to set specific fields.
00061 """
00062 if args or kwds:
00063 super(GetDMPPlanRequest, self).__init__(*args, **kwds)
00064
00065 if self.x_0 is None:
00066 self.x_0 = []
00067 if self.x_dot_0 is None:
00068 self.x_dot_0 = []
00069 if self.t_0 is None:
00070 self.t_0 = 0.
00071 if self.goal is None:
00072 self.goal = []
00073 if self.goal_thresh is None:
00074 self.goal_thresh = []
00075 if self.seg_length is None:
00076 self.seg_length = 0.
00077 if self.tau is None:
00078 self.tau = 0.
00079 if self.dt is None:
00080 self.dt = 0.
00081 if self.integrate_iter is None:
00082 self.integrate_iter = 0
00083 else:
00084 self.x_0 = []
00085 self.x_dot_0 = []
00086 self.t_0 = 0.
00087 self.goal = []
00088 self.goal_thresh = []
00089 self.seg_length = 0.
00090 self.tau = 0.
00091 self.dt = 0.
00092 self.integrate_iter = 0
00093
00094 def _get_types(self):
00095 """
00096 internal API method
00097 """
00098 return self._slot_types
00099
00100 def serialize(self, buff):
00101 """
00102 serialize message into buffer
00103 :param buff: buffer, ``StringIO``
00104 """
00105 try:
00106 length = len(self.x_0)
00107 buff.write(_struct_I.pack(length))
00108 pattern = '<%sd'%length
00109 buff.write(struct.pack(pattern, *self.x_0))
00110 length = len(self.x_dot_0)
00111 buff.write(_struct_I.pack(length))
00112 pattern = '<%sd'%length
00113 buff.write(struct.pack(pattern, *self.x_dot_0))
00114 buff.write(_struct_d.pack(self.t_0))
00115 length = len(self.goal)
00116 buff.write(_struct_I.pack(length))
00117 pattern = '<%sd'%length
00118 buff.write(struct.pack(pattern, *self.goal))
00119 length = len(self.goal_thresh)
00120 buff.write(_struct_I.pack(length))
00121 pattern = '<%sd'%length
00122 buff.write(struct.pack(pattern, *self.goal_thresh))
00123 _x = self
00124 buff.write(_struct_3di.pack(_x.seg_length, _x.tau, _x.dt, _x.integrate_iter))
00125 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00126 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00127
00128 def deserialize(self, str):
00129 """
00130 unpack serialized message in str into this message instance
00131 :param str: byte array of serialized message, ``str``
00132 """
00133 try:
00134 end = 0
00135 start = end
00136 end += 4
00137 (length,) = _struct_I.unpack(str[start:end])
00138 pattern = '<%sd'%length
00139 start = end
00140 end += struct.calcsize(pattern)
00141 self.x_0 = struct.unpack(pattern, str[start:end])
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 pattern = '<%sd'%length
00146 start = end
00147 end += struct.calcsize(pattern)
00148 self.x_dot_0 = struct.unpack(pattern, str[start:end])
00149 start = end
00150 end += 8
00151 (self.t_0,) = _struct_d.unpack(str[start:end])
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 pattern = '<%sd'%length
00156 start = end
00157 end += struct.calcsize(pattern)
00158 self.goal = struct.unpack(pattern, str[start:end])
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.goal_thresh = struct.unpack(pattern, str[start:end])
00166 _x = self
00167 start = end
00168 end += 28
00169 (_x.seg_length, _x.tau, _x.dt, _x.integrate_iter,) = _struct_3di.unpack(str[start:end])
00170 return self
00171 except struct.error as e:
00172 raise genpy.DeserializationError(e)
00173
00174
00175 def serialize_numpy(self, buff, numpy):
00176 """
00177 serialize message with numpy array types into buffer
00178 :param buff: buffer, ``StringIO``
00179 :param numpy: numpy python module
00180 """
00181 try:
00182 length = len(self.x_0)
00183 buff.write(_struct_I.pack(length))
00184 pattern = '<%sd'%length
00185 buff.write(self.x_0.tostring())
00186 length = len(self.x_dot_0)
00187 buff.write(_struct_I.pack(length))
00188 pattern = '<%sd'%length
00189 buff.write(self.x_dot_0.tostring())
00190 buff.write(_struct_d.pack(self.t_0))
00191 length = len(self.goal)
00192 buff.write(_struct_I.pack(length))
00193 pattern = '<%sd'%length
00194 buff.write(self.goal.tostring())
00195 length = len(self.goal_thresh)
00196 buff.write(_struct_I.pack(length))
00197 pattern = '<%sd'%length
00198 buff.write(self.goal_thresh.tostring())
00199 _x = self
00200 buff.write(_struct_3di.pack(_x.seg_length, _x.tau, _x.dt, _x.integrate_iter))
00201 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00202 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00203
00204 def deserialize_numpy(self, str, numpy):
00205 """
00206 unpack serialized message in str into this message instance using numpy for array types
00207 :param str: byte array of serialized message, ``str``
00208 :param numpy: numpy python module
00209 """
00210 try:
00211 end = 0
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 pattern = '<%sd'%length
00216 start = end
00217 end += struct.calcsize(pattern)
00218 self.x_0 = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00219 start = end
00220 end += 4
00221 (length,) = _struct_I.unpack(str[start:end])
00222 pattern = '<%sd'%length
00223 start = end
00224 end += struct.calcsize(pattern)
00225 self.x_dot_0 = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00226 start = end
00227 end += 8
00228 (self.t_0,) = _struct_d.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 pattern = '<%sd'%length
00233 start = end
00234 end += struct.calcsize(pattern)
00235 self.goal = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00236 start = end
00237 end += 4
00238 (length,) = _struct_I.unpack(str[start:end])
00239 pattern = '<%sd'%length
00240 start = end
00241 end += struct.calcsize(pattern)
00242 self.goal_thresh = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00243 _x = self
00244 start = end
00245 end += 28
00246 (_x.seg_length, _x.tau, _x.dt, _x.integrate_iter,) = _struct_3di.unpack(str[start:end])
00247 return self
00248 except struct.error as e:
00249 raise genpy.DeserializationError(e)
00250
00251 _struct_I = genpy.struct_I
00252 _struct_d = struct.Struct("<d")
00253 _struct_3di = struct.Struct("<3di")
00254 """autogenerated by genpy from dmp/GetDMPPlanResponse.msg. Do not edit."""
00255 import sys
00256 python3 = True if sys.hexversion > 0x03000000 else False
00257 import genpy
00258 import struct
00259
00260 import dmp.msg
00261
00262 class GetDMPPlanResponse(genpy.Message):
00263 _md5sum = "dcf9f84a71b2617cf4bbc301a97c05cd"
00264 _type = "dmp/GetDMPPlanResponse"
00265 _has_header = False
00266 _full_text = """
00267
00268 DMPTraj plan
00269
00270
00271 uint8 at_goal
00272
00273
00274
00275
00276
00277
00278 ================================================================================
00279 MSG: dmp/DMPTraj
00280 # points and times should be the same length
00281 DMPPoint[] points
00282
00283 # Times of observations, in seconds, starting at zero
00284 float64[] times
00285
00286
00287
00288 ================================================================================
00289 MSG: dmp/DMPPoint
00290 # Positions and velocities of DOFs
00291 #Velocity is only used for movement plans, not for giving demonstrations.
00292 float64[] positions
00293 float64[] velocities
00294
00295
00296
00297 """
00298 __slots__ = ['plan','at_goal']
00299 _slot_types = ['dmp/DMPTraj','uint8']
00300
00301 def __init__(self, *args, **kwds):
00302 """
00303 Constructor. Any message fields that are implicitly/explicitly
00304 set to None will be assigned a default value. The recommend
00305 use is keyword arguments as this is more robust to future message
00306 changes. You cannot mix in-order arguments and keyword arguments.
00307
00308 The available fields are:
00309 plan,at_goal
00310
00311 :param args: complete set of field values, in .msg order
00312 :param kwds: use keyword arguments corresponding to message field names
00313 to set specific fields.
00314 """
00315 if args or kwds:
00316 super(GetDMPPlanResponse, self).__init__(*args, **kwds)
00317
00318 if self.plan is None:
00319 self.plan = dmp.msg.DMPTraj()
00320 if self.at_goal is None:
00321 self.at_goal = 0
00322 else:
00323 self.plan = dmp.msg.DMPTraj()
00324 self.at_goal = 0
00325
00326 def _get_types(self):
00327 """
00328 internal API method
00329 """
00330 return self._slot_types
00331
00332 def serialize(self, buff):
00333 """
00334 serialize message into buffer
00335 :param buff: buffer, ``StringIO``
00336 """
00337 try:
00338 length = len(self.plan.points)
00339 buff.write(_struct_I.pack(length))
00340 for val1 in self.plan.points:
00341 length = len(val1.positions)
00342 buff.write(_struct_I.pack(length))
00343 pattern = '<%sd'%length
00344 buff.write(struct.pack(pattern, *val1.positions))
00345 length = len(val1.velocities)
00346 buff.write(_struct_I.pack(length))
00347 pattern = '<%sd'%length
00348 buff.write(struct.pack(pattern, *val1.velocities))
00349 length = len(self.plan.times)
00350 buff.write(_struct_I.pack(length))
00351 pattern = '<%sd'%length
00352 buff.write(struct.pack(pattern, *self.plan.times))
00353 buff.write(_struct_B.pack(self.at_goal))
00354 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00355 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00356
00357 def deserialize(self, str):
00358 """
00359 unpack serialized message in str into this message instance
00360 :param str: byte array of serialized message, ``str``
00361 """
00362 try:
00363 if self.plan is None:
00364 self.plan = dmp.msg.DMPTraj()
00365 end = 0
00366 start = end
00367 end += 4
00368 (length,) = _struct_I.unpack(str[start:end])
00369 self.plan.points = []
00370 for i in range(0, length):
00371 val1 = dmp.msg.DMPPoint()
00372 start = end
00373 end += 4
00374 (length,) = _struct_I.unpack(str[start:end])
00375 pattern = '<%sd'%length
00376 start = end
00377 end += struct.calcsize(pattern)
00378 val1.positions = struct.unpack(pattern, str[start:end])
00379 start = end
00380 end += 4
00381 (length,) = _struct_I.unpack(str[start:end])
00382 pattern = '<%sd'%length
00383 start = end
00384 end += struct.calcsize(pattern)
00385 val1.velocities = struct.unpack(pattern, str[start:end])
00386 self.plan.points.append(val1)
00387 start = end
00388 end += 4
00389 (length,) = _struct_I.unpack(str[start:end])
00390 pattern = '<%sd'%length
00391 start = end
00392 end += struct.calcsize(pattern)
00393 self.plan.times = struct.unpack(pattern, str[start:end])
00394 start = end
00395 end += 1
00396 (self.at_goal,) = _struct_B.unpack(str[start:end])
00397 return self
00398 except struct.error as e:
00399 raise genpy.DeserializationError(e)
00400
00401
00402 def serialize_numpy(self, buff, numpy):
00403 """
00404 serialize message with numpy array types into buffer
00405 :param buff: buffer, ``StringIO``
00406 :param numpy: numpy python module
00407 """
00408 try:
00409 length = len(self.plan.points)
00410 buff.write(_struct_I.pack(length))
00411 for val1 in self.plan.points:
00412 length = len(val1.positions)
00413 buff.write(_struct_I.pack(length))
00414 pattern = '<%sd'%length
00415 buff.write(val1.positions.tostring())
00416 length = len(val1.velocities)
00417 buff.write(_struct_I.pack(length))
00418 pattern = '<%sd'%length
00419 buff.write(val1.velocities.tostring())
00420 length = len(self.plan.times)
00421 buff.write(_struct_I.pack(length))
00422 pattern = '<%sd'%length
00423 buff.write(self.plan.times.tostring())
00424 buff.write(_struct_B.pack(self.at_goal))
00425 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00426 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00427
00428 def deserialize_numpy(self, str, numpy):
00429 """
00430 unpack serialized message in str into this message instance using numpy for array types
00431 :param str: byte array of serialized message, ``str``
00432 :param numpy: numpy python module
00433 """
00434 try:
00435 if self.plan is None:
00436 self.plan = dmp.msg.DMPTraj()
00437 end = 0
00438 start = end
00439 end += 4
00440 (length,) = _struct_I.unpack(str[start:end])
00441 self.plan.points = []
00442 for i in range(0, length):
00443 val1 = dmp.msg.DMPPoint()
00444 start = end
00445 end += 4
00446 (length,) = _struct_I.unpack(str[start:end])
00447 pattern = '<%sd'%length
00448 start = end
00449 end += struct.calcsize(pattern)
00450 val1.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00451 start = end
00452 end += 4
00453 (length,) = _struct_I.unpack(str[start:end])
00454 pattern = '<%sd'%length
00455 start = end
00456 end += struct.calcsize(pattern)
00457 val1.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00458 self.plan.points.append(val1)
00459 start = end
00460 end += 4
00461 (length,) = _struct_I.unpack(str[start:end])
00462 pattern = '<%sd'%length
00463 start = end
00464 end += struct.calcsize(pattern)
00465 self.plan.times = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00466 start = end
00467 end += 1
00468 (self.at_goal,) = _struct_B.unpack(str[start:end])
00469 return self
00470 except struct.error as e:
00471 raise genpy.DeserializationError(e)
00472
00473 _struct_I = genpy.struct_I
00474 _struct_B = struct.Struct("<B")
00475 class GetDMPPlan(object):
00476 _type = 'dmp/GetDMPPlan'
00477 _md5sum = '5cd79fd80676a4f8f062c5472a3190b1'
00478 _request_class = GetDMPPlanRequest
00479 _response_class = GetDMPPlanResponse