-
Notifications
You must be signed in to change notification settings - Fork 6
Enhance RTDE with throttling options, document & bug fix. #574
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
base: main
Are you sure you want to change the base?
Conversation
…imestamp bug and updated documentation.
| options: | ||
| dependencies: | ||
| throttleEnabled: true | ||
| order: 4 |
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.
For readability I'd put these in the order they come in within the UI.
| }); | ||
|
|
||
| // Throttling configuration - read from conf | ||
| this.throttleEnabled = conf.throttle !== false; // Default true unless explicitly set to false |
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.
This behaviour is the opposite to the default value in edge.yaml.
| // Start throttled publishing loop | ||
| startThrottledPublish() { | ||
| if (this.publishTimer) { | ||
| clearInterval(this.publishTimer); | ||
| } | ||
|
|
||
| this.publishTimer = setInterval(() => { | ||
| if (this.latestState) { | ||
| this.handleData(this.latestState); | ||
| // Don't clear latestState - keep it for next interval in case no new data arrives | ||
| } | ||
| }, this.pollInt); | ||
|
|
||
| this.log( | ||
| `✅ Started throttled publishing at ${this.pollInt}ms interval (${( | ||
| 1000 / this.pollInt | ||
| ).toFixed(2)}Hz)` | ||
| ); | ||
| } | ||
|
|
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.
Was this implemented using setInterval() for a reason? I'd expect this logic to be a simple check against the last published timestamp within the callback for handling "data". i.e. when you check if throttling is enabled on receiving data from the downstream device, you check when it was last published and ignore if it's smaller than your interval. That way all the logic is in one place.
This pull request adds robust throttling support to the Universal Robots RTDE Edge driver, improves configuration options, and provides comprehensive documentation for all exposed RTDE data. The main changes include configurable throttling of data publishing, new configuration schema fields, removal of problematic timestamp fields, and the addition of a detailed data reference guide.
RTDE Driver Throttling and Data Handling:
RTDEHandlerinedge-rtde/lib/rtde.js, allowing data publishing intervals to be configured viathrottleandpollIntsettings. By default, throttling is enabled at 500ms (2Hz), but can be disabled for full-rate (~125Hz) publishing. [1] [2]startThrottledPublish) and logic to store and periodically publish the latest state when throttling is enabled.handleDatato always remove thetimestampfield fromrobotModeDatabefore publishing, preventing InfluxDB overflow errors.Configuration Schema Updates:
acs-service-setup/dumps/edge.yamlto add new fields:throttleEnabled(boolean) andpollInt(number, ms) for RTDE driver configuration, with improved field descriptions and option ordering. These settings control the new throttling feature.Documentation:
edge-rtde/docs/RTDE-DATA-REFERENCE.mdfile, providing a comprehensive reference of all available RTDE data, JSONPath access patterns, enumerated values, usage examples, and configuration instructions for throttling.These changes make the RTDE driver more flexible, user-friendly, and robust for integration with historian and analytics systems.