Commit bf41b27
committed
Add QoS overriding options for publishers and subscriptions (#1468)
Allow QoS policies to be overridden at deployment time via ROS parameters, without changing source code. When `qosOverridingOptions` is passed to `createPublisher()` or `createSubscription()`, the node declares read-only parameters (e.g. `qos_overrides./chatter.subscription.depth`) whose values can be set at startup. Ported from rclpy's `QoSOverridingOptions` (rclpy/qos_overriding_options.py).
Usage with rclnodejs:
```bash
node my_app.js --ros-args -p "qos_overrides./chatter.subscription.depth:=1"
node my_app.js --ros-args --params-file qos.yaml
```
The `--ros-args` are received via `process.argv`, processed by `rclnodejs.init()`, and applied when `declareParameter()` finds matching overrides in `_parameterOverrides`.
**New: `lib/qos_overriding_options.js`** — `QoSPolicyKind` enum (HISTORY, DEPTH, RELIABILITY, DURABILITY, LIVELINESS, AVOID_ROS_NAMESPACE_CONVENTIONS), `QoSOverridingOptions` class with `withDefaultPolicies()` factory, `declareQosParameters()` engine that declares parameters per whitelisted policy and applies overrides to the QoS profile in-place, and enum↔string conversion helpers. Includes `_resolveQoS()` to convert string profile names to mutable QoS objects.
**Modified: `lib/node.js`** — `_createPublisher()` and `createSubscription()` check for `options.qosOverridingOptions`, resolve QoS profile strings, and call `declareQosParameters()` before creating the entity.
**Modified: `index.js`** — Exports `QoSPolicyKind` and `QoSOverridingOptions`.
**New: `test/test-qos-overriding-options.js`** — 11 tests: enum values, factory method, custom policies with entityId, publisher/subscription parameter declaration and value verification, entity ID suffix in parameter names, validation callback accept/reject, string QoS resolution, no-override baseline, and end-to-end parameter override proving the QoS object is mutated in-place.
Fix: #14671 parent be0483f commit bf41b27
7 files changed
Lines changed: 794 additions & 0 deletions
File tree
- lib
- test
- types
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
261 | 271 | | |
262 | 272 | | |
263 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
705 | 709 | | |
706 | 710 | | |
707 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
708 | 716 | | |
709 | 717 | | |
710 | 718 | | |
| |||
752 | 760 | | |
753 | 761 | | |
754 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
755 | 778 | | |
756 | 779 | | |
757 | 780 | | |
| |||
795 | 818 | | |
796 | 819 | | |
797 | 820 | | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
798 | 825 | | |
799 | 826 | | |
800 | 827 | | |
| |||
848 | 875 | | |
849 | 876 | | |
850 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
851 | 893 | | |
852 | 894 | | |
853 | 895 | | |
| |||
0 commit comments