Add more docs and a clean integration example publisher.#29
Add more docs and a clean integration example publisher.#29
Conversation
Greptile SummaryThis PR adds comprehensive documentation and a clean example showing inline greenwave diagnostics integration. The new Key additions:
All code follows project conventions, includes proper tests, and demonstrates best practices for inline diagnostics integration. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ExampleGreenwavePublisherNode Constructor] --> B[Declare Parameters: topic, frequency_hz]
B --> C[Create Publisher for sensor_msgs/Imu]
C --> D[Initialize GreenwaveDiagnostics with config]
D --> E[Create publish_timer at frequency_hz]
D --> F[Create diagnostics_timer at 1Hz]
E --> G[publish_message callback]
G --> H[Create Imu message with header]
H --> I[Publish message]
I --> J[Extract timestamp from header]
J --> K[Call updateDiagnostics with timestamp]
F --> L[publish_diagnostics callback]
L --> M[Call publishDiagnostics on greenwave_diagnostics]
M --> N[Diagnostics published to /diagnostics topic]
Last reviewed commit: c7b17d4 |
| protected: | ||
| void SetUp() override | ||
| { | ||
| rclcpp::init(0, nullptr); |
There was a problem hiding this comment.
rclcpp::init() called in SetUp() will cause tests to fail if run multiple times in same process, since ROS context is already initialized
| rclcpp::init(0, nullptr); | |
| if (!rclcpp::ok()) { | |
| rclcpp::init(0, nullptr); | |
| } |
| - The central monitor only parses headers for types listed in | ||
| `GreenwaveMonitor::has_header_from_type()`; unknown types fall back to no-header behavior. | ||
| - `publishDiagnostics()` marks status as `STALE` if no fresh `updateDiagnostics()` happened since the previous publish. | ||
| - `setExpectedDt()` requires `expected_hz > 0`; zero disables useful timing checks. |
There was a problem hiding this comment.
Should we mention to not press "enter" on externally monitored topics as it may create a duplicate diagnostic subscription?
docs/DESIGN_AND_IMPLEMENTATION.md
Outdated
| - jitter/outlier counters and summary stats | ||
| - status transitions (`OK`, `ERROR`, `STALE`) for missed timing expectations | ||
|
|
||
| In particular, the messages follow conventions from [Isaac ROS NITROS](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nitros), which means configured NITROS nodes can be monitored by greenwave monitor frontends without any additional subscriber overhead. For example the drivers from [Isaac ROS NOVA](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nova) can be monitored out of the box. Furthermore, you can set `ENABLE_GLOBAL_NITROS_DIAGNOSTICS=1` to configure all NITROS nodes to publish diagnostics (more info [here](https://nvidia-isaac-ros.github.io/repositories_and_packages/isaac_ros_nitros/isaac_ros_nitros/index.html)). |
There was a problem hiding this comment.
| In particular, the messages follow conventions from [Isaac ROS NITROS](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nitros), which means configured NITROS nodes can be monitored by greenwave monitor frontends without any additional subscriber overhead. For example the drivers from [Isaac ROS NOVA](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nova) can be monitored out of the box. Furthermore, you can set `ENABLE_GLOBAL_NITROS_DIAGNOSTICS=1` to configure all NITROS nodes to publish diagnostics (more info [here](https://nvidia-isaac-ros.github.io/repositories_and_packages/isaac_ros_nitros/isaac_ros_nitros/index.html)). | |
| In particular, the messages follow conventions from [Isaac ROS NITROS](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nitros), which means configured NITROS nodes can be monitored by greenwave monitor frontends without any additional subscriber overhead. For example the drivers from [Isaac ROS Nova](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nova) can be monitored out of the box. Furthermore, you can set `ENABLE_GLOBAL_NITROS_DIAGNOSTICS=1` to configure all NITROS nodes to publish diagnostics (more info [here](https://nvidia-isaac-ros.github.io/repositories_and_packages/isaac_ros_nitros/isaac_ros_nitros/index.html)). |
To keep it consistent with marketing, Nova instead of NOVA
docs/DESIGN_AND_IMPLEMENTATION.md
Outdated
|
|
||
| - `greenwave_monitor/greenwave_monitor/ui_adaptor.py` subscribes to `/diagnostics`. | ||
| - Maintains a table of topic->`DiagnosticStatus` | ||
| - Frontends render from a single dictionary maintained by the UIadaptor, rather than a stream of diagnostics messages. |
There was a problem hiding this comment.
| - Frontends render from a single dictionary maintained by the UIadaptor, rather than a stream of diagnostics messages. | |
| - Frontends render from a single dictionary maintained by the `GreenwaveUiAdaptor`, rather than a stream of diagnostics messages. |
Nit, we call it GreenwaveUiAdaptor in the code, just to align some naming.
docs/DESIGN_AND_IMPLEMENTATION.md
Outdated
| - `/greenwave_monitor/manage_topic` (`ManageTopic.srv`) | ||
| - `/greenwave_monitor/set_expected_frequency` (`SetExpectedFrequency.srv`) | ||
|
|
||
| ### 3) UI adapters |
There was a problem hiding this comment.
| ### 3) UI adapters | |
| ### 3) UI adaptors |
Super nit, keep using british adaptor for consistency
| - `publishDiagnostics()` marks status as `STALE` if no fresh `updateDiagnostics()` happened since the previous publish. | ||
| - `setExpectedDt()` requires `expected_hz > 0`; zero disables useful timing checks. | ||
|
|
||
| ## Where To Look In Code |
There was a problem hiding this comment.
Nit, for this section we say where to look in code but don't link to it. As a user I'd find it useful to use this as a spot for jumping and looking at the code.
Adds a new architecture doc, a clean example on how to integrate greenwave diagnostics inline, and a small Agents.md file.