Skip to content

Commit b720aae

Browse files
committed
Update readme
Added detailed use steps in ros2 Added precautions for remote use
1 parent 9e6d34a commit b720aae

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,40 @@ Simple Demonstration of Vue + ROS Integration
1616

1717
## Prerequisite
1818
Make sure to run the following commands in the terminal
19+
### ROS1
1920
```console
2021
roslaunch rosbridge_server rosbridge_websocket.launch
2122
rostopic pub /listener std_msgs/String "Hello, World"
2223
rosrun rospy_tutorials add_two_ints_server
2324
```
2425

26+
### ROS2
27+
```bash
28+
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
29+
ros2 run demo_nodes_py add_two_ints_server
30+
ros2 run demo_nodes_py talker
31+
```
32+
If you do not have `rosbridge_server` you need to install it with the following command
33+
```bash
34+
apt search rosbridge_suite
35+
sudo apt install -y ros-<rosdistro>-rosbridge-suite # ros-humble-rosbridge-suite
36+
```
37+
After starting the `node` you can find the `topic/service` and its type with the following instructions.Then you need to modify the `allowedMessageType/serviceType` in file `TopicSubscriber.vue/ServiceClient.vue` to receive the message.
38+
```console
39+
$ ros2 service list
40+
/add_two_ints
41+
$ ros2 service type /add_two_ints
42+
example_interfaces/srv/AddTwoInts
43+
```
44+
```console
45+
$ ros2 topic list
46+
/chatter
47+
$ ros2 topic info /chatter
48+
Type: std_msgs/msg/String
49+
Publisher count: 1
50+
Subscription count: 0
51+
```
52+
2553
## Installation
2654
```console
2755
npm install
@@ -87,3 +115,13 @@ vue-ros-demo@0.1.0 /home/ravi/vue-ros-demo
87115
├── roslib@1.3.0
88116
└── vue@3.2.37
89117
```
118+
119+
In case of having multiple PC (more specifically, rosbridge_server running on a remote machine), you must use the correct IP address. The localhost and 127.0.0.1 refer to the same device. So your node can not connect to rosbridge_server.
120+
121+
You can change the following ip addresses, in `main.js`
122+
```js
123+
app.config.globalProperties.ros = new ROSLIB.Ros({
124+
url: 'ws://localhost:9090/'
125+
})
126+
```
127+
reference: [https://github.com/ravijo/vue-ros-demo/issues/1](https://github.com/ravijo/vue-ros-demo/issues/1)

0 commit comments

Comments
 (0)