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