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