$search
00001 """autogenerated by genmsg_py from CBRunData.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import joint_qualification_controllers.msg 00006 00007 class CBRunData(roslib.message.Message): 00008 _md5sum = "16bad2df24f5cffc934c2d3ae9bb08e6" 00009 _type = "joint_qualification_controllers/CBRunData" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """float32 lift_position 00012 CBPositionData[] flex_data # Same lift position, diff flex positions 00013 ================================================================================ 00014 MSG: joint_qualification_controllers/CBPositionData 00015 float32 flex_position 00016 JointPositionData lift_hold 00017 JointPositionData flex_hold 00018 00019 ================================================================================ 00020 MSG: joint_qualification_controllers/JointPositionData 00021 float32[] time 00022 float32[] position 00023 float32[] velocity 00024 float32[] effort 00025 """ 00026 __slots__ = ['lift_position','flex_data'] 00027 _slot_types = ['float32','joint_qualification_controllers/CBPositionData[]'] 00028 00029 def __init__(self, *args, **kwds): 00030 """ 00031 Constructor. Any message fields that are implicitly/explicitly 00032 set to None will be assigned a default value. The recommend 00033 use is keyword arguments as this is more robust to future message 00034 changes. You cannot mix in-order arguments and keyword arguments. 00035 00036 The available fields are: 00037 lift_position,flex_data 00038 00039 @param args: complete set of field values, in .msg order 00040 @param kwds: use keyword arguments corresponding to message field names 00041 to set specific fields. 00042 """ 00043 if args or kwds: 00044 super(CBRunData, self).__init__(*args, **kwds) 00045 #message fields cannot be None, assign default values for those that are 00046 if self.lift_position is None: 00047 self.lift_position = 0. 00048 if self.flex_data is None: 00049 self.flex_data = [] 00050 else: 00051 self.lift_position = 0. 00052 self.flex_data = [] 00053 00054 def _get_types(self): 00055 """ 00056 internal API method 00057 """ 00058 return self._slot_types 00059 00060 def serialize(self, buff): 00061 """ 00062 serialize message into buffer 00063 @param buff: buffer 00064 @type buff: StringIO 00065 """ 00066 try: 00067 buff.write(_struct_f.pack(self.lift_position)) 00068 length = len(self.flex_data) 00069 buff.write(_struct_I.pack(length)) 00070 for val1 in self.flex_data: 00071 buff.write(_struct_f.pack(val1.flex_position)) 00072 _v1 = val1.lift_hold 00073 length = len(_v1.time) 00074 buff.write(_struct_I.pack(length)) 00075 pattern = '<%sf'%length 00076 buff.write(struct.pack(pattern, *_v1.time)) 00077 length = len(_v1.position) 00078 buff.write(_struct_I.pack(length)) 00079 pattern = '<%sf'%length 00080 buff.write(struct.pack(pattern, *_v1.position)) 00081 length = len(_v1.velocity) 00082 buff.write(_struct_I.pack(length)) 00083 pattern = '<%sf'%length 00084 buff.write(struct.pack(pattern, *_v1.velocity)) 00085 length = len(_v1.effort) 00086 buff.write(_struct_I.pack(length)) 00087 pattern = '<%sf'%length 00088 buff.write(struct.pack(pattern, *_v1.effort)) 00089 _v2 = val1.flex_hold 00090 length = len(_v2.time) 00091 buff.write(_struct_I.pack(length)) 00092 pattern = '<%sf'%length 00093 buff.write(struct.pack(pattern, *_v2.time)) 00094 length = len(_v2.position) 00095 buff.write(_struct_I.pack(length)) 00096 pattern = '<%sf'%length 00097 buff.write(struct.pack(pattern, *_v2.position)) 00098 length = len(_v2.velocity) 00099 buff.write(_struct_I.pack(length)) 00100 pattern = '<%sf'%length 00101 buff.write(struct.pack(pattern, *_v2.velocity)) 00102 length = len(_v2.effort) 00103 buff.write(_struct_I.pack(length)) 00104 pattern = '<%sf'%length 00105 buff.write(struct.pack(pattern, *_v2.effort)) 00106 except struct.error as se: self._check_types(se) 00107 except TypeError as te: self._check_types(te) 00108 00109 def deserialize(self, str): 00110 """ 00111 unpack serialized message in str into this message instance 00112 @param str: byte array of serialized message 00113 @type str: str 00114 """ 00115 try: 00116 end = 0 00117 start = end 00118 end += 4 00119 (self.lift_position,) = _struct_f.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 self.flex_data = [] 00124 for i in range(0, length): 00125 val1 = joint_qualification_controllers.msg.CBPositionData() 00126 start = end 00127 end += 4 00128 (val1.flex_position,) = _struct_f.unpack(str[start:end]) 00129 _v3 = val1.lift_hold 00130 start = end 00131 end += 4 00132 (length,) = _struct_I.unpack(str[start:end]) 00133 pattern = '<%sf'%length 00134 start = end 00135 end += struct.calcsize(pattern) 00136 _v3.time = struct.unpack(pattern, str[start:end]) 00137 start = end 00138 end += 4 00139 (length,) = _struct_I.unpack(str[start:end]) 00140 pattern = '<%sf'%length 00141 start = end 00142 end += struct.calcsize(pattern) 00143 _v3.position = struct.unpack(pattern, str[start:end]) 00144 start = end 00145 end += 4 00146 (length,) = _struct_I.unpack(str[start:end]) 00147 pattern = '<%sf'%length 00148 start = end 00149 end += struct.calcsize(pattern) 00150 _v3.velocity = struct.unpack(pattern, str[start:end]) 00151 start = end 00152 end += 4 00153 (length,) = _struct_I.unpack(str[start:end]) 00154 pattern = '<%sf'%length 00155 start = end 00156 end += struct.calcsize(pattern) 00157 _v3.effort = struct.unpack(pattern, str[start:end]) 00158 _v4 = val1.flex_hold 00159 start = end 00160 end += 4 00161 (length,) = _struct_I.unpack(str[start:end]) 00162 pattern = '<%sf'%length 00163 start = end 00164 end += struct.calcsize(pattern) 00165 _v4.time = struct.unpack(pattern, str[start:end]) 00166 start = end 00167 end += 4 00168 (length,) = _struct_I.unpack(str[start:end]) 00169 pattern = '<%sf'%length 00170 start = end 00171 end += struct.calcsize(pattern) 00172 _v4.position = struct.unpack(pattern, str[start:end]) 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 pattern = '<%sf'%length 00177 start = end 00178 end += struct.calcsize(pattern) 00179 _v4.velocity = struct.unpack(pattern, str[start:end]) 00180 start = end 00181 end += 4 00182 (length,) = _struct_I.unpack(str[start:end]) 00183 pattern = '<%sf'%length 00184 start = end 00185 end += struct.calcsize(pattern) 00186 _v4.effort = struct.unpack(pattern, str[start:end]) 00187 self.flex_data.append(val1) 00188 return self 00189 except struct.error as e: 00190 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00191 00192 00193 def serialize_numpy(self, buff, numpy): 00194 """ 00195 serialize message with numpy array types into buffer 00196 @param buff: buffer 00197 @type buff: StringIO 00198 @param numpy: numpy python module 00199 @type numpy 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(se) 00242 except TypeError as te: self._check_types(te) 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 00248 @type str: str 00249 @param numpy: numpy python module 00250 @type numpy: module 00251 """ 00252 try: 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 roslib.message.DeserializationError(e) #most likely buffer underfill 00328 00329 _struct_I = roslib.message.struct_I 00330 _struct_f = struct.Struct("<f")