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