necst.core.alert.alert_handler_node¶
- class AlertHandlerNode(node_name, **kwargs)[source]¶
Bases:
Node
Node who knows system alert status.
This and subclass of this will subscribe to all alert topics, to use the alert status of whole system.
Examples
>>> class MyClass(necst.core.AlertHandlerNode): ... def __init__(self): ... self.pub = self.create_publisher(AlertMsg, "alert_any", 1) ... self.create_timer(1, self.stream) ... def stream(self): ... subscribing_topics = [s.topic_name for s in self.subscriptions] ... w = [self.status[topic].warning for topic in subscribing_topics] ... c = [self.status[topic].critical for topic in subscribing_topics] ... msg = AlertMsg(warning=any(w), critical=any(c), issuer="alert_any") ... self.pub.publish(msg)
- Parameters
node_name (str) –
- property status: Status¶