Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rscova authored May 17, 2018
1 parent b92a9cb commit 95417c7
Showing 1 changed file with 49 additions and 21 deletions.
70 changes: 49 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,67 @@ is connect two machines running a roscore each one.

### Setup instructions

Install mosquitto (MQTT): $ sudo apt-get install mosquitto mosquitto-clients

Install the paho library for Python: $ sudo pip install paho-mqtt

Install mosquitto (MQTT):
```
$ sudo apt-get install mosquitto mosquitto-clients
```
Install the paho library for Python:
```
$ sudo pip install paho-mqtt
```
Download this repo in your catkin workspace


**Check your MQTT instalation:**

Create a local broker: $ sudo service mosquitto start

Publish in a topic: $ mosquitto_pub -h [broker's IP] -t [your topic] -m "Hello MQTT!"
Example: $ mosquitto_pub -h 127.0.0.1 -t msgs -m "Hello MQTT!"

Subscribe to a topic: $ mosquitto_sub -h [broker's IP] -t [your topic]

For subscribe to all topics: $ mosquitto_sub -t '#'

Create a local broker:
```
$ sudo service mosquitto start
```
Publish in a topic:
```
$ mosquitto_pub -h [broker's IP] -t [your topic] -m "Hello MQTT!"
```
Example:
```
$ mosquitto_pub -h 127.0.0.1 -t msgs -m "Hello MQTT!"
```
Subscribe to a topic:

```
$ mosquitto_sub -h [broker's IP] -t [your topic]
```

For subscribe to all topics:
```
$ mosquitto_sub -t '#'
```

**How to use this Package:**

Compile the package: $cd ~/catkin_ws && catkin_make --only-pkg-with-deps lights_control
Compile the package:
```
$cd ~/catkin_ws && catkin_make --only-pkg-with-deps lights_control
```

In machine one (M1) run roscore and launch the light control node:
$ roslaunch ligths_control lights_control.launch node_name:=light_controller

```
$ roslaunch ligths_control lights_control.launch node_name:=light_controller
```
You can see the topic /ligth_status

In other terminal of M1 run: $ rosrun lights_control mqtt_publisher.py

In M2 run roscore: $ roscore

Still in M2 run in other terminal: raspy_controller.py
In other terminal of M1 run:
```
$ rosrun lights_control mqtt_publisher.py
```
In M2 run roscore:
```
$ roscore
```
Still in M2 run in other terminal:
```
raspy_controller.py
```

**Useful information:**

Expand Down

0 comments on commit 95417c7

Please sign in to comment.