Skip to content

Commit

Permalink
Add script for objetive error observer
Browse files Browse the repository at this point in the history
  • Loading branch information
marioney committed May 22, 2020
1 parent 86a23da commit 674fc29
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/rosgraph_monitor/observers/objetive_error_observer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from rosgraph_monitor.observer import TopicObserver
from std_msgs.msg import Bool
from diagnostic_msgs.msg import DiagnosticStatus, KeyValue


class ObjetiveErrorObserver(TopicObserver):
def __init__(self, name):
topics = [("/obj_error", Bool)] # list of pairs

super(ObjetiveErrorObserver, self).__init__(
name, 10, topics)

def calculate_attr(self, msgs):
status_msg = DiagnosticStatus()

attr = str("False")
if msgs[0].data:
attr = str("True")

status_msg = DiagnosticStatus()
status_msg.level = DiagnosticStatus.OK
status_msg.name = self._id
status_msg.values.append(
KeyValue("objetive_error", attr))
status_msg.message = "QA status"

return status_msg

0 comments on commit 674fc29

Please sign in to comment.