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