From 5250cfe8ea6ec646ec9aec0df763f0bade98698b Mon Sep 17 00:00:00 2001 From: hsidd1 Date: Tue, 1 Aug 2023 02:03:47 -0400 Subject: [PATCH 1/3] cofngiuration for perfect playback --- cam_client.py | 2 +- config.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cam_client.py b/cam_client.py index 6e26653..419b3c2 100644 --- a/cam_client.py +++ b/cam_client.py @@ -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"]) diff --git a/config.yaml b/config.yaml index 114c539..83f763d 100644 --- a/config.yaml +++ b/config.yaml @@ -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" @@ -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 From 35c5f48ae149b8d055af2815c7f4c242b10590c2 Mon Sep 17 00:00:00 2001 From: hsidd1 Date: Tue, 1 Aug 2023 02:15:14 -0400 Subject: [PATCH 2/3] localhost instructions --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92e629b..18dd99c 100644 --- a/README.md +++ b/README.md @@ -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 +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 @@ -53,4 +67,4 @@ To run publishing clients individually: python cam_client.py # run radar client python radar_client.py -``` +``` \ No newline at end of file From 476d0ee4b84bc8bd49a32bf2afe730df0e9df4ae Mon Sep 17 00:00:00 2001 From: hsidd1 Date: Tue, 1 Aug 2023 02:24:23 -0400 Subject: [PATCH 3/3] localhost instructions --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18dd99c..4e3617f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This program requires a very rapid subscribe and publish rate which all tested w - Install Eclipse Mosquitto: https://mosquitto.org/download/ - Open terminal as administrator: ```bash -cd +cd net start mosquitto # run broker ``` - Ensure config for `broker` is set to localhost: `"127.0.0.1"` @@ -67,4 +67,10 @@ To run publishing clients individually: python cam_client.py # run radar client python radar_client.py +``` +Disconnect broker when completed: +```bash +# open as administrator +cd +net stop mosquitto ``` \ No newline at end of file