$search
00001 """autogenerated by genmsg_py from DiagnosticStatus.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import diagnostic_msgs.msg 00006 00007 class DiagnosticStatus(roslib.message.Message): 00008 _md5sum = "67d15a62edb26e9d52b0f0efa3ef9da7" 00009 _type = "diagnostic_msgs/DiagnosticStatus" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# This message holds the status of an individual component of the robot. 00012 # 00013 00014 # Possible levels of operations 00015 byte OK=0 00016 byte WARN=1 00017 byte ERROR=2 00018 00019 byte level # level of operation enumerated above 00020 string name # a description of the test/component reporting 00021 string message # a description of the status 00022 string hardware_id # a hardware unique string 00023 KeyValue[] values # an array of values associated with the status 00024 00025 00026 ================================================================================ 00027 MSG: diagnostic_msgs/KeyValue 00028 string key # what to label this value when viewing 00029 string value # a value to track over time 00030 00031 """ 00032 # Pseudo-constants 00033 OK = 0 00034 WARN = 1 00035 ERROR = 2 00036 00037 __slots__ = ['level','name','message','hardware_id','values'] 00038 _slot_types = ['byte','string','string','string','diagnostic_msgs/KeyValue[]'] 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 level,name,message,hardware_id,values 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(DiagnosticStatus, self).__init__(*args, **kwds) 00056 #message fields cannot be None, assign default values for those that are 00057 if self.level is None: 00058 self.level = 0 00059 if self.name is None: 00060 self.name = '' 00061 if self.message is None: 00062 self.message = '' 00063 if self.hardware_id is None: 00064 self.hardware_id = '' 00065 if self.values is None: 00066 self.values = [] 00067 else: 00068 self.level = 0 00069 self.name = '' 00070 self.message = '' 00071 self.hardware_id = '' 00072 self.values = [] 00073 00074 def _get_types(self): 00075 """ 00076 internal API method 00077 """ 00078 return self._slot_types 00079 00080 def serialize(self, buff): 00081 """ 00082 serialize message into buffer 00083 @param buff: buffer 00084 @type buff: StringIO 00085 """ 00086 try: 00087 buff.write(_struct_b.pack(self.level)) 00088 _x = self.name 00089 length = len(_x) 00090 buff.write(struct.pack('<I%ss'%length, length, _x)) 00091 _x = self.message 00092 length = len(_x) 00093 buff.write(struct.pack('<I%ss'%length, length, _x)) 00094 _x = self.hardware_id 00095 length = len(_x) 00096 buff.write(struct.pack('<I%ss'%length, length, _x)) 00097 length = len(self.values) 00098 buff.write(_struct_I.pack(length)) 00099 for val1 in self.values: 00100 _x = val1.key 00101 length = len(_x) 00102 buff.write(struct.pack('<I%ss'%length, length, _x)) 00103 _x = val1.value 00104 length = len(_x) 00105 buff.write(struct.pack('<I%ss'%length, length, _x)) 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 += 1 00119 (self.level,) = _struct_b.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.name = str[start:end] 00126 start = end 00127 end += 4 00128 (length,) = _struct_I.unpack(str[start:end]) 00129 start = end 00130 end += length 00131 self.message = str[start:end] 00132 start = end 00133 end += 4 00134 (length,) = _struct_I.unpack(str[start:end]) 00135 start = end 00136 end += length 00137 self.hardware_id = str[start:end] 00138 start = end 00139 end += 4 00140 (length,) = _struct_I.unpack(str[start:end]) 00141 self.values = [] 00142 for i in range(0, length): 00143 val1 = diagnostic_msgs.msg.KeyValue() 00144 start = end 00145 end += 4 00146 (length,) = _struct_I.unpack(str[start:end]) 00147 start = end 00148 end += length 00149 val1.key = str[start:end] 00150 start = end 00151 end += 4 00152 (length,) = _struct_I.unpack(str[start:end]) 00153 start = end 00154 end += length 00155 val1.value = str[start:end] 00156 self.values.append(val1) 00157 return self 00158 except struct.error as e: 00159 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00160 00161 00162 def serialize_numpy(self, buff, numpy): 00163 """ 00164 serialize message with numpy array types into buffer 00165 @param buff: buffer 00166 @type buff: StringIO 00167 @param numpy: numpy python module 00168 @type numpy module 00169 """ 00170 try: 00171 buff.write(_struct_b.pack(self.level)) 00172 _x = self.name 00173 length = len(_x) 00174 buff.write(struct.pack('<I%ss'%length, length, _x)) 00175 _x = self.message 00176 length = len(_x) 00177 buff.write(struct.pack('<I%ss'%length, length, _x)) 00178 _x = self.hardware_id 00179 length = len(_x) 00180 buff.write(struct.pack('<I%ss'%length, length, _x)) 00181 length = len(self.values) 00182 buff.write(_struct_I.pack(length)) 00183 for val1 in self.values: 00184 _x = val1.key 00185 length = len(_x) 00186 buff.write(struct.pack('<I%ss'%length, length, _x)) 00187 _x = val1.value 00188 length = len(_x) 00189 buff.write(struct.pack('<I%ss'%length, length, _x)) 00190 except struct.error as se: self._check_types(se) 00191 except TypeError as te: self._check_types(te) 00192 00193 def deserialize_numpy(self, str, numpy): 00194 """ 00195 unpack serialized message in str into this message instance using numpy for array types 00196 @param str: byte array of serialized message 00197 @type str: str 00198 @param numpy: numpy python module 00199 @type numpy: module 00200 """ 00201 try: 00202 end = 0 00203 start = end 00204 end += 1 00205 (self.level,) = _struct_b.unpack(str[start:end]) 00206 start = end 00207 end += 4 00208 (length,) = _struct_I.unpack(str[start:end]) 00209 start = end 00210 end += length 00211 self.name = str[start:end] 00212 start = end 00213 end += 4 00214 (length,) = _struct_I.unpack(str[start:end]) 00215 start = end 00216 end += length 00217 self.message = str[start:end] 00218 start = end 00219 end += 4 00220 (length,) = _struct_I.unpack(str[start:end]) 00221 start = end 00222 end += length 00223 self.hardware_id = str[start:end] 00224 start = end 00225 end += 4 00226 (length,) = _struct_I.unpack(str[start:end]) 00227 self.values = [] 00228 for i in range(0, length): 00229 val1 = diagnostic_msgs.msg.KeyValue() 00230 start = end 00231 end += 4 00232 (length,) = _struct_I.unpack(str[start:end]) 00233 start = end 00234 end += length 00235 val1.key = str[start:end] 00236 start = end 00237 end += 4 00238 (length,) = _struct_I.unpack(str[start:end]) 00239 start = end 00240 end += length 00241 val1.value = str[start:end] 00242 self.values.append(val1) 00243 return self 00244 except struct.error as e: 00245 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00246 00247 _struct_I = roslib.message.struct_I 00248 _struct_b = struct.Struct("<b")