-
Notifications
You must be signed in to change notification settings - Fork 9
First version working for ROS2 #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot <[email protected]>
This reverts commit 761bc72.
…d rename devcontainer
making the structure compliant with our usual structure and adding CI and devcontainer
|
Great to see Cyano0#1 is now merged into the and we have first successful CI builds: https://github.com/LCAS/sentor/pull/60/checks Now, I strongly suggest that basic functionality is tried out in the devcontainer. Once @Cyano0 confirms it works as intended, please tick the "ready for review" button Thanks |
I will just replace the ros2 topic type today test it locally and then go for ready for review. |
Great, thanks, but please test (also) in the dev container. That is the cleanest environment, as the wrong shebang I spotted earlier suggest you have a customised python environment that is not standard. So, always best to make sure it runs in the "safe space" of the dev container (at least as well, if you don't fancy developing in it) |
Updates the output information
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Over to @ibrahimhroob and @LeonardoGuevara to chip in and approve if they're happy |
|
Can you provide instructions on how to test the implementation? I tried to run I tried and it already fails loading the configuration: I know how to fix that one, i.e., change https://github.com/LCAS/sentor/pull/60/files#diff-1a1c2b9ef95420336044e9bdfa777dd93ff406d38febd6a0c187b6053ef25f26R51 to this: topics = [item for sublist in items for item in sublist['monitors']]Then it loads the file, but fails later with As I said, I likely do something fundamentally wrong, but hope you can advise. All should be directly reproducable in the dev container. |
|
I have also created Cyano0#2 to add a |
Sorry I was using test_sentor.py to run sentor. The current version of sentor_note.py is an old version of code (before I added some new functions), I should replace it with the current test_sentor.py and delete the test_sentor.py. I usually run like: |
Add launch files and update package.xml for Sentor monitoring system
I see! In that. can you please update this, as the name of the node is then misleading. Or is it only a test node and not the one that should finally be used? I'd like to have this as complete as possible before we merge it |
Sure, I have updated this. It can be used as a final node at least to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR transitions the Sentor monitoring system from ROS 1 to ROS 2, implementing dual-level heartbeat monitoring with safety and warning beats. The change removes all ROS 1-specific code and configurations while introducing comprehensive ROS 2 implementations with node monitoring capabilities.
- Complete migration from ROS 1 to ROS 2 architecture with updated message interfaces and node structures
- Introduction of dual heartbeat system: safety-critical monitoring via
safety/heartbeatand autonomy-critical monitoring viawarning/heartbeat - Addition of NodeMonitor class for ROS 2 node liveness tracking alongside existing topic monitoring
Reviewed Changes
Copilot reviewed 56 out of 61 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sentor_msgs/ | New ROS 2 message package with updated message definitions and service interfaces |
| src/sentor/sentor/ | Complete ROS 2 Python implementation of monitoring classes with dual-level heartbeat support |
| src/sentor/scripts/sentor_node.py | Main ROS 2 node orchestrating topic and node monitors with heartbeat publishers |
| src/sentor/config/test_monitor_config.yaml | Example configuration demonstrating ROS 2 YAML structure with safety/autonomy flags |
| Legacy files removed | All ROS 1 CMakeLists.txt, package.xml, launch files, and Python implementations |
Comments suppressed due to low confidence (1)
src/sentor_msgs/srv/GetTopicMaps.srv:3
- The service response references
sentor_msgs/TopicMapArraybut this message type is not consistently used throughout the codebase. Consider verifying that all message type references use the correct package prefix.
sentor_msgs/TopicMapArray topic_maps
| crit = [k for k,v in self.conditions.items() if v.get("safety_critical")] | ||
| lamb_ok = all(self.conditions[k]["satisfied"] for k in crit) if crit else True | ||
| alive = rate_ok and lamb_ok | ||
| self.node.get_logger().info(f"[LIVENESS] {self.topic_name}: rate={rate:.2f}/{self.rate}, lambdas={crit} all={lamb_ok}") |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The liveness check logging at INFO level occurs every second (line 95 timer). This could generate excessive log output in production. Consider using DEBUG level or reducing the frequency of this logging.
| self.node.get_logger().info(f"[LIVENESS] {self.topic_name}: rate={rate:.2f}/{self.rate}, lambdas={crit} all={lamb_ok}") | |
| self.node.get_logger().debug(f"[LIVENESS] {self.topic_name}: rate={rate:.2f}/{self.rate}, lambdas={crit} all={lamb_ok}") |
| self.enabled = False | ||
| self.node.get_logger().info(f"[ROSTopicHz] Monitoring stopped for {self.topic_name}") | ||
|
|
||
| # def callback_hz(self, msg): |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are large blocks of commented code (lines 56-125 and 131-143) that should be removed to improve code readability and maintainability.
| self._stop_event.clear() | ||
|
|
||
|
|
||
| # import rclpy |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are large blocks of commented-out code (lines 88-333) that should be removed to improve code maintainability and readability.
| # FIX: Get the service type manually | ||
| service_class = get_service_type(service_name) |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment indicates this is a temporary fix. Consider implementing proper service type discovery or document why manual service type mapping is the intended approach.
| # FIX: Get the service type manually | |
| service_class = get_service_type(service_name) | |
| # Dynamically discover the service type using ROS2 introspection | |
| service_class = get_service_class_by_name(self, service_name) |
| def sleep(self, duration): | ||
| """ Sleeps for a given duration in seconds """ | ||
| self.get_logger().info(f"Sleeping for {duration} seconds...") | ||
| time.sleep(duration) # FIX: Replaced `rclpy.sleep()` with `time.sleep()` |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment suggests this is a temporary fix. In ROS 2, consider using the node's timer mechanisms or rclpy.sleep() for better integration with the ROS 2 executor.
| time.sleep(duration) # FIX: Replaced `rclpy.sleep()` with `time.sleep()` | |
| sleep_future = rclpy.task.Future() | |
| self.create_timer(duration, lambda: sleep_future.set_result(True)) | |
| rclpy.spin_until_future_complete(self, sleep_future) |
| @@ -0,0 +1,138 @@ | |||
| monitors: #[] | |||
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration file contains extensive commented-out sections (lines 2-56) that make it difficult to understand the actual configuration. Consider moving example configurations to separate documentation or example files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let get this merged
What type of PR is this? (check all applicable)
Description
This PR adds dual-level heartbeat monitoring in Sentor:
safety/heartbeat) – driven bysafety_criticalcheckswarning/heartbeat) – driven byautonomy_criticalchecksOther key pieces added:
NodeMonitorclass to track ROS 2 node liveness.TopicMonitorandSafetyMonitorto expose bothis_aliveandis_autonomy_alive.autonomy_critical) + extended README with detailed config guidance.test_monitor_config.yaml) covering topic + node monitors.This pull request removes the ROS 1-specific implementation of the
sentorpackage, transitioning it to a ROS 2-only codebase. The changes include removing ROS 1 dependencies, messages, configurations, and launch files, as well as adding comprehensive documentation for the ROS 2 YAML configuration structure.Key Changes:
Removal of ROS 1-specific files and configurations:
CMakeLists.txtfile, which contained ROS 1-specific build instructions, includingcatkindependencies, message/service generation, and installation rules.package.xml, which defined ROS 1 dependencies and metadata for thesentorpackage.launch/sentor.launchandlaunch/topic_mapping.launch. These files configured ROS 1 nodes and parameters. [1] [2]msg/MonitorArray.msgandmsg/TopicMapArray.msg. [1] [2]Removal of legacy configuration files:
config/execute.yaml,config/map.yaml,config/rob_lindsey.yaml,config/test.yaml) that were designed for ROS 1 monitoring setups. These files included topic monitors, signal lambdas, and execution rules. [1] [2] [3] [4]Documentation updates for ROS 2:
README.mdexplaining the YAML configuration structure for ROS 2, includingmonitors,node_monitors, and heartbeat topics (safety/heartbeatandwarning/heartbeat). The documentation also provides examples and a quick checklist for users migrating to ROS