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
Copy file name to clipboardExpand all lines: README.md
+22-97Lines changed: 22 additions & 97 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,7 @@
8
8
9
9
\* 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.
18
12
19
13
```JavaScript
20
14
constrclnodejs=require('rclnodejs');
@@ -43,32 +37,18 @@ rclnodejs.init().then(() => {
43
37
44
38
### Prerequisites
45
39
46
-
Before installing `rclnodejs` please ensure the following software is installed and configured on your system:
47
-
48
-
-[Nodejs](https://nodejs.org/en/) version >= 16.13.0.
49
-
50
-
-[ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html) for details.
51
-
**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)**
52
-
53
-
### Installing rclnodejs
54
-
55
-
Install the rclnodejs version that is compatible with your version of ROS 2 (see table below).
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)**
-**Note:** to install rclnodejs from GitHub: add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
70
50
71
-
Please try with [examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example)once you're good to go.
51
+
Try the [examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) to get started.
72
52
73
53
## rclnodejs-cli
74
54
@@ -88,34 +68,31 @@ Commands:
88
68
89
69
## API Documentation
90
70
91
-
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`.
92
72
93
73
## Electron-based Visualization
94
74
95
-
rclnodejs enables the creation of rich, interactive desktop visualization applications using Electron and modern web technologies like Three.js. This approach combines the power of ROS 2 with cross-platform GUI capabilities, allowing developers to build sophisticated 3D visualizations, real-time monitoring dashboards, and interactive control interfaces that can run natively on Windows, macOS, and Linux.
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.
96
76
97
-
To see this in action, try the `electron_demo/turtle_tf2` demo which demonstrates real-time coordinate frame visualization with dynamic transform broadcasting, interactive 3D navigation, and keyboard-controlled turtle movement - providing a hands-on way to understand ROS 2 TF2 concepts through visual feedback. You can find more Electron-based examples and demos in the [electron_demo](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo) directory.
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).
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, see more [demos](https://github.com/RobotWebTools/rclnodejs/tree/develop/ts_demo).
131
-
132
-
## ROS2 Interface Message Generation (important)
107
+
See [TypeScript demos](https://github.com/RobotWebTools/rclnodejs/tree/develop/ts_demo) for more examples.
133
108
134
-
ROS components communicate by sending and receiving messages described
135
-
by the interface definition language (IDL). ROS client libraries such as
136
-
rclnodejs are responsible for converting these IDL message descriptions
137
-
into source code of their target language. For this, rclnodejs provides
138
-
the npm binary`generate-ros-messages` script that reads the IDL
139
-
message files of a ROS environment and generates corresponding JavaScript
140
-
message interface files. Additionally, the tool generates the TypeScript
141
-
`interface.d.ts` file containing declarations for each IDL message file.
109
+
## ROS2 Interface Message Generation
142
110
143
-
Learn more about ROS interfaces and IDL [here](https://docs.ros.org/en/jazzy/Concepts/Basic/About-Interfaces.html).
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.
144
112
145
-
In the following example rclnodejs loads a generated JavaScript message file corresponding to the ROS `std_msgs/msg/String' definition.
113
+
Example usage:
146
114
147
-
```
115
+
```javascript
148
116
import*asrclnodejsfrom'rclnodejs';
149
117
let stringMsgObject =rclnodejs.createMessageObject('std_msgs/msg/String');
Generated files are located at `<yourproject>/node_modules/rclnodejs/generated/`.
170
130
171
131
### IDL Message Generation
172
132
173
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.
174
134
175
-
#### Running `generate-messages-idl`
176
-
177
135
To generate messages from IDL files, use the `generate-messages-idl` npm script:
178
136
179
137
```bash
@@ -182,42 +140,9 @@ npm run generate-messages-idl
182
140
183
141
## Contributing
184
142
185
-
Please read the [Contributing Guide]() before making a pull request.
186
-
187
-
Thank you to all the [people](CONTRIBUTORS.md) who already contributed to rclnodejs!
0 commit comments