From bca6c1b7e1c4831f42cd54d3c56ef4613c9ec69b Mon Sep 17 00:00:00 2001 From: Minggang Wang Date: Mon, 21 Jul 2025 17:40:53 +0800 Subject: [PATCH 1/2] Correct the index.js to be required for example/ --- example/actions/action_client/action-client-cancel-example.js | 2 +- example/actions/action_client/action-client-example.js | 3 +-- example/actions/action_server/action-server-defer-example.js | 2 +- example/actions/action_server/action-server-example.js | 2 +- .../actions/action_server/action-server-single-goal-example.js | 2 +- example/graph/ros-graph-example.js | 2 +- example/lifecycle/lifecycle-node-example.js | 2 +- example/parameter/parameter-declaration-example.js | 2 +- example/parameter/parameter-override-example.js | 2 +- example/rate/rate-example.js | 2 +- example/rosidl/rosidl-parse-action-example.js | 3 +-- example/rosidl/rosidl-parse-msg-example.js | 2 +- example/rosidl/rosidl-parse-srv-example.js | 2 +- example/services/client/client-example.js | 2 +- example/services/service/service-example.js | 2 +- example/timer/timer-example.js | 2 +- example/topics/publisher/publisher-content-filter-example.js | 2 +- example/topics/publisher/publisher-example.js | 2 +- example/topics/publisher/publisher-message-example.js | 2 +- example/topics/publisher/publisher-multiarray-example.js | 2 +- example/topics/publisher/publisher-qos-example.js | 2 +- example/topics/publisher/publisher-raw-message.js | 2 +- .../topics/subscriber/subscription-content-filter-example.js | 3 +-- example/topics/subscriber/subscription-example.js | 2 +- example/topics/subscriber/subscription-message-example.js | 2 +- example/topics/subscriber/subscription-multiarray-example.js | 2 +- example/topics/subscriber/subscription-qos-example.js | 2 +- example/topics/subscriber/subscription-raw-message.js | 2 +- .../topics/subscriber/subscription-service-event-example.js | 2 +- example/topics/validator/validator-example.js | 2 +- 30 files changed, 30 insertions(+), 33 deletions(-) diff --git a/example/actions/action_client/action-client-cancel-example.js b/example/actions/action_client/action-client-cancel-example.js index 2d68aa85..cce42f60 100644 --- a/example/actions/action_client/action-client-cancel-example.js +++ b/example/actions/action_client/action-client-cancel-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const Fibonacci = rclnodejs.require('test_msgs/action/Fibonacci'); class FibonacciActionClient { diff --git a/example/actions/action_client/action-client-example.js b/example/actions/action_client/action-client-example.js index 88170659..27c0e83b 100644 --- a/example/actions/action_client/action-client-example.js +++ b/example/actions/action_client/action-client-example.js @@ -14,9 +14,8 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const Fibonacci = rclnodejs.require('test_msgs/action/Fibonacci'); -const GoalStatus = rclnodejs.require('action_msgs/msg/GoalStatus'); class FibonacciActionClient { constructor(node) { diff --git a/example/actions/action_server/action-server-defer-example.js b/example/actions/action_server/action-server-defer-example.js index 31a85709..23bdeb36 100644 --- a/example/actions/action_server/action-server-defer-example.js +++ b/example/actions/action_server/action-server-defer-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const Fibonacci = rclnodejs.require('test_msgs/action/Fibonacci'); class FibonacciActionServer { diff --git a/example/actions/action_server/action-server-example.js b/example/actions/action_server/action-server-example.js index 51f24f9b..e61c9886 100644 --- a/example/actions/action_server/action-server-example.js +++ b/example/actions/action_server/action-server-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const Fibonacci = rclnodejs.require('test_msgs/action/Fibonacci'); class FibonacciActionServer { diff --git a/example/actions/action_server/action-server-single-goal-example.js b/example/actions/action_server/action-server-single-goal-example.js index b14b6106..ab993baa 100644 --- a/example/actions/action_server/action-server-single-goal-example.js +++ b/example/actions/action_server/action-server-single-goal-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const Fibonacci = rclnodejs.require('test_msgs/action/Fibonacci'); class FibonacciActionServer { diff --git a/example/graph/ros-graph-example.js b/example/graph/ros-graph-example.js index ae8a3209..9039b86a 100644 --- a/example/graph/ros-graph-example.js +++ b/example/graph/ros-graph-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); console.log( 'This example creates the following nodes and outputs the corresponding ROS2 graph:' diff --git a/example/lifecycle/lifecycle-node-example.js b/example/lifecycle/lifecycle-node-example.js index a19c46de..905895be 100644 --- a/example/lifecycle/lifecycle-node-example.js +++ b/example/lifecycle/lifecycle-node-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); const NODE_NAME = 'test_node'; const TOPIC = 'test'; diff --git a/example/parameter/parameter-declaration-example.js b/example/parameter/parameter-declaration-example.js index b8e72d13..d2ef5efd 100644 --- a/example/parameter/parameter-declaration-example.js +++ b/example/parameter/parameter-declaration-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); const ParameterType = rclnodejs.ParameterType; const Parameter = rclnodejs.Parameter; diff --git a/example/parameter/parameter-override-example.js b/example/parameter/parameter-override-example.js index a93185ad..e3f76897 100644 --- a/example/parameter/parameter-override-example.js +++ b/example/parameter/parameter-override-example.js @@ -10,7 +10,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); const ParameterType = rclnodejs.ParameterType; const Parameter = rclnodejs.Parameter; diff --git a/example/rate/rate-example.js b/example/rate/rate-example.js index 4b857408..527f6ec5 100644 --- a/example/rate/rate-example.js +++ b/example/rate/rate-example.js @@ -12,7 +12,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); /** * This example demonstrates a rate limited loop running at diff --git a/example/rosidl/rosidl-parse-action-example.js b/example/rosidl/rosidl-parse-action-example.js index 90ec3d2f..74a15f5f 100644 --- a/example/rosidl/rosidl-parse-action-example.js +++ b/example/rosidl/rosidl-parse-action-example.js @@ -12,8 +12,7 @@ 'use strict'; -const parser = require('../rosidl_parser/rosidl_parser.js'); - +s; const rosInstallPath = process.env.AMENT_PREFIX_PATH; const packageName = 'test_msgs'; const packagePath = rosInstallPath + '/share/test_msgs/action/Fibonacci.action'; diff --git a/example/rosidl/rosidl-parse-msg-example.js b/example/rosidl/rosidl-parse-msg-example.js index 36871480..1d01ceba 100644 --- a/example/rosidl/rosidl-parse-msg-example.js +++ b/example/rosidl/rosidl-parse-msg-example.js @@ -14,7 +14,7 @@ 'use strict'; -const parser = require('../rosidl_parser/rosidl_parser.js'); +const parser = require('../../rosidl_parser/rosidl_parser.js'); const rosInstallPath = process.env.AMENT_PREFIX_PATH; const packageName = 'std_msgs'; diff --git a/example/rosidl/rosidl-parse-srv-example.js b/example/rosidl/rosidl-parse-srv-example.js index 5694d112..44b72cb8 100644 --- a/example/rosidl/rosidl-parse-srv-example.js +++ b/example/rosidl/rosidl-parse-srv-example.js @@ -14,7 +14,7 @@ 'use strict'; -const parser = require('../rosidl_parser/rosidl_parser.js'); +const parser = require('../../rosidl_parser/rosidl_parser.js'); const rosInstallPath = process.env.AMENT_PREFIX_PATH; const packageName = 'std_srvs'; diff --git a/example/services/client/client-example.js b/example/services/client/client-example.js index 8e149af2..ccd606e4 100644 --- a/example/services/client/client-example.js +++ b/example/services/client/client-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); async function main() { await rclnodejs.init(); diff --git a/example/services/service/service-example.js b/example/services/service/service-example.js index 2f379fae..9ac2c1b8 100644 --- a/example/services/service/service-example.js +++ b/example/services/service/service-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/timer/timer-example.js b/example/timer/timer-example.js index 606ab07b..0f03ac3e 100644 --- a/example/timer/timer-example.js +++ b/example/timer/timer-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../index.js'); rclnodejs .init() diff --git a/example/topics/publisher/publisher-content-filter-example.js b/example/topics/publisher/publisher-content-filter-example.js index 8c75608c..d759189a 100644 --- a/example/topics/publisher/publisher-content-filter-example.js +++ b/example/topics/publisher/publisher-content-filter-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); async function main() { await rclnodejs.init(); diff --git a/example/topics/publisher/publisher-example.js b/example/topics/publisher/publisher-example.js index ce479133..0d7f3535 100644 --- a/example/topics/publisher/publisher-example.js +++ b/example/topics/publisher/publisher-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs.init().then(() => { const node = rclnodejs.createNode('publisher_example_node'); diff --git a/example/topics/publisher/publisher-message-example.js b/example/topics/publisher/publisher-message-example.js index e81147ca..8036b237 100644 --- a/example/topics/publisher/publisher-message-example.js +++ b/example/topics/publisher/publisher-message-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/topics/publisher/publisher-multiarray-example.js b/example/topics/publisher/publisher-multiarray-example.js index 65c738e9..b1d4f100 100644 --- a/example/topics/publisher/publisher-multiarray-example.js +++ b/example/topics/publisher/publisher-multiarray-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/topics/publisher/publisher-qos-example.js b/example/topics/publisher/publisher-qos-example.js index 08619c8c..2db4141a 100644 --- a/example/topics/publisher/publisher-qos-example.js +++ b/example/topics/publisher/publisher-qos-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const { QoS } = rclnodejs; rclnodejs.init().then(() => { diff --git a/example/topics/publisher/publisher-raw-message.js b/example/topics/publisher/publisher-raw-message.js index 3b53d133..aac8df9d 100644 --- a/example/topics/publisher/publisher-raw-message.js +++ b/example/topics/publisher/publisher-raw-message.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/topics/subscriber/subscription-content-filter-example.js b/example/topics/subscriber/subscription-content-filter-example.js index 8303091b..24250f85 100644 --- a/example/topics/subscriber/subscription-content-filter-example.js +++ b/example/topics/subscriber/subscription-content-filter-example.js @@ -14,8 +14,7 @@ 'use strict'; -const { assertDefined } = require('dtslint/bin/util.js'); -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); /** * This example demonstrates the use of content-filtering diff --git a/example/topics/subscriber/subscription-example.js b/example/topics/subscriber/subscription-example.js index 9734f52b..2785b392 100644 --- a/example/topics/subscriber/subscription-example.js +++ b/example/topics/subscriber/subscription-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs.init().then(() => { const node = rclnodejs.createNode('subscription_example_node'); diff --git a/example/topics/subscriber/subscription-message-example.js b/example/topics/subscriber/subscription-message-example.js index 9b557c74..aaf62e19 100644 --- a/example/topics/subscriber/subscription-message-example.js +++ b/example/topics/subscriber/subscription-message-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/topics/subscriber/subscription-multiarray-example.js b/example/topics/subscriber/subscription-multiarray-example.js index 596bb59c..ceefb7b5 100644 --- a/example/topics/subscriber/subscription-multiarray-example.js +++ b/example/topics/subscriber/subscription-multiarray-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs .init() diff --git a/example/topics/subscriber/subscription-qos-example.js b/example/topics/subscriber/subscription-qos-example.js index 3e493724..dee83715 100644 --- a/example/topics/subscriber/subscription-qos-example.js +++ b/example/topics/subscriber/subscription-qos-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const { QoS } = rclnodejs; rclnodejs.init().then(() => { diff --git a/example/topics/subscriber/subscription-raw-message.js b/example/topics/subscriber/subscription-raw-message.js index 4f6c3468..711c0de4 100644 --- a/example/topics/subscriber/subscription-raw-message.js +++ b/example/topics/subscriber/subscription-raw-message.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); rclnodejs.init().then(() => { const node = rclnodejs.createNode('subscription_message_example_node'); diff --git a/example/topics/subscriber/subscription-service-event-example.js b/example/topics/subscriber/subscription-service-event-example.js index 90adff27..91757fb4 100644 --- a/example/topics/subscriber/subscription-service-event-example.js +++ b/example/topics/subscriber/subscription-service-event-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); async function main() { await rclnodejs.init(); diff --git a/example/topics/validator/validator-example.js b/example/topics/validator/validator-example.js index fbaddeed..06b97a45 100644 --- a/example/topics/validator/validator-example.js +++ b/example/topics/validator/validator-example.js @@ -14,7 +14,7 @@ 'use strict'; -const rclnodejs = require('../index.js'); +const rclnodejs = require('../../../index.js'); const { validator } = rclnodejs; console.log( From a14ab6a07a6f4a6ade2442852f44d5ba5db31e4f Mon Sep 17 00:00:00 2001 From: Minggang Wang Date: Mon, 21 Jul 2025 17:47:09 +0800 Subject: [PATCH 2/2] Address comments --- example/rosidl/rosidl-parse-action-example.js | 1 - 1 file changed, 1 deletion(-) diff --git a/example/rosidl/rosidl-parse-action-example.js b/example/rosidl/rosidl-parse-action-example.js index 74a15f5f..39662452 100644 --- a/example/rosidl/rosidl-parse-action-example.js +++ b/example/rosidl/rosidl-parse-action-example.js @@ -12,7 +12,6 @@ 'use strict'; -s; const rosInstallPath = process.env.AMENT_PREFIX_PATH; const packageName = 'test_msgs'; const packagePath = rosInstallPath + '/share/test_msgs/action/Fibonacci.action';