00001 """autogenerated by genpy from nasa_r2_common_msgs/LabeledGains.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 LabeledGains(genpy.Message):
00009 _md5sum = "c93e734ccf5e719d91c5fa607c5dacb9"
00010 _type = "nasa_r2_common_msgs/LabeledGains"
00011 _has_header = False
00012 _full_text = """string originator
00013 string[] joint_names
00014 float64[] naturalFreq
00015 float64[] dampingRatio
00016 float64[] K
00017 float64[] D
00018 float64[] I
00019 float64[] windupLimit
00020
00021 """
00022 __slots__ = ['originator','joint_names','naturalFreq','dampingRatio','K','D','I','windupLimit']
00023 _slot_types = ['string','string[]','float64[]','float64[]','float64[]','float64[]','float64[]','float64[]']
00024
00025 def __init__(self, *args, **kwds):
00026 """
00027 Constructor. Any message fields that are implicitly/explicitly
00028 set to None will be assigned a default value. The recommend
00029 use is keyword arguments as this is more robust to future message
00030 changes. You cannot mix in-order arguments and keyword arguments.
00031
00032 The available fields are:
00033 originator,joint_names,naturalFreq,dampingRatio,K,D,I,windupLimit
00034
00035 :param args: complete set of field values, in .msg order
00036 :param kwds: use keyword arguments corresponding to message field names
00037 to set specific fields.
00038 """
00039 if args or kwds:
00040 super(LabeledGains, self).__init__(*args, **kwds)
00041
00042 if self.originator is None:
00043 self.originator = ''
00044 if self.joint_names is None:
00045 self.joint_names = []
00046 if self.naturalFreq is None:
00047 self.naturalFreq = []
00048 if self.dampingRatio is None:
00049 self.dampingRatio = []
00050 if self.K is None:
00051 self.K = []
00052 if self.D is None:
00053 self.D = []
00054 if self.I is None:
00055 self.I = []
00056 if self.windupLimit is None:
00057 self.windupLimit = []
00058 else:
00059 self.originator = ''
00060 self.joint_names = []
00061 self.naturalFreq = []
00062 self.dampingRatio = []
00063 self.K = []
00064 self.D = []
00065 self.I = []
00066 self.windupLimit = []
00067
00068 def _get_types(self):
00069 """
00070 internal API method
00071 """
00072 return self._slot_types
00073
00074 def serialize(self, buff):
00075 """
00076 serialize message into buffer
00077 :param buff: buffer, ``StringIO``
00078 """
00079 try:
00080 _x = self.originator
00081 length = len(_x)
00082 if python3 or type(_x) == unicode:
00083 _x = _x.encode('utf-8')
00084 length = len(_x)
00085 buff.write(struct.pack('<I%ss'%length, length, _x))
00086 length = len(self.joint_names)
00087 buff.write(_struct_I.pack(length))
00088 for val1 in self.joint_names:
00089 length = len(val1)
00090 if python3 or type(val1) == unicode:
00091 val1 = val1.encode('utf-8')
00092 length = len(val1)
00093 buff.write(struct.pack('<I%ss'%length, length, val1))
00094 length = len(self.naturalFreq)
00095 buff.write(_struct_I.pack(length))
00096 pattern = '<%sd'%length
00097 buff.write(struct.pack(pattern, *self.naturalFreq))
00098 length = len(self.dampingRatio)
00099 buff.write(_struct_I.pack(length))
00100 pattern = '<%sd'%length
00101 buff.write(struct.pack(pattern, *self.dampingRatio))
00102 length = len(self.K)
00103 buff.write(_struct_I.pack(length))
00104 pattern = '<%sd'%length
00105 buff.write(struct.pack(pattern, *self.K))
00106 length = len(self.D)
00107 buff.write(_struct_I.pack(length))
00108 pattern = '<%sd'%length
00109 buff.write(struct.pack(pattern, *self.D))
00110 length = len(self.I)
00111 buff.write(_struct_I.pack(length))
00112 pattern = '<%sd'%length
00113 buff.write(struct.pack(pattern, *self.I))
00114 length = len(self.windupLimit)
00115 buff.write(_struct_I.pack(length))
00116 pattern = '<%sd'%length
00117 buff.write(struct.pack(pattern, *self.windupLimit))
00118 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00119 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00120
00121 def deserialize(self, str):
00122 """
00123 unpack serialized message in str into this message instance
00124 :param str: byte array of serialized message, ``str``
00125 """
00126 try:
00127 end = 0
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.originator = str[start:end].decode('utf-8')
00135 else:
00136 self.originator = str[start:end]
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 self.joint_names = []
00141 for i in range(0, length):
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 start = end
00146 end += length
00147 if python3:
00148 val1 = str[start:end].decode('utf-8')
00149 else:
00150 val1 = str[start:end]
00151 self.joint_names.append(val1)
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.naturalFreq = 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.dampingRatio = struct.unpack(pattern, str[start:end])
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 pattern = '<%sd'%length
00170 start = end
00171 end += struct.calcsize(pattern)
00172 self.K = struct.unpack(pattern, str[start:end])
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 pattern = '<%sd'%length
00177 start = end
00178 end += struct.calcsize(pattern)
00179 self.D = struct.unpack(pattern, str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 pattern = '<%sd'%length
00184 start = end
00185 end += struct.calcsize(pattern)
00186 self.I = struct.unpack(pattern, str[start:end])
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 pattern = '<%sd'%length
00191 start = end
00192 end += struct.calcsize(pattern)
00193 self.windupLimit = struct.unpack(pattern, str[start:end])
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.originator
00207 length = len(_x)
00208 if python3 or type(_x) == unicode:
00209 _x = _x.encode('utf-8')
00210 length = len(_x)
00211 buff.write(struct.pack('<I%ss'%length, length, _x))
00212 length = len(self.joint_names)
00213 buff.write(_struct_I.pack(length))
00214 for val1 in self.joint_names:
00215 length = len(val1)
00216 if python3 or type(val1) == unicode:
00217 val1 = val1.encode('utf-8')
00218 length = len(val1)
00219 buff.write(struct.pack('<I%ss'%length, length, val1))
00220 length = len(self.naturalFreq)
00221 buff.write(_struct_I.pack(length))
00222 pattern = '<%sd'%length
00223 buff.write(self.naturalFreq.tostring())
00224 length = len(self.dampingRatio)
00225 buff.write(_struct_I.pack(length))
00226 pattern = '<%sd'%length
00227 buff.write(self.dampingRatio.tostring())
00228 length = len(self.K)
00229 buff.write(_struct_I.pack(length))
00230 pattern = '<%sd'%length
00231 buff.write(self.K.tostring())
00232 length = len(self.D)
00233 buff.write(_struct_I.pack(length))
00234 pattern = '<%sd'%length
00235 buff.write(self.D.tostring())
00236 length = len(self.I)
00237 buff.write(_struct_I.pack(length))
00238 pattern = '<%sd'%length
00239 buff.write(self.I.tostring())
00240 length = len(self.windupLimit)
00241 buff.write(_struct_I.pack(length))
00242 pattern = '<%sd'%length
00243 buff.write(self.windupLimit.tostring())
00244 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00245 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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 += 4
00257 (length,) = _struct_I.unpack(str[start:end])
00258 start = end
00259 end += length
00260 if python3:
00261 self.originator = str[start:end].decode('utf-8')
00262 else:
00263 self.originator = str[start:end]
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 self.joint_names = []
00268 for i in range(0, length):
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 start = end
00273 end += length
00274 if python3:
00275 val1 = str[start:end].decode('utf-8')
00276 else:
00277 val1 = str[start:end]
00278 self.joint_names.append(val1)
00279 start = end
00280 end += 4
00281 (length,) = _struct_I.unpack(str[start:end])
00282 pattern = '<%sd'%length
00283 start = end
00284 end += struct.calcsize(pattern)
00285 self.naturalFreq = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00286 start = end
00287 end += 4
00288 (length,) = _struct_I.unpack(str[start:end])
00289 pattern = '<%sd'%length
00290 start = end
00291 end += struct.calcsize(pattern)
00292 self.dampingRatio = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00293 start = end
00294 end += 4
00295 (length,) = _struct_I.unpack(str[start:end])
00296 pattern = '<%sd'%length
00297 start = end
00298 end += struct.calcsize(pattern)
00299 self.K = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00300 start = end
00301 end += 4
00302 (length,) = _struct_I.unpack(str[start:end])
00303 pattern = '<%sd'%length
00304 start = end
00305 end += struct.calcsize(pattern)
00306 self.D = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00307 start = end
00308 end += 4
00309 (length,) = _struct_I.unpack(str[start:end])
00310 pattern = '<%sd'%length
00311 start = end
00312 end += struct.calcsize(pattern)
00313 self.I = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00314 start = end
00315 end += 4
00316 (length,) = _struct_I.unpack(str[start:end])
00317 pattern = '<%sd'%length
00318 start = end
00319 end += struct.calcsize(pattern)
00320 self.windupLimit = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00321 return self
00322 except struct.error as e:
00323 raise genpy.DeserializationError(e)
00324
00325 _struct_I = genpy.struct_I