Skip to content

ParameterWatcher for Real-Time Parameter Monitoring #1325

@mahmoud-ghalayini

Description

@mahmoud-ghalayini

The Problem

Currently, to watch parameters on a remote node, you have to:

  1. Subscribe to /parameter_events topic
  2. Filter events by node name manually
  3. Filter by parameter names manually
  4. Handle all the event filtering logic

Solution

Implemented ParameterWatcher - an event-driven class that automatically monitors parameter changes on remote nodes.

// Create watcher for specific parameters
const watcher = node.createParameterWatcher('turtlesim', [
  'background_r',
  'background_g'
]);

// Listen for changes
watcher.on('change', (params) => {
  params.forEach(p => console.log(`${p.name} changed to ${p.value}`));
});

await watcher.start();

// Dynamically add/remove parameters
watcher.addParameter('background_b');
watcher.removeParameter('background_g');

// Get current values anytime
const current = await watcher.getCurrentValues();

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions