Skip to content

Conversation

@mahmoud-ghalayini
Copy link
Collaborator

Public API Changes:

  • remoteNodeName (getter)
  • watchedParameters (getter)
  • start(timeout?) - Start watching
  • getCurrentValues(options?) - Get current values
  • addParameter(name) - Add to watch list
  • removeParameter(name) - Remove from watch list
  • on('change', callback) - Listen for changes
  • isDestroyed() / destroy()

Implementation Details

Core Class: lib/parameter_watcher.js

  • Subscribes to /parameter_events topic
  • Filters events by node name and parameter names
  • Emits 'change' event when watched parameters change
  • Provides addParameter() / removeParameter() for dynamic management
  • Integrates with Node lifecycle for automatic cleanup

Node Integration:

  • node.createParameterWatcher(remoteNodeName, parameterNames, options)
  • node.destroyParameterWatcher(watcher)
  • Auto-destroy when parent node is destroyed

1325

@mahmoud-ghalayini mahmoud-ghalayini force-pushed the feat-add-parameter-watcher-for-real-time-parameter-monitoring-1325 branch from a91ddb6 to 211aa69 Compare November 17, 2025 09:27
@coveralls
Copy link

coveralls commented Nov 17, 2025

Coverage Status

coverage: 82.867% (+0.4%) from 82.465%
when pulling 1bd2a5a on mahmoud-ghalayini:feat-add-parameter-watcher-for-real-time-parameter-monitoring-1325
into 08a4d33 on RobotWebTools:develop.

@minggangw
Copy link
Member

Thanks for submitting the PR, will take a look later, thanks!

@minggangw minggangw requested a review from Copilot November 18, 2025 04:43
Copilot finished reviewing on behalf of minggangw November 18, 2025 04:46
Copy link

Copilot AI left a 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 ParameterWatcher class 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() and removeParameter() 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.

Copy link
Member

@minggangw minggangw left a 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!

Copy link
Member

@minggangw minggangw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mahmoud-ghalayini mahmoud-ghalayini force-pushed the feat-add-parameter-watcher-for-real-time-parameter-monitoring-1325 branch from 211aa69 to 1bd2a5a Compare November 20, 2025 08:37
Copy link
Member

@minggangw minggangw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@mahmoud-ghalayini mahmoud-ghalayini merged commit ea34fab into RobotWebTools:develop Nov 21, 2025
18 checks passed
minggangw pushed a commit that referenced this pull request Nov 26, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants