35 """ diagnostic_updater for Python. 36 @author Brice Rebsamen <brice [dot] rebsamen [gmail]> 40 from diagnostic_msgs.msg
import DiagnosticStatus, KeyValue
42 OK = DiagnosticStatus.OK
43 WARN = DiagnosticStatus.WARN
44 ERROR = DiagnosticStatus.ERROR
47 """ Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it 50 This class handles common string formatting and vector handling issues 51 for filling the diagnostic_msgs::DiagnosticStatus message. It is a subclass of 52 diagnostic_msgs::DiagnosticStatus, so it can be passed directly to 53 diagnostic publish calls. 58 Constructor. Any message fields that are implicitly/explicitly 59 set to None will be assigned a default value. The recommend 60 use is keyword arguments as this is more robust to future message 61 changes. You cannot mix in-order arguments and keyword arguments. 63 The available fields are: 64 level,name,message,hardware_id,values 66 @param args: complete set of field values, in .msg order 67 @param kwds: use keyword arguments corresponding to message field names 68 to set specific fields. 70 DiagnosticStatus.__init__(self, *args, **kwds)
74 """ Fills out the level and message fields of the DiagnosticStatus. 77 summary(diagnostic_status): Copies the summary from a DiagnosticStatus message 78 summary(lvl,msg): sets from lvl and messages 89 """ Clears the summary, setting the level to zero and the message to "". 95 """ Merges a level and message with the existing ones. 97 It is sometimes useful to merge two DiagnosticStatus messages. In that case, 98 the key value pairs can be unioned, but the level and summary message 99 have to be merged more intelligently. This function does the merge in 100 an intelligent manner, combining the summary in *this, with the one 103 The combined level is the greater of the two levels to be merged. 104 If both levels are non-zero (not OK), the messages are combined with a 105 semicolon separator. If only one level is zero, and the other is 106 non-zero, the message for the zero level is discarded. If both are 107 zero, the new message is ignored. 110 mergeSummary(diagnostic_status): merge from a DiagnosticStatus message 111 mergeSummary(lvl,msg): sets from lvl and msg 115 msg = args[0].message
120 if (lvl>0) == (self.
level>0):
124 elif lvl > self.
level:
132 """ Add a key-value pair. 134 This method adds a key-value pair. Any type that has a << stream 135 operator can be passed as the second argument. Formatting is done 136 using a std::stringstream. 139 @param key Key to be added. 141 @param value Value to be added. 143 self.values.append(KeyValue(key,str(val)))
def mergeSummary(self, args)
def __init__(self, args, kwds)