-
Notifications
You must be signed in to change notification settings - Fork 11
Use parameter yaml on startup for configuring greenwave monitor + rename to greenwave diagnostics #22
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
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
Greptile SummaryThis PR adds YAML parameter configuration support for greenwave_monitor and renames the diagnostics system from Key Changes:
Issues Already Noted in Previous Threads:
Testing:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LaunchFile
participant GreenwaveMonitor
participant InitTimer
participant ROS2Graph
participant MinimalPublisher
participant Diagnostics
User->>LaunchFile: Launch with YAML config
LaunchFile->>GreenwaveMonitor: Create node with parameters
GreenwaveMonitor->>GreenwaveMonitor: allow_undeclared_parameters(true)
GreenwaveMonitor->>GreenwaveMonitor: automatically_declare_parameters_from_overrides(true)
GreenwaveMonitor->>InitTimer: create_wall_timer(100ms)
Note over GreenwaveMonitor: Defer topic discovery to allow ROS graph to settle
User->>LaunchFile: Launch publisher nodes
LaunchFile->>MinimalPublisher: Create publisher node
MinimalPublisher->>ROS2Graph: Register publishers
InitTimer-->>GreenwaveMonitor: Timer fires after 100ms
GreenwaveMonitor->>InitTimer: cancel()
GreenwaveMonitor->>GreenwaveMonitor: deferred_init()
GreenwaveMonitor->>GreenwaveMonitor: add_topics_from_parameters()
GreenwaveMonitor->>GreenwaveMonitor: Parse gw_frequency_monitored_topics
GreenwaveMonitor->>GreenwaveMonitor: Parse gw_monitored_topics
loop For each topic in YAML
GreenwaveMonitor->>ROS2Graph: get_publishers_info_by_topic()
ROS2Graph-->>GreenwaveMonitor: Publisher info
GreenwaveMonitor->>GreenwaveMonitor: add_topic(topic, retries=5)
GreenwaveMonitor->>Diagnostics: Create GreenwaveDiagnostics
alt Has expected_frequency > 0
GreenwaveMonitor->>Diagnostics: setExpectedDt(freq, tolerance)
else frequency <= 0
Note over GreenwaveMonitor: Monitor without frequency settings
end
end
GreenwaveMonitor->>GreenwaveMonitor: Create service servers
MinimalPublisher->>Diagnostics: Publish messages
Diagnostics->>Diagnostics: updateDiagnostics()
Diagnostics->>ROS2Graph: Publish to /diagnostics
User->>GreenwaveMonitor: SIGINT (shutdown)
GreenwaveMonitor->>InitTimer: cancel() in destructor
GreenwaveMonitor->>GreenwaveMonitor: Clear diagnostics & subscriptions
MinimalPublisher->>MinimalPublisher: cancel timer in destructor
MinimalPublisher->>MinimalPublisher: reset greenwave_diagnostics_
Note over GreenwaveMonitor,MinimalPublisher: Proper cleanup prevents exit code -11
|
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.
5 files reviewed, 5 comments
Signed-off-by: Blake McHale <[email protected]>
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.
5 files reviewed, 5 comments
Signed-off-by: Blake McHale <[email protected]>
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.
5 files reviewed, 5 comments
Signed-off-by: Blake McHale <[email protected]>
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.
1 file reviewed, 1 comment
Signed-off-by: Blake McHale <[email protected]>
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.
1 file reviewed, 1 comment
|
This also closes #19 |
| expected_frequency: 100.0 | ||
| tolerance: 10.0 | ||
| /image_topic: | ||
| expected_frequency: 0.0 # Invalid parameter settings are ignored |
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's elaborate - ignored and we use the default "report topic frequency but don't check it" behavior
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.
I think we should include the string topic here as well? Also with expected_frequency = 0?
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.
Nit: We're missing the copyright header here.
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.
I left out the string topic on purpose so that it gets picked up by the topics:= parameter. I still think that parameter is useful for just starting the monitor without frequency and tolerance set. Wanted to make sure there was still an example.
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.
I moved topics:= into the YAML so that users can reference it.
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
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.
15 files reviewed, 1 comment
Signed-off-by: Blake McHale <[email protected]>
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.
15 files reviewed, 4 comments
Signed-off-by: Blake McHale <[email protected]>
Signed-off-by: Blake McHale <[email protected]>
Add support for ROS parameter YAML on startup and rename message diagnostics to greenwave diagnostics to match parameter yaml group name. Look at the example.yaml if you want to see how it is integrated.
Fixes a few bugs/makes the system robust also. Specifically #16 .