-
Notifications
You must be signed in to change notification settings - Fork 81
feat: add ParameterWatcher for real time parameter monitoring #1326
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
feat: add ParameterWatcher for real time parameter monitoring #1326
Conversation
a91ddb6 to
211aa69
Compare
|
Thanks for submitting the PR, will take a look later, thanks! |
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 adds a new ParameterWatcher class that enables real-time monitoring of parameter changes on remote ROS 2 nodes. The implementation subscribes to the /parameter_events topic and filters events by node name and parameter names, emitting a 'change' event when watched parameters are modified.
Key Changes:
- New
ParameterWatcherclass with EventEmitter-based API for monitoring parameter changes - Integration with Node lifecycle for automatic cleanup and resource management
- Dynamic parameter watch list management via
addParameter()andremoveParameter()methods
Reviewed Changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| types/parameter_watcher.d.ts | TypeScript definitions for ParameterWatcher class and its options |
| types/node.d.ts | Added createParameterWatcher() and destroyParameterWatcher() method signatures |
| types/base.d.ts | Added reference to parameter_watcher.d.ts |
| lib/parameter_watcher.js | Core implementation of ParameterWatcher class with event handling and filtering |
| lib/node.js | Integration of ParameterWatcher into Node class with lifecycle management |
| index.js | Export of ParameterWatcher class in main module |
| test/test-parameter-watcher.js | Comprehensive test suite covering constructor, events, lifecycle, and edge cases |
| example/parameter/parameter-watcher-example.js | Example demonstrating real-time parameter monitoring with turtlesim |
| example/parameter/README.md | Documentation for ParameterWatcher usage and API |
| CONTRIBUTORS.md | Added attribution for ParameterWatcher feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
minggangw
left a comment
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.
Will take a closer look later, mostly looks good to me, thanks!
minggangw
left a comment
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.
LGTM
211aa69 to
1bd2a5a
Compare
minggangw
left a comment
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.
lgtm, thanks!
Implement ParameterWatcher class to enable real-time monitoring of parameter changes on remote nodes. Subscribes to /parameter_events topic and emits 'change' events when watched parameters are modified. Features: - Watch specific parameters on remote nodes - Real-time change notifications via EventEmitter - Dynamic parameter list management (add/remove) - Async/await support with timeout and AbortSignal - Proper lifecycle management and cleanup
Public API Changes:
remoteNodeName(getter)watchedParameters(getter)start(timeout?)- Start watchinggetCurrentValues(options?)- Get current valuesaddParameter(name)- Add to watch listremoveParameter(name)- Remove from watch liston('change', callback)- Listen for changesisDestroyed()/destroy()Implementation Details
Core Class:
lib/parameter_watcher.js/parameter_eventstopic'change'event when watched parameters changeaddParameter()/removeParameter()for dynamic managementNode Integration:
node.createParameterWatcher(remoteNodeName, parameterNames, options)node.destroyParameterWatcher(watcher)1325