diagnostics.py
Go to the documentation of this file.
1 import roslib; roslib.load_manifest('webui')
2 import rospy
3 import sys
4 import rosweb
5 from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus, KeyValue
6 
7 
9  def __init__(self, topic, factory, main_rwt):
10  rosweb.ROSWebSubTopic.__init__(self, topic, factory, main_rwt)
11 
12  def transform(self, msg):
13  statuses = msg.status
14  for status in statuses:
15  if not status.name.startswith('/'):
16  status.name = '/' + status.name
17 
18  def top_only(status): return status.name.count("/") < 2
19  filtered_statuses = filter(top_only, statuses)
20  levels = [status.level for status in filtered_statuses]
21 
22  new_message = DiagnosticStatus()
23  new_message.name = "Robot Status"
24  new_message.level = max(levels)
25 
26  return new_message
27 
29  def __init__(self, topic, factory, main_rwt):
30  rosweb.ROSWebSubTopic.__init__(self, topic, factory, main_rwt)
31 
32  def transform(self, msg):
33  statuses = msg.status
34  for status in statuses:
35  if not status.name.startswith('/'):
36  status.name = '/' + status.name
37 
38  def top_only(status): return status.name.count("/") < 2
39  filtered_statuses = filter(top_only, statuses)
40 
41  #rospy.loginfo("statuses: %s" % statuses)
42  #rospy.loginfo("f_statuses: %s" % filtered_statuses)
43 
44  #for status in filtered_statuses:
45  # rospy.loginfo("name: %s" % status.name)
46  new_message = DiagnosticArray()
47  new_message.status = filtered_statuses
48 
49  return new_message
50 
52  def __init__(self, topic, factory, main_rwt):
53  rosweb.ROSWebSubTopic.__init__(self, topic, factory, main_rwt)
54  _, _, self.params = rosweb.splitTopic(topic)
55 
56  def transform(self, msg):
57  subtopic = self.params
58  statuses = msg.status
59  for status in statuses:
60  if not status.name.startswith('/'):
61  status.name = '/' + status.name
62 
63  def device(status): return status.name.startswith(subtopic)
64  filtered_statuses = filter(device, statuses)
65 
66  new_message = DiagnosticArray()
67  new_message.status = filtered_statuses
68 
69  return new_message
70 
71 def config_plugin(context):
72  context.register_subtopic("/diagnostics_agg:filter", FilterDevice)
73  context.register_subtopic("/diagnostics_agg:Summary", Summary)
74  context.register_subtopic("/diagnostics_agg:Status", Status)
def __init__(self, topic, factory, main_rwt)
Definition: diagnostics.py:29
def config_plugin(context)
Definition: diagnostics.py:71
def __init__(self, topic, factory, main_rwt)
Definition: diagnostics.py:52
def transform(self, msg)
Definition: diagnostics.py:32
def __init__(self, topic, factory, main_rwt)
def transform(self, msg)
Definition: diagnostics.py:12
def splitTopic(topic)
def __init__(self, topic, factory, main_rwt)
Definition: diagnostics.py:9


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24