Skip to content

Commit a88f7f7

Browse files
committed
feat(demos/manymove_industrial): publish bridge heartbeat under /plc namespace
Topic-discovery in the medkit gateway routes nodes into SOVD entity tree slots by namespace. Without any published topic, the opcua_bridge was invisible in the entity tree even though its faults appeared in the dashboard. Publishing a 1 Hz heartbeat on /plc/heartbeat anchors the bridge under the conveyor-line area so operators see it next to the PLC components.
1 parent 85d24c0 commit a88f7f7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • demos/manymove_industrial/opcua_bridge

demos/manymove_industrial/opcua_bridge/bridge.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import rclpy
2626
from rclpy.node import Node
2727
from ros2_medkit_msgs.srv import ReportFault
28+
from std_msgs.msg import String
2829

2930
from asyncua import Client, ua
3031

@@ -85,11 +86,24 @@ class BridgeNode(Node):
8586
"""
8687

8788
def __init__(self) -> None:
88-
super().__init__("opcua_bridge")
89+
# Place the node under /plc namespace so the medkit gateway's
90+
# topic-discovery routes it under the conveyor-line area instead
91+
# of the global / namespace.
92+
super().__init__("sensor_io", namespace="/plc")
8993
self.client = self.create_client(ReportFault, REPORT_FAULT_SERVICE)
9094
self.source_id = SOURCE_ID
95+
# Heartbeat publisher: makes the bridge node discoverable in the
96+
# SOVD entity tree (topic-discovery requires at least one topic
97+
# per node) and gives operators a simple liveness signal.
98+
self.heartbeat_pub = self.create_publisher(String, "heartbeat", 10)
99+
self._heartbeat_timer = self.create_timer(1.0, self._publish_heartbeat)
91100
self._await_service()
92101

102+
def _publish_heartbeat(self) -> None:
103+
msg = String()
104+
msg.data = "opcua_bridge alive"
105+
self.heartbeat_pub.publish(msg)
106+
93107
def _await_service(self) -> None:
94108
while rclpy.ok() and not self.client.wait_for_service(timeout_sec=2.0):
95109
self.get_logger().info(

0 commit comments

Comments
 (0)