Skip to content

Commit 4587541

Browse files
committed
Update docs and tutorials (#1416)
Updates documentation/tutorials to align with current rclnodejs tooling, API signatures, and supported ROS/Node.js versions. **Changes:** - Update Type Description Service tutorial to reflect ROS 2 Jazzy+ availability and matching version checks. - Fix content-filtering tutorial example to store the subscription on the class instance for later updates. - Refresh docs for message generation command, lifecycle context usage, and build prerequisites (Node.js + Python on Windows). Fix: #1415
1 parent 6ac175f commit 4587541

6 files changed

Lines changed: 18 additions & 22 deletions

File tree

docs/BUILDING.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
1.Install ROS 2 from binary package.
66

7-
ROS 2 is a cross-platform system, which covers Linux, macOS and Windows, and the `rclnodejs` module is developed against the [`master`](https://github.com/ros2/ros2/blob/master/ros2.repos) branch of ROS 2. You can download the latest binary packages from [ROS 2 build farm](http://ci.ros2.org/view/packaging/) and follow the instructions of [Linux](https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debians.html)/[Windows](https://docs.ros.org/en/rolling/Installation/Windows-Install-Binary.html) to setup the environment (If you want to run your apps on a stable release of ROS 2, e.g. crystal-clemmys, please see the section `Running on Stable Release of ROS 2).
7+
ROS 2 is a cross-platform system, which covers Linux, macOS and Windows, and the `rclnodejs` module is developed against the [`master`](https://github.com/ros2/ros2/blob/master/ros2.repos) branch of ROS 2. You can download the latest binary packages from [ROS 2 build farm](http://ci.ros2.org/view/packaging/) and follow the instructions of [Linux](https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debians.html)/[Windows](https://docs.ros.org/en/rolling/Installation/Windows-Install-Binary.html) to setup the environment. Supported ROS 2 distributions: Rolling, Kilted, Jazzy, and Humble.
88

99
2.Build ROS 2 from scratch.
1010

@@ -13,7 +13,7 @@ Alternatively, you can build ROS 2 from scratch. Please select the platform you
1313
### Install `Node.js`
1414

1515
**Notice:**
16-
`rclnodejs` should only be used with node versions between 10.23.1 - 19.x. The lowest LTS Node.js we used to verify the unit tests is `10.23.1`.
16+
`rclnodejs` requires Node.js version >= 16.13.0.
1717

1818
I install Nodejs from either:
1919

@@ -56,11 +56,7 @@ This `Node.js` module is built by [node-gyp](https://www.npmjs.com/package/node-
5656
npm install
5757
```
5858

59-
**Windows-specific**: make sure Python 2.x interpreter is first searched in your `PATH` before running the command. You can change it temporarily by:
60-
61-
```bash
62-
set PATH=<path\to\python 2.x>;%PATH%
63-
```
59+
**Windows-specific**: make sure a Python 3.x interpreter is available in your `PATH` before running the command, as required by [node-gyp](https://github.com/nodejs/node-gyp#on-windows).
6460

6561
## Run Unit Tests
6662

docs/EFFICIENCY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let enableLifecycleCommInterface = false;
2424
let node = new LifecycleNode(
2525
nodeName,
2626
namespace,
27-
Context.defaultContext,
27+
Context.defaultContext(),
2828
NodeOptions.defaultOptions,
2929
enableLifecycleCommInterface
3030
);

docs/FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ ros2 pkg list
2020

2121
If the package containing your target message is not listed then install it.
2222

23-
Next, inspect the generated JavaScript message files by viewing the `./node_modules/rclnodejs/generated/` folder of your project for your target message. If you are unable to locate the message file then use the `generate-messages` script:
23+
Next, inspect the generated JavaScript message files by viewing the `./node_modules/rclnodejs/generated/` folder of your project for your target message. If you are unable to locate the message file then use the `generate-ros-messages` script:
2424

2525
```
26-
<your_project>/node_modules/.bin/generate-messages
26+
<your_project>/node_modules/.bin/generate-ros-messages
2727
```
2828

2929
## Maximum call stack size exceeded error when running in Jest

tutorials/actionlib.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Defines the request parameters for the task to be performed.
3535
```javascript
3636
// Example: Fibonacci.Goal
3737
{
38-
order: 10 // Compute Fibonacci sequence up to order 10
38+
order: 10; // Compute Fibonacci sequence up to order 10
3939
}
4040
```
4141

@@ -46,7 +46,7 @@ Provides periodic updates during task execution.
4646
```javascript
4747
// Example: Fibonacci.Feedback
4848
{
49-
sequence: [0, 1, 1, 2, 3, 5, 8] // Current progress
49+
sequence: [0, 1, 1, 2, 3, 5, 8]; // Current progress
5050
}
5151
```
5252

@@ -57,7 +57,7 @@ Contains the final outcome when the task completes.
5757
```javascript
5858
// Example: Fibonacci.Result
5959
{
60-
sequence: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] // Final result
60+
sequence: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; // Final result
6161
}
6262
```
6363

@@ -147,7 +147,7 @@ class FibonacciActionServer {
147147
}
148148

149149
// Called when new goal is received
150-
goalCallback(goalHandle) {
150+
goalCallback(goal) {
151151
this._node.getLogger().info('Received goal request');
152152
// Accept or reject the goal
153153
return rclnodejs.GoalResponse.ACCEPT; // or REJECT
@@ -307,19 +307,19 @@ class MultiGoalActionServer {
307307
);
308308
}
309309

310-
goalCallback(goalHandle) {
310+
goalCallback(goal) {
311311
// Accept up to 3 concurrent goals
312312
if (this._activeGoals.size >= 3) {
313313
this._node.getLogger().info('Too many active goals, rejecting');
314314
return rclnodejs.GoalResponse.REJECT;
315315
}
316316

317-
this._node.getLogger().info(`Accepting goal ${goalHandle.goalId}`);
318-
this._activeGoals.set(goalHandle.goalId, goalHandle);
317+
this._node.getLogger().info(`Accepting goal with order=${goal.order}`);
319318
return rclnodejs.GoalResponse.ACCEPT;
320319
}
321320

322321
async executeCallback(goalHandle) {
322+
this._activeGoals.set(goalHandle.goalId, goalHandle);
323323
try {
324324
// Execute goal logic...
325325
const result = await this.computeFibonacci(goalHandle);

tutorials/content-filtering-subscription.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class SensorDataProcessor {
261261
parameters: [0.1, 5.0, 0.1], // Valid range and FOV
262262
};
263263

264-
const subscription = this.node.createSubscription(
264+
this.subscription = this.node.createSubscription(
265265
'sensor_msgs/msg/Range',
266266
'sensor_data',
267267
options,

tutorials/type-description-service.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ Each node automatically creates a service at:
3939

4040
The Type Description Service is available in:
4141

42-
- **ROS 2 Iron** and newer distributions (officially supported starting from Iron)
42+
- **ROS 2 Jazzy** and newer distributions (officially supported starting from Jazzy)
4343
- **rclnodejs** with compatible ROS 2 installation
4444

45-
**Note**: Type Description Service is **not available** in ROS 2 Humble and earlier versions.
45+
**Note**: Type Description Service is **not available** in ROS 2 Iron and earlier versions.
4646

4747
```javascript
4848
const rclnodejs = require('rclnodejs');
4949
const DistroUtils = require('rclnodejs/lib/distro');
5050

5151
// Check if Type Description Service is supported
52-
if (DistroUtils.getDistroId() > DistroUtils.getDistroId('humble')) {
52+
if (DistroUtils.getDistroId() >= DistroUtils.getDistroId('jazzy')) {
5353
console.log('Type Description Service is supported');
5454
} else {
5555
console.warn(
@@ -288,7 +288,7 @@ const DistroUtils = require('rclnodejs/lib/distro');
288288

289289
async function testTypeDescriptionService() {
290290
// Check if Type Description Service is supported
291-
if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {
291+
if (DistroUtils.getDistroId() < DistroUtils.getDistroId('jazzy')) {
292292
console.log(
293293
'Type Description Service is not supported in this ROS 2 version'
294294
);

0 commit comments

Comments
 (0)