00001 """autogenerated by genmsg_py from DiagnosticArray.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import diagnostic_msgs.msg
00006 import std_msgs.msg
00007
00008 class DiagnosticArray(roslib.message.Message):
00009 _md5sum = "3cfbeff055e708a24c3d946a5c8139cd"
00010 _type = "diagnostic_msgs/DiagnosticArray"
00011 _has_header = True
00012 _full_text = """# This message is used to send diagnostic information about the state of the robot
00013 Header header #for timestamp
00014 DiagnosticStatus[] status # an array of components being reported on
00015 ================================================================================
00016 MSG: std_msgs/Header
00017 # Standard metadata for higher-level stamped data types.
00018 # This is generally used to communicate timestamped data
00019 # in a particular coordinate frame.
00020 #
00021 # sequence ID: consecutively increasing ID
00022 uint32 seq
00023 #Two-integer timestamp that is expressed as:
00024 # * stamp.secs: seconds (stamp_secs) since epoch
00025 # * stamp.nsecs: nanoseconds since stamp_secs
00026 # time-handling sugar is provided by the client library
00027 time stamp
00028 #Frame this data is associated with
00029 # 0: no frame
00030 # 1: global frame
00031 string frame_id
00032
00033 ================================================================================
00034 MSG: diagnostic_msgs/DiagnosticStatus
00035 # This message holds the status of an individual component of the robot.
00036 #
00037
00038 # Possible levels of operations
00039 byte OK=0
00040 byte WARN=1
00041 byte ERROR=2
00042
00043 byte level # level of operation enumerated above
00044 string name # a description of the test/component reporting
00045 string message # a description of the status
00046 string hardware_id # a hardware unique string
00047 KeyValue[] values # an array of values associated with the status
00048
00049
00050 ================================================================================
00051 MSG: diagnostic_msgs/KeyValue
00052 string key # what to label this value when viewing
00053 string value # a value to track over time
00054
00055 """
00056 __slots__ = ['header','status']
00057 _slot_types = ['Header','diagnostic_msgs/DiagnosticStatus[]']
00058
00059 def __init__(self, *args, **kwds):
00060 """
00061 Constructor. Any message fields that are implicitly/explicitly
00062 set to None will be assigned a default value. The recommend
00063 use is keyword arguments as this is more robust to future message
00064 changes. You cannot mix in-order arguments and keyword arguments.
00065
00066 The available fields are:
00067 header,status
00068
00069 @param args: complete set of field values, in .msg order
00070 @param kwds: use keyword arguments corresponding to message field names
00071 to set specific fields.
00072 """
00073 if args or kwds:
00074 super(DiagnosticArray, self).__init__(*args, **kwds)
00075
00076 if self.header is None:
00077 self.header = std_msgs.msg._Header.Header()
00078 if self.status is None:
00079 self.status = []
00080 else:
00081 self.header = std_msgs.msg._Header.Header()
00082 self.status = []
00083
00084 def _get_types(self):
00085 """
00086 internal API method
00087 """
00088 return self._slot_types
00089
00090 def serialize(self, buff):
00091 """
00092 serialize message into buffer
00093 @param buff: buffer
00094 @type buff: StringIO
00095 """
00096 try:
00097 _x = self
00098 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00099 _x = self.header.frame_id
00100 length = len(_x)
00101 buff.write(struct.pack('<I%ss'%length, length, _x))
00102 length = len(self.status)
00103 buff.write(_struct_I.pack(length))
00104 for val1 in self.status:
00105 buff.write(_struct_b.pack(val1.level))
00106 _x = val1.name
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = val1.message
00110 length = len(_x)
00111 buff.write(struct.pack('<I%ss'%length, length, _x))
00112 _x = val1.hardware_id
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 length = len(val1.values)
00116 buff.write(_struct_I.pack(length))
00117 for val2 in val1.values:
00118 _x = val2.key
00119 length = len(_x)
00120 buff.write(struct.pack('<I%ss'%length, length, _x))
00121 _x = val2.value
00122 length = len(_x)
00123 buff.write(struct.pack('<I%ss'%length, length, _x))
00124 except struct.error, se: self._check_types(se)
00125 except TypeError, te: self._check_types(te)
00126
00127 def deserialize(self, str):
00128 """
00129 unpack serialized message in str into this message instance
00130 @param str: byte array of serialized message
00131 @type str: str
00132 """
00133 try:
00134 if self.header is None:
00135 self.header = std_msgs.msg._Header.Header()
00136 end = 0
00137 _x = self
00138 start = end
00139 end += 12
00140 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 self.header.frame_id = str[start:end]
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 self.status = []
00151 for i in xrange(0, length):
00152 val1 = diagnostic_msgs.msg.DiagnosticStatus()
00153 start = end
00154 end += 1
00155 (val1.level,) = _struct_b.unpack(str[start:end])
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 start = end
00160 end += length
00161 val1.name = str[start:end]
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 start = end
00166 end += length
00167 val1.message = str[start:end]
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 start = end
00172 end += length
00173 val1.hardware_id = str[start:end]
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 val1.values = []
00178 for i in xrange(0, length):
00179 val2 = diagnostic_msgs.msg.KeyValue()
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 val2.key = str[start:end]
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 start = end
00190 end += length
00191 val2.value = str[start:end]
00192 val1.values.append(val2)
00193 self.status.append(val1)
00194 return self
00195 except struct.error, e:
00196 raise roslib.message.DeserializationError(e)
00197
00198
00199 def serialize_numpy(self, buff, numpy):
00200 """
00201 serialize message with numpy array types into buffer
00202 @param buff: buffer
00203 @type buff: StringIO
00204 @param numpy: numpy python module
00205 @type numpy module
00206 """
00207 try:
00208 _x = self
00209 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00210 _x = self.header.frame_id
00211 length = len(_x)
00212 buff.write(struct.pack('<I%ss'%length, length, _x))
00213 length = len(self.status)
00214 buff.write(_struct_I.pack(length))
00215 for val1 in self.status:
00216 buff.write(_struct_b.pack(val1.level))
00217 _x = val1.name
00218 length = len(_x)
00219 buff.write(struct.pack('<I%ss'%length, length, _x))
00220 _x = val1.message
00221 length = len(_x)
00222 buff.write(struct.pack('<I%ss'%length, length, _x))
00223 _x = val1.hardware_id
00224 length = len(_x)
00225 buff.write(struct.pack('<I%ss'%length, length, _x))
00226 length = len(val1.values)
00227 buff.write(_struct_I.pack(length))
00228 for val2 in val1.values:
00229 _x = val2.key
00230 length = len(_x)
00231 buff.write(struct.pack('<I%ss'%length, length, _x))
00232 _x = val2.value
00233 length = len(_x)
00234 buff.write(struct.pack('<I%ss'%length, length, _x))
00235 except struct.error, se: self._check_types(se)
00236 except TypeError, te: self._check_types(te)
00237
00238 def deserialize_numpy(self, str, numpy):
00239 """
00240 unpack serialized message in str into this message instance using numpy for array types
00241 @param str: byte array of serialized message
00242 @type str: str
00243 @param numpy: numpy python module
00244 @type numpy: module
00245 """
00246 try:
00247 if self.header is None:
00248 self.header = std_msgs.msg._Header.Header()
00249 end = 0
00250 _x = self
00251 start = end
00252 end += 12
00253 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00254 start = end
00255 end += 4
00256 (length,) = _struct_I.unpack(str[start:end])
00257 start = end
00258 end += length
00259 self.header.frame_id = str[start:end]
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 self.status = []
00264 for i in xrange(0, length):
00265 val1 = diagnostic_msgs.msg.DiagnosticStatus()
00266 start = end
00267 end += 1
00268 (val1.level,) = _struct_b.unpack(str[start:end])
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 start = end
00273 end += length
00274 val1.name = str[start:end]
00275 start = end
00276 end += 4
00277 (length,) = _struct_I.unpack(str[start:end])
00278 start = end
00279 end += length
00280 val1.message = str[start:end]
00281 start = end
00282 end += 4
00283 (length,) = _struct_I.unpack(str[start:end])
00284 start = end
00285 end += length
00286 val1.hardware_id = str[start:end]
00287 start = end
00288 end += 4
00289 (length,) = _struct_I.unpack(str[start:end])
00290 val1.values = []
00291 for i in xrange(0, length):
00292 val2 = diagnostic_msgs.msg.KeyValue()
00293 start = end
00294 end += 4
00295 (length,) = _struct_I.unpack(str[start:end])
00296 start = end
00297 end += length
00298 val2.key = str[start:end]
00299 start = end
00300 end += 4
00301 (length,) = _struct_I.unpack(str[start:end])
00302 start = end
00303 end += length
00304 val2.value = str[start:end]
00305 val1.values.append(val2)
00306 self.status.append(val1)
00307 return self
00308 except struct.error, e:
00309 raise roslib.message.DeserializationError(e)
00310
00311 _struct_I = roslib.message.struct_I
00312 _struct_3I = struct.Struct("<3I")
00313 _struct_b = struct.Struct("<b")