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
This PR adds a comprehensive TF2 electron demo that showcases coordinate frame transformations, turtle simulation, and real-time 3D visualization using rclnodejs, Electron, and Three.js. The demo replicates the functionality of the ROS2 `turtle_tf2_py` package in a modern web-based interface.
Key changes:
- Adds a complete electron demonstration with TF2 coordinate frame visualization
- Provides interactive turtle control with keyboard input (WASD keys)
- Implements multiple TF2 broadcasters (static, dynamic, fixed frames) with real-time updates
- Updates main README to highlight the new electron visualization capabilities
Fix: #1230, #1231
\* rclnodejs development and maintenance is limited to the ROS 2 LTS releases and the Rolling development branch
10
10
11
-
**rclnodejs** is a Node.js client library for the Robot Operating System
12
-
([ROS 2](https://www.ros.org/)). It provides tooling and comprehensive
13
-
JavaScript and TypeScript APIs for developing ROS 2 solutions capable of
14
-
interoperating with ROS 2 nodes implemented in other languages such as
15
-
C++ and Python.
16
-
17
-
Here's an example for creating a ROS 2 node that publishes a string message in a few lines of JavaScript.
11
+
**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.
Before installing `rclnodejs` please ensure the following software is installed and configured on your system:
49
-
50
-
-[Nodejs](https://nodejs.org/en/) version >= 16.13.0.
51
-
52
-
-[ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html) for details.
53
-
**DON'T FORGET TO [SOURCE THE ROS 2 SETUP FILE](https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files)**
40
+
-[Node.js](https://nodejs.org/en/) version >= 16.13.0
41
+
-[ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html) - **Don't forget to [source the setup file](https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files)**
54
42
55
-
### Installing rclnodejs
56
-
57
-
Install the rclnodejs version that is compatible with your version of ROS 2 (see table below).
-**Note:** to install rclnodejs from GitHub: add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
72
50
51
+
Try the [examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) to get started.
52
+
73
53
## rclnodejs-cli
74
54
75
55
[rclnodejs-cli](https://github.com/RobotWebTools/rclnodejs-cli/) is a companion project we recently launched to provide a commandline interface to a set of developer tools for working with this `rclnodejs`. You may find `rclnodejs-cli` particularly useful if you plan to create ROS 2 node(s) and launch files for working with multiple node orchestrations.
76
56
77
57
```
78
-
_ _ _
79
-
_ __ ___| |_ __ ___ __| | ___ (_)___
80
-
| '__/ __| | '_ \ / _ \ / _` |/ _ \| / __|
81
-
| | | (__| | | | | (_) | (_| | __/| \__ \
82
-
|_| \___|_|_| |_|\___/ \__,_|\___|/ |___/
83
-
|__/
84
58
Usage: rclnodejs [command] [options]
85
59
86
60
Options:
@@ -94,26 +68,31 @@ Commands:
94
68
95
69
## API Documentation
96
70
97
-
API documentation is generated by `jsdoc` and can be viewed in the `docs/` folder or [online doc](https://robotwebtools.github.io/rclnodejs/docs/index.html). To create a local copy of the documentation run`npm run docs`.
71
+
API documentation is available [online](https://robotwebtools.github.io/rclnodejs/docs/index.html) or generate locally with`npm run docs`.
98
72
99
-
## Using rclnodejs with TypeScript
73
+
## Electron-based Visualization
74
+
75
+
Create rich, interactive desktop applications using Electron and web technologies like Three.js. Build 3D visualizations, monitoring dashboards, and control interfaces that run on Windows, macOS, and Linux.
100
76
101
-
`rclnodejs` API can be used in TypeScript projects. You can find the TypeScript declaration files (\*.d.ts) in the `types/` folder.
77
+
Try the `electron_demo/turtle_tf2` demo for real-time coordinate frame visualization with dynamic transforms and keyboard-controlled turtle movement. More examples in [electron_demo](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo).
102
78
103
-
Your `tsconfig.json` file should include the following compiler options:
The benefits of using TypeScript become evident when working with more complex use-cases. ROS messages are defined in the `types/interfaces.d.ts` module. This module is updated as part of the `generate-ros-messages` process described in the next section.
107
+
See [TypeScript demos](https://github.com/RobotWebTools/rclnodejs/tree/develop/ts_demo) for more examples.
129
108
130
-
## ROS2 Interface Message Generation (important)
109
+
## ROS2 Interface Message Generation
131
110
132
-
ROS components communicate by sending and receiving messages described
133
-
by the interface definition language (IDL). ROS client libraries such as
134
-
rclnodejs are responsible for converting these IDL message descriptions
135
-
into source code of their target language. For this, rclnodejs provides
136
-
the npm binary`generate-ros-messages` script that reads the IDL
137
-
message files of a ROS environment and generates corresponding JavaScript
138
-
message interface files. Additionally, the tool generates the TypeScript
139
-
`interface.d.ts` file containing declarations for each IDL message file.
111
+
ROS client libraries convert IDL message descriptions into target language source code. rclnodejs provides the `generate-ros-messages` script to generate JavaScript message interface files and TypeScript declarations.
140
112
141
-
Learn more about ROS interfaces and IDL [here](https://docs.ros.org/en/jazzy/Concepts/Basic/About-Interfaces.html).
113
+
Example usage:
142
114
143
-
In the following example rclnodejs loads a generated JavaScript message file corresponding to the ROS `std_msgs/msg/String' definition.
144
-
145
-
```
115
+
```javascript
146
116
import*asrclnodejsfrom'rclnodejs';
147
117
let stringMsgObject =rclnodejs.createMessageObject('std_msgs/msg/String');
Generated files are located at `<yourproject>/node_modules/rclnodejs/generated/`.
168
130
169
131
### IDL Message Generation
170
132
171
133
In addition to the standard ROS2 message generation (`.msg`, `.srv`, and `.action`), rclnodejs provides advanced support for generating JavaScript message files directly from IDL (Interface Definition Language) files. This feature is particularly useful when working with custom IDL files or when you need more control over the message generation process.
172
134
173
-
#### Running `generate-messages-idl`
174
-
175
135
To generate messages from IDL files, use the `generate-messages-idl` npm script:
176
136
177
137
```bash
@@ -180,42 +140,9 @@ npm run generate-messages-idl
180
140
181
141
## Contributing
182
142
183
-
Please read the [Contributing Guide]() before making a pull request.
184
-
185
-
Thank you to all the [people](CONTRIBUTORS.md) who already contributed to rclnodejs!
0 commit comments