Skip to content

Commit 11dca98

Browse files
committed
Address comments
1 parent e30eedc commit 11dca98

File tree

1 file changed

+22
-97
lines changed

1 file changed

+22
-97
lines changed

README.md

Lines changed: 22 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
\* rclnodejs development and maintenance is limited to the ROS 2 LTS releases and the Rolling development branch
1010

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.
1812

1913
```JavaScript
2014
const rclnodejs = require('rclnodejs');
@@ -43,32 +37,18 @@ rclnodejs.init().then(() => {
4337

4438
### Prerequisites
4539

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)**
5642

57-
For the most current version of rclnodejs run:
43+
### Install rclnodejs
5844

5945
```bash
6046
npm i rclnodejs
6147
```
6248

63-
To install a specific version of rclnodejs use:
64-
65-
```bash
66-
67-
```
68-
6949
- **Note:** to install rclnodejs from GitHub: add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
7050

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.
7252

7353
## rclnodejs-cli
7454

@@ -88,34 +68,31 @@ Commands:
8868

8969
## API Documentation
9070

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`.
9272

9373
## Electron-based Visualization
9474

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.
9676

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).
9878

9979
![demo screenshot](./electron_demo/turtle_tf2/turtle-tf2-demo.png)
10080

10181
## Using rclnodejs with TypeScript
10282

103-
`rclnodejs` API can be used in TypeScript projects. You can find the TypeScript declaration files (\*.d.ts) in the `types/` folder.
104-
105-
Your `tsconfig.json` file should include the following compiler options:
83+
TypeScript declaration files are included in the `types/` folder. Configure your `tsconfig.json`:
10684

10785
```jsonc
10886
{
10987
"compilerOptions": {
11088
"module": "commonjs",
11189
"moduleResolution": "node",
11290
"target": "es2020",
113-
// your additional options here
11491
},
11592
}
11693
```
11794

118-
Here's a short `rclnodejs` TypeScript example:
95+
TypeScript example:
11996

12097
```typescript
12198
import * as rclnodejs from 'rclnodejs';
@@ -127,53 +104,34 @@ rclnodejs.init().then(() => {
127104
});
128105
```
129106

130-
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.
133108

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
142110

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.
144112

145-
In the following example rclnodejs loads a generated JavaScript message file corresponding to the ROS `std_msgs/msg/String' definition.
113+
Example usage:
146114

147-
```
115+
```javascript
148116
import * as rclnodejs from 'rclnodejs';
149117
let stringMsgObject = rclnodejs.createMessageObject('std_msgs/msg/String');
150118
stringMsgObject.data = 'hello world';
151119
```
152120

153-
### Maintaining Generated JavaScript Message Files
154-
155-
Message files are generated as a post-install step of the rclnodejs
156-
installation process. Thereafter, you will need to manually run the
157-
rclnodejs message generation script when new ROS message packages are installed
158-
for which your ROS2-nodejs project has a dependency.
159-
160-
### Running `generate-ros-messages` Utility
121+
### Running Message Generation
161122

162-
To run the `generate-ros-messages` script from your Nodejs package, use the `npx` utility included in your Nodejs installation.
123+
Run the message generation script when new ROS packages are installed:
163124

164-
```
125+
```bash
165126
npx generate-ros-messages
166127
```
167128

168-
The newly generated JavaScript files can be found at
169-
`<yourproject>/node_modules/rclnodejs/generated/`.
129+
Generated files are located at `<yourproject>/node_modules/rclnodejs/generated/`.
170130

171131
### IDL Message Generation
172132

173133
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.
174134

175-
#### Running `generate-messages-idl`
176-
177135
To generate messages from IDL files, use the `generate-messages-idl` npm script:
178136

179137
```bash
@@ -182,42 +140,9 @@ npm run generate-messages-idl
182140

183141
## Contributing
184142

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!
188-
189-
<div>
190-
<a href="https://github.com/wayneparrott">
191-
<img src="https://github.com/wayneparrott.png" width="30">
192-
</a>
193-
<a href="https://github.com/koonpeng">
194-
<img src="https://github.com/koonpeng.png" width="30">
195-
</a>
196-
<a href="https://github.com/mattrichard">
197-
<img src="https://github.com/mattrichard.png" width="30">
198-
</a>
199-
<a href="https://github.com/felixdivo">
200-
<img src="https://github.com/felixdivo.png" width="30">
201-
</a>
202-
<a href="https://github.com/martins-mozeiko">
203-
<img src="https://github.com/martins-mozeiko.png" width="30">
204-
</a>
205-
<a href="https://github.com/amikhalev">
206-
<img src="https://github.com/amikhalev.png" width="30">
207-
</a>
208-
<a href="https://github.com/kenny-y">
209-
<img src="https://github.com/kenny-y.png" width="30">
210-
</a>
211-
<a href="https://github.com/qiuzhong">
212-
<img src="https://github.com/qiuzhong.png" width="30">
213-
</a>
214-
<a href="https://github.com/minggangw">
215-
<img src="https://github.com/minggangw.png" width="30">
216-
</a>
217-
<a href="https://github.com/hanyia">
218-
<img src="https://github.com/hanyia.png" width="30">
219-
</a>
220-
</div>
143+
Please read the [Contributing Guide](./docs/CONTRIBUTING.md) before making a pull request.
144+
145+
Thanks to all [contributors](CONTRIBUTORS.md)!
221146

222147
## License
223148

0 commit comments

Comments
 (0)