Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit c8612de

Browse files
christophebedardMinggang Wang
authored andcommitted
Update and format README
Signed-off-by: Christophe Bedard <[email protected]>
1 parent dae5dae commit c8612de

File tree

1 file changed

+47
-55
lines changed

1 file changed

+47
-55
lines changed

README.md

Lines changed: 47 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
## Server Implementations of the rosbridge v2 Protocol
66

7-
ros2-web-bridge, which leverages the [rclnodejs](https://github.com/RobotWebTools/rclnodejs) client, provides a JSON interface to [ROS 2.0](https://github.com/ros2/ros2/wiki) by adopting the [rosbridge v2 protocol](https://github.com/RobotWebTools/rosbridge_suite/blob/develop/ROSBRIDGE_PROTOCOL.md). The bridge can process commands through JSON tuneled over WebSockets.
7+
ros2-web-bridge, which leverages the [rclnodejs](https://github.com/RobotWebTools/rclnodejs) client, provides a JSON interface to [ROS 2](https://index.ros.org/doc/ros2/) by adopting the [rosbridge v2 protocol](https://github.com/RobotWebTools/rosbridge_suite/blob/develop/ROSBRIDGE_PROTOCOL.md). The bridge can process commands through JSON tuneled over WebSockets.
88

9-
## ROS2 support
9+
## ROS 2 support
1010

1111
The ros2-web-bridge **SUPPORTS** the latest ROS 2 stable release by default (currently [Dashing Patch 2](https://github.com/ros2/ros2/releases/tag/release-dashing-20190806)), please visit the [relase channel](https://github.com/ros2/ros2/releases) to check out the information.
1212

@@ -20,47 +20,40 @@ A client is a program that communicates with ros2-web-bridge using its JSON API.
2020

2121
## Install
2222

23-
1.Prepare for ROS2
24-
25-
Please reference the [wiki](https://index.ros.org/doc/ros2/Installation/) to install ROS2.
26-
27-
2.Install `Node.js`
28-
You can install Node.js:
29-
30-
* Download from Node.js offical [website](https://nodejs.org/en/), and install it.
31-
* Use the Node Version Manager ([nvm](https://github.com/creationix/nvm)) to install it.
32-
33-
3.Install dependencies
34-
35-
```javascript
36-
npm install
37-
```
23+
1. Prepare for ROS 2
24+
Please reference the [documentation](https://index.ros.org/doc/ros2/Installation/) to install ROS 2.
25+
2. Install `Node.js`
26+
You can install Node.js:
27+
* Download from Node.js offical [website](https://nodejs.org/en/), and install it.
28+
* Use the Node Version Manager ([nvm](https://github.com/creationix/nvm)) to install it.
29+
3. Clone and install dependencies
30+
Note that a ROS 2 installation has to be sourced before installing dependencies.
31+
```bash
32+
$ git clone https://github.com/RobotWebTools/ros2-web-bridge.git
33+
$ cd ros2-web-bridge
34+
$ source /opt/ros/$DISTRO/setup.sh # or a source installation
35+
$ npm install
36+
```
3837

3938
## Run Examples
4039

41-
1.Start `ros2-web-bridge` module:
42-
43-
```bash
44-
node bin/rosbridge.js
45-
```
46-
47-
If you want to start in client mode (i.e. connecting the bridge to an existing websocket server), do this instead:
48-
49-
```bash
50-
node bin/rosbridge.js --address ws://<address>:<port>
51-
```
52-
53-
2.Start the [express](https://www.npmjs.com/package/express) server:
54-
55-
```bash
56-
cd examples && node index.js
57-
```
58-
59-
3.Open your browser, and navigate to URL:
60-
61-
``` bash
62-
http://localhost:3000/html/publisher.html
63-
```
40+
1. Make sure to source a ROS 2 installation, e.g.:
41+
```bash
42+
$ source /opt/ros/$DISTRO/setup.sh # or a source installation
43+
```
44+
2. Start `ros2-web-bridge` module:
45+
```bash
46+
$ node bin/rosbridge.js
47+
```
48+
If you want to start in client mode (i.e. connecting the bridge to an existing websocket server), do this instead:
49+
```bash
50+
$ node bin/rosbridge.js --address ws://<address>:<port>
51+
```
52+
3. Start the [express](https://www.npmjs.com/package/express) server:
53+
```bash
54+
$ cd examples && node index.js
55+
```
56+
4. Open your browser, and navigate to URL: http://localhost:3000/html/publisher.html
6457

6558
## Not supported `op`
6659

@@ -85,21 +78,20 @@ subscribe | The type of the topic is [optional](https://github.com/RobotWebTools
8578

8679
If you use [roslibjs](https://static.robotwebtools.org/roslibjs/current/roslib.js) as the client running in the browser, please reference the code snippet below:
8780

88-
* Subscribe a topic.
89-
90-
```JavaScript
91-
// Define a topic with its type.
92-
var example = new ROSLIB.Topic({
93-
ros : ros,
94-
name : '/example_topic',
95-
messageType : 'std_msgs/String'
96-
});
97-
98-
// Subscribe a topic.
99-
example.subscribe(function(message) {
100-
console.log(`Receive message: ${message}`);
101-
});
102-
```
81+
* Subscribe to a topic.
82+
```JavaScript
83+
// Define a topic with its type.
84+
var example = new ROSLIB.Topic({
85+
ros : ros,
86+
name : '/example_topic',
87+
messageType : 'std_msgs/String'
88+
});
89+
90+
// Subscribe to a topic.
91+
example.subscribe(function(message) {
92+
console.log(`Receive message: ${message}`);
93+
});
94+
```
10395

10496
## Contributing
10597

0 commit comments

Comments
 (0)