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


joint_qualification_controllers
Author(s): Kevin Watts, Melonee Wise
autogenerated on Tue Apr 22 2014 19:39:16