34 from diagnostic_msgs.msg
import DiagnosticStatus
35 from python_qt_binding.QtCore
import QMutex, QMutexLocker, QSize, QTimer, Signal
37 from .icon_tool_button
import IconToolButton
42 A widget which brings up the rqt_robot_monitor. 44 Times out after certain period of time (set as 5 sec as of Apr 2013) 45 without receiving diagnostics msg ('/diagnostics_toplevel_state' of 46 DiagnosticStatus type), status becomes as 'stale'. 48 :param context: The plugin context to create the monitor in. 49 :type context: qt_gui.plugin_context.PluginContext 51 _msg_trigger = Signal()
55 ok_icon = [
'bg-green.svg',
'ic-diagnostics.svg']
56 warn_icon = [
'bg-yellow.svg',
'ic-diagnostics.svg',
58 err_icon = [
'bg-red.svg',
'ic-diagnostics.svg',
'ol-err-badge.svg']
59 stale_icon = [
'bg-grey.svg',
'ic-diagnostics.svg',
62 icons = [ok_icon, warn_icon, err_icon, stale_icon]
64 super(MonitorDashWidget, self).
__init__(
'MonitorWidget', icons,
65 icon_paths=icon_paths)
67 self.setFixedSize(self._icons[0].actualSize(QSize(50, 30)))
79 self.setToolTip(
'Diagnostics')
82 'diagnostics_toplevel_state',
86 self._stall_timer.timeout.connect(self.
_stalled)
94 self._msg_trigger.emit()
99 self.setToolTip(
"Diagnostics: Error")
100 elif (msg.level == 1):
102 self.setToolTip(
"Diagnostics: Warning")
105 self.setToolTip(
"Diagnostics: OK")
109 self._stall_timer.start(5000)
112 self._stall_timer.stop()
116 self.setToolTip(
"Diagnostics: Stale\nNo message received on " 117 "/diagnostics_agg in the last 5 seconds")
123 self.context.remove_widget(self.
_monitor)
132 self.context.add_widget(self.
_monitor)
148 self._monitor.shutdown()
149 self._monitor.close()
150 self._graveyard.append(self.
_monitor)
154 self._stall_timer.stop()
156 self._monitor.shutdown()
157 self._diagnostics_toplevel_state_sub.unregister()