diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b14c29..146d6bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [1.0.0](https://github.com/HAROS-framework/hpl-rv-ros/releases/tag/v1.0.0) - 2023-08-01 +## [v1.0.1](https://github.com/HAROS-framework/hpl-rv-ros/releases/tag/v1.0.1) - 2023-08-01 +### Changed +- The generated ROS nodes now start the live monitoring server. + +## [v1.0.0](https://github.com/HAROS-framework/hpl-rv-ros/releases/tag/v1.0.0) - 2023-08-01 Initial release. This package provides a tool to generate ROS1 and ROS2 Python runtime monitors from HPL specifications. This version includes both an interface to use as a library and a CLI script for direct usage. -## [0.0.0](https://github.com/HAROS-framework/hpl-rv-ros/releases/tag/v0.0.0) - 2023-07-19 +## [v0.0.0](https://github.com/HAROS-framework/hpl-rv-ros/releases/tag/v0.0.0) - 2023-07-19 Repository creation. diff --git a/src/hplrv_ros/templates/rclpy.py.jinja b/src/hplrv_ros/templates/rclpy.py.jinja index b3beeac..987e405 100644 --- a/src/hplrv_ros/templates/rclpy.py.jinja +++ b/src/hplrv_ros/templates/rclpy.py.jinja @@ -26,6 +26,9 @@ class HplMonitorNode(Node): def __init__(self): super().__init__('hplrv_monitor') self.monitor = HplMonitorManager(success_cb=self._on_success, failure_cb=self._on_failure) + self.monitor.live_server.host = '127.0.0.1' + self.monitor.live_server.port = 4242 + self._thread = None self.timer = self.create_timer(0.01, self.on_timer) latching_qos = QoSProfile( depth=1, @@ -51,12 +54,16 @@ class HplMonitorNode(Node): ] def on_launch(self): + self._thread = self.monitor.live_server.start_thread() t = self.get_clock().now() self.monitor.launch(t) def on_shutdown(self): t = self.get_clock().now() self.monitor.shutdown(t) + assert self._thread is not None + self._thread.join(10.0) + self._thread = None def on_timer(self): t = self.get_clock().now() diff --git a/src/hplrv_ros/templates/rospy.py.jinja b/src/hplrv_ros/templates/rospy.py.jinja index 8a3f8de..10c8be4 100644 --- a/src/hplrv_ros/templates/rospy.py.jinja +++ b/src/hplrv_ros/templates/rospy.py.jinja @@ -21,6 +21,8 @@ import {{ rospkg }}.msg as {{ rospkg }} class HplMonitorNode: def __init__(self): self.monitor = HplMonitorManager(success_cb=self._on_success, failure_cb=self._on_failure) + self.monitor.live_server.host = '127.0.0.1' + self.monitor.live_server.port = 4242 self.pubs = {} for i in range(len(self.monitor.monitors)): mon = self.monitor.monitors[i] @@ -37,6 +39,7 @@ class HplMonitorNode: ] def run(self): + thread = self.monitor.live_server.start_thread() t = rospy.get_time() self.monitor.launch(t) rate = rospy.Rate(100) # 100hz @@ -48,6 +51,7 @@ class HplMonitorNode: except rospy.ROSInterruptException: t = rospy.get_time() self.monitor.shutdown(t) + thread.join(10.0) {# -#} {% for topic in topics %}