Skip to content

Commit

Permalink
Merge pull request #8 from hsidd1/develop/localhost
Browse files Browse the repository at this point in the history
Develop/localhost: Transfer rate speed significantly increased for receiver and processing. tampering is no longer a concern
  • Loading branch information
hsidd1 authored Aug 1, 2023
2 parents b8d45e0 + 476d0ee commit 01fae9a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Configuration for this project's key parameters are in [config.yaml](config.yaml

## Usage

### Local Host Broker Setup

This program requires a very rapid subscribe and publish rate which all tested web-based brokers could not accomplish. The workaround here is running on localhost server.

- Install Eclipse Mosquitto: https://mosquitto.org/download/
- Open terminal as administrator:
```bash
cd <path-to-mosquitto>
net start mosquitto # run broker
```
- Ensure config for `broker` is set to localhost: `"127.0.0.1"`

### Publishing, Receiving and Processing

Execute main receiver to automatically subscribe to topics and run client programs as subprocesses in parallel
```bash
# publish and subscribe
Expand All @@ -54,3 +68,9 @@ python cam_client.py
# run radar client
python radar_client.py
```
Disconnect broker when completed:
```bash
# open as administrator
cd <path-to-mosquitto>
net stop mosquitto
```
2 changes: 1 addition & 1 deletion cam_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def publish(client):
print(f"{CLIENT_ID}: Send `{timestamp}` to topic `{topic}`\n")
else:
print(f"{CLIENT_ID}: Failed to send timestamp message to topic {topic}")
time.sleep(0.5)
time.sleep(0.033)
i+=1

cap = cv2.VideoCapture(config["Files"]["video_file"])
Expand Down
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mqtt:
broker: "broker.emqx.io"
broker: "127.0.0.1" # alt web broker: "broker.emqx.io"
port: 1883
client_id1: "Radar"
client_id2: "Camera"
Expand All @@ -11,5 +11,5 @@ Files:
CameraOutput:
fps: 1 # fps for image output step size
frame_start: 50 # which frame to start program at
frame_skip: 3 # show every nth frame
frame_skip: 1 # show every nth frame
continuous_frame_mode: True # if True, will update display frames automatically, else waits for user key input

0 comments on commit 01fae9a

Please sign in to comment.