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