Skip to content

Commit bf8e893

Browse files
authored
[Doc] Clarify README install and quick start guidance (#1453)
- separate npm installation from repo checkout quick start - make ROS 2 environment sourcing explicit in prerequisites and examples - add direct GitHub install instructions - clarify that GitHub installs usually build from source - limit prebuilt binary claims to the published npm package - improve docs and message-generation wording - align npmjs README with the updated package-consumer guidance Fix: #1452
1 parent 6e46c4e commit bf8e893

2 files changed

Lines changed: 65 additions & 19 deletions

File tree

README.md

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,66 @@ rclnodejs.init().then(() => {
2020
});
2121
```
2222

23+
This example assumes your ROS 2 environment is already sourced.
24+
2325
## Documentation
2426

2527
- Get started:
2628
[Installation](#installation), [Quick Start](#quick-start), [Tutorials](./tutorials/)
2729
- Reference:
28-
[API Documentation](#api-documentation), [Using TypeScript](#using-rclnodejs-with-typescript), [ROS2 Interface Message Generation](#ros2-interface-message-generation)
30+
[API Documentation](#api-documentation), [Using TypeScript](#using-rclnodejs-with-typescript), [ROS 2 Interface Message Generation](#ros-2-interface-message-generation)
2931
- Features and examples:
3032
[rclnodejs-cli](#rclnodejs-cli), [Electron-based Visualization](#electron-based-visualization), [Observable Subscriptions](#observable-subscriptions), [Performance Benchmarks](#performance-benchmarks)
3133
- Project docs:
3234
[Efficient Usage Tips](./docs/EFFICIENCY.md), [FAQ and Known Issues](./docs/FAQ.md), [Building from Scratch](./docs/BUILDING.md), [Contributing](./docs/CONTRIBUTING.md)
3335

3436
## Installation
3537

38+
Choose the path that matches how you plan to use rclnodejs:
39+
40+
- Install from npm: add rclnodejs to your own application.
41+
- Quick Start: run the examples from this repository checkout.
42+
3643
### Prerequisites
3744

3845
- [Node.js](https://nodejs.org/en/) version >= 16.13.0
39-
- [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)**
46+
- [ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html)
4047

41-
### Install rclnodejs
48+
Before installing, building, or running rclnodejs, source your ROS 2 environment:
49+
50+
```bash
51+
source /opt/ros/<distro>/setup.bash
52+
```
53+
54+
### Install from npm
55+
56+
Use this path if you want to depend on rclnodejs from your own ROS 2 Node.js application.
4257

4358
```bash
4459
npm i rclnodejs
4560
```
4661

47-
> **Note:** To install rclnodejs from GitHub: add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
62+
After installation, use the example at the top of this README as a minimal publisher, or continue with [Quick Start](#quick-start) to run the examples in this repository.
63+
64+
### Install from GitHub
65+
66+
Use this path only if you need a branch or commit that is not yet published to npm.
67+
68+
GitHub installs normally build from source. The published npm package includes prebuilt binaries for supported Linux targets, but this repository does not track those prebuilt artifacts.
69+
70+
```bash
71+
npm install RobotWebTools/rclnodejs#<branch>
72+
```
73+
74+
Or add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
4875

4976
> **Docker:** For containerized development, see the included [Dockerfile](./Dockerfile) for building and testing with different ROS distributions and Node.js versions.
5077
5178
See the [features](./docs/FEATURES.md) and try the [examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) to get started.
5279

5380
### Prebuilt Binaries
5481

55-
rclnodejs ships with prebuilt native binaries for common Linux configurations since `v1.5.2`, eliminating the need for compilation during installation. This significantly speeds up installation and reduces dependencies.
82+
rclnodejs ships with prebuilt native binaries for common Linux configurations since `v1.5.2`, eliminating the need for compilation during installation. This applies to supported Linux environments when installing the published npm package.
5683

5784
**Supported Platforms:**
5885

@@ -74,25 +101,27 @@ npm install rclnodejs
74101

75102
## Quick Start
76103

77-
1. Source your ROS 2 environment.
104+
Use these steps if you are working from this repository checkout and want to run one of the included examples.
78105

79-
```bash
80-
source /opt/ros/<distro>/setup.bash
81-
```
106+
These steps assume the [installation prerequisites](#prerequisites) are already satisfied and your ROS 2 environment has been sourced.
82107

83-
2. Install the repository dependencies.
108+
1. Install the repository dependencies from the project root.
84109

85110
```bash
86111
npm install
87112
```
88113

89-
3. Run a publisher example from this checkout.
114+
2. Run a publisher example from this checkout.
90115

91116
```bash
92117
node example/topics/publisher/publisher-example.js
93118
```
94119

95-
You should see messages being published once per second. Explore more runnable examples in [example/](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) and step-by-step guides in [tutorials/](./tutorials/).
120+
You should see messages being published once per second.
121+
122+
If you want to build an application instead of running the repository examples, install rclnodejs into your own project with [Install from npm](#install-from-npm) and start from the sample code near the top of this README.
123+
124+
Explore more runnable examples in [example/](https://github.com/RobotWebTools/rclnodejs/tree/develop/example) and step-by-step guides in [tutorials/](./tutorials/).
96125

97126
## rclnodejs-cli
98127

@@ -102,7 +131,7 @@ See the rclnodejs-cli repository for installation instructions and the current c
102131

103132
## API Documentation
104133

105-
API documentation is available [online](https://robotwebtools.github.io/rclnodejs/docs/index.html) or generate locally with `npm run docs`.
134+
API documentation is available [online](https://robotwebtools.github.io/rclnodejs/docs/index.html). To generate it locally from this repository checkout, run `npm run docs`.
106135

107136
## Electron-based Visualization
108137

@@ -164,7 +193,7 @@ obsSub.observable
164193

165194
See the [Observable Subscriptions Tutorial](./tutorials/observable-subscriptions.md) for more details.
166195

167-
## ROS2 Interface Message Generation
196+
## ROS 2 Interface Message Generation
168197

169198
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.
170199

@@ -178,7 +207,7 @@ stringMsgObject.data = 'hello world';
178207

179208
### Running Message Generation
180209

181-
Run the message generation script when new ROS packages are installed:
210+
Run the message generation script in your project when new ROS packages are installed:
182211

183212
```bash
184213
npx generate-ros-messages

scripts/npmjs-readme.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,38 @@ rclnodejs.init().then(() => {
1414
});
1515
```
1616

17+
This example assumes your ROS 2 environment is already sourced.
18+
1719
## Installation
1820

1921
### Prerequisites
2022

2123
- [Node.js](https://nodejs.org/en/) version >= 16.13.0
22-
- [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)**
24+
- [ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html)
25+
26+
Before installing or running rclnodejs, source your ROS 2 environment:
27+
28+
```bash
29+
source /opt/ros/<distro>/setup.bash
30+
```
2331

2432
### Install rclnodejs
2533

2634
```bash
2735
npm i rclnodejs
2836
```
2937

30-
- **Note:** To install rclnodejs from GitHub, add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependencies.
38+
To install from GitHub instead of npm, run:
39+
40+
```bash
41+
npm install RobotWebTools/rclnodejs#<branch>
42+
```
43+
44+
Or add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependencies.
3145

3246
### Prebuilt Binaries
3347

34-
rclnodejs ships with prebuilt native binaries for common Linux configurations since `v1.5.2`, eliminating the need for compilation during installation.
48+
rclnodejs ships with prebuilt native binaries for common Linux configurations since `v1.5.2`, eliminating the need for compilation during installation. This applies to supported Linux environments when installing the published npm package.
3549

3650
**Supported Platforms:**
3751

@@ -52,21 +66,24 @@ npm install rclnodejs
5266
## Documentation and Examples
5367

5468
- API documentation: [robotwebtools.github.io/rclnodejs/docs](https://robotwebtools.github.io/rclnodejs/docs/index.html)
69+
- Tutorials: [tutorials/](https://github.com/RobotWebTools/rclnodejs/tree/develop/tutorials)
5570
- JavaScript examples: [example/](https://github.com/RobotWebTools/rclnodejs/tree/develop/example)
5671
- TypeScript demos: [ts_demo/](https://github.com/RobotWebTools/rclnodejs/tree/develop/ts_demo)
5772
- Electron demos: [electron_demo/](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo)
5873
- Companion CLI: [rclnodejs-cli](https://github.com/RobotWebTools/rclnodejs-cli/)
5974

6075
## Message Generation
6176

62-
rclnodejs generates JavaScript message interfaces and TypeScript declarations during installation for `rclnodejs > 1.5.0`. If you install additional ROS packages later, rerun:
77+
rclnodejs generates JavaScript message interfaces and TypeScript declarations during installation for `rclnodejs > 1.5.0`. If you install additional ROS packages later, rerun the generator in your project:
6378

6479
```bash
6580
npx generate-ros-messages
6681
```
6782

6883
Generated files are written to `<your-project>/node_modules/rclnodejs/generated/`.
6984

85+
This step is only needed after adding ROS packages that were not present when rclnodejs was installed.
86+
7087
## Using rclnodejs with TypeScript
7188

7289
TypeScript declaration files are included in the package. In most projects, configuring your `tsconfig.json` is sufficient:

0 commit comments

Comments
 (0)