You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A typed Web SDK guide for `rclnodejs/web`, two end-to-end browser demos (zero-build JavaScript + Vite TypeScript), and the surrounding doc / terminology / packaging cleanup.
## What's new
- **`web/README.md`** *(new)* — single source of truth for the browser SDK: server runtime, three-verb client (`call` / `publish` / `subscribe`), `connect()` URL shapes, lifecycle, `curl`-able HTTP transport, and a `rclnodejs/web` vs. `rosbridge` + `roslibjs` table.
- **`demo/web/javascript/`** *(new)* — zero-build demo: `node runtime.js` + `node static.js`, no `npm install`, no bundler.
- **`demo/web/typescript/`** *(new)* — Vite + tsx demo with the typed three-verb client; `npm run server` wraps tsx with `NODE_OPTIONS=--no-deprecation` to silence Node's `DEP0205` noise.
- **`bin/rclnodejs-web.js`** — CLI tightened: repeatable `--call/--publish/--subscribe` flags, `web.json` mode, friendlier startup banner.
- **`README.md`**, **`scripts/npmjs-readme.md`**, **`tutorials/README.md`** — repositioned around three browser stories (`rclnodejs/web`, `rosocket`, none-of-the-above) and link the new SDK guide.
- **`rosocket/README.md`** + **`demo/rosocket/README.md`** — recast as the **lighter sibling**; cross-link to the SDK guide for the rosbridge comparison.
- **Runtime touch-ups** (`lib/runtime/dispatcher.js`, `lib/runtime/transports/ws.js`, `lib/message_serialization.js`, `rosocket/index.js`, `test/test-rosocket.js`) — comment / wording only, no behaviour change.
Fix: #1510
Copy file name to clipboardExpand all lines: README.md
+65-80Lines changed: 65 additions & 80 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
14
14
**rclnodejs** is a Node.js client library for [ROS 2](https://www.ros.org/) that provides comprehensive JavaScript and TypeScript APIs for developing ROS 2 solutions.
15
15
16
-
**Key features:** Topics, Services, Actions, Parameters, Lifecycle Nodes, TypeScript support, RxJS Observables, Electron integration, browser ↔ ROS 2 WebSocket bridge (rosocket), and prebuilt binaries for Linux x64/arm64.
16
+
**Key features:** Topics, Services, Actions, Parameters, Lifecycle Nodes, TypeScript support, RxJS Observables, Electron integration, ROS 2 in the browser (typed Web SDK + thin WebSocket gateway — `rclnodejs/web`, `rosocket`), and prebuilt binaries for Linux x64/arm64.
17
17
18
18
```javascript
19
19
constrclnodejs=require('rclnodejs');
@@ -30,11 +30,11 @@ This example assumes your ROS 2 environment is already sourced.
[ROS 2 in the browser](#ros-2-in-the-browser), [Observable Subscriptions](#observable-subscriptions), [Electron-based Visualization](#electron-based-visualization)
38
38
- Project docs:
39
39
[Efficient Usage Tips](./docs/EFFICIENCY.md), [FAQ and Known Issues](./docs/FAQ.md), [Building from Scratch](./docs/BUILDING.md), [Contributing](./docs/CONTRIBUTING.md)
> **Docker:** For containerized development, see the included [Dockerfile](./Dockerfile) for building and testing with different ROS distributions and Node.js versions.
75
75
76
-
See the [features](./docs/FEATURES.md) and try the [examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) to get started.
77
-
78
76
### Prebuilt Binaries
79
77
80
78
rclnodejs ships with prebuilt native binaries for common Linux configurations, so most installs skip compilation.
More runnable examples in [example/](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) and step-by-step guides in [tutorials/](./tutorials/).
114
112
113
+
## ROS 2 in the browser
114
+
115
+
`rclnodejs` ships **two** ways to reach ROS 2 from the browser — pick one based on
rclnodejs supports [RxJS](https://rxjs.dev/) Observable subscriptions for reactive programming with ROS 2 messages. Use operators like `throttleTime()`, `debounceTime()`, `map()`, and `combineLatest()` to build declarative message processing pipelines.
See the [Observable Subscriptions Tutorial](./tutorials/observable-subscriptions.md) for more details.
164
+
165
+
## Electron-based Visualization
166
+
167
+
Build desktop ROS 2 apps with Electron + Three.js, packaged for Windows/macOS/Linux via **Electron Forge**. Featured demo: 🦾 **[manipulator](./demo/electron/manipulator)** — a two-joint arm with manual/automatic control. More in [demo/electron](./demo/electron/).
168
+
115
169
## ROS 2 Interface Message Generation
116
170
117
171
rclnodejs auto-generates JavaScript bindings and TypeScript declarations for every ROS 2 `.msg`, `.srv`, and `.action` interface available in your sourced ROS 2 environment. This happens during `npm install`, so in most projects you do not need to run anything by hand.
@@ -136,13 +190,7 @@ Generated files are written to `<your-project>/node_modules/rclnodejs/generated/
136
190
137
191
### IDL Message Generation
138
192
139
-
In addition to the standard ROS 2 message generation (`.msg`, `.srv`, `.action`), rclnodejs can also generate JavaScript message files directly from IDL (Interface Definition Language) files. This is useful for custom IDL files or when you need finer control over the generation process.
140
-
141
-
To generate messages from IDL files:
142
-
143
-
```bash
144
-
npm run generate-messages-idl
145
-
```
193
+
For custom `.idl` files (Interface Definition Language), this repo also exposes `npm run generate-messages-idl`. See [docs/BUILDING.md](./docs/BUILDING.md) for when you'd need it.
146
194
147
195
## Using rclnodejs with TypeScript
148
196
@@ -160,73 +208,10 @@ TypeScript declaration files are included in the package and exposed through the
160
208
161
209
Then `import * as rclnodejs from 'rclnodejs'` works the same as the JavaScript example at the top of this README. See [TypeScript demos](https://github.com/RobotWebTools/rclnodejs/tree/develop/demo/typescript) for more.
162
210
163
-
## rosocket — Browser ↔ ROS 2 bridge
164
-
165
-
> A tiny WebSocket gateway to ROS 2 — built into `rclnodejs`. _New in `2.0.0-beta.0`._
166
-
167
-
**rosocket** exposes ROS 2 topics/services as plain WebSocket URLs — a
168
-
**lightweight** alternative to the rosbridge + roslibjs stack. Zero browser
169
-
code, one Node.js process; browsers use only built-in `WebSocket` + `JSON`,
See [rosocket/README.md](./rosocket/README.md) for the URL scheme, service calls, and the programmatic `startRosocket()` API.
183
-
184
-
## Observable Subscriptions
185
-
186
-
rclnodejs supports [RxJS](https://rxjs.dev/) Observable subscriptions for reactive programming with ROS 2 messages. Use operators like `throttleTime()`, `debounceTime()`, `map()`, and `combineLatest()` to build declarative message processing pipelines.
See the [Observable Subscriptions Tutorial](./tutorials/observable-subscriptions.md) for more details.
204
-
205
-
## Electron-based Visualization
206
-
207
-
Build interactive desktop ROS 2 apps with Electron + Three.js, packaged for Windows/macOS/Linux via **Electron Forge**. Featured demo: 🦾 **[manipulator](./demo/electron/manipulator)** — a two-joint arm with manual/automatic control.
See [benchmark/README.md](./benchmark/README.md) for the full setup and methodology.
226
-
227
-
## rclnodejs-cli
211
+
## More
228
212
229
-
[rclnodejs-cli](https://github.com/RobotWebTools/rclnodejs-cli/) is a companion project providing command-line tooling for scaffolding rclnodejs application skeletons and working with launch files for multi-node orchestration.
213
+
-**Performance** — faster than `rclpy` and competitive with `rclcpp` for both topic and service round-trips. Full benchmarks in [benchmark/README.md](./benchmark/README.md).
214
+
-**Companion CLI** — [`rclnodejs-cli`](https://github.com/RobotWebTools/rclnodejs-cli/) scaffolds rclnodejs application skeletons and orchestrates launch files for multi-node setups.
0 commit comments