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