Closed redchillipadi closed 1 year ago
The current implementation of this is using a Rpi4B with an Ultrasonic distance finder to mimic an input sensor (as the ones Adrian is working on)
Below is the output on the subscriber side showing the messages we will receive.
This is the testing setup showing how each distance is recorded and from there analysed.
For now this is the process of determining which state (position) the user is in.
av.append(dist)
if len(av) > 10:
check = np.mean(av)
if check > 10 and check < 20 and state != "crossbar":
print("send mqtt - crossbar")
publish.single("PositionCheck", "Crossbar", hostname="test.mosquitto.org")
state = "crossbar"
elif check < 10 and state != "sitting":
print("send mqtt - sitting")
publish.single("PositionCheck", "Sitting", hostname="test.mosquitto.org")
state = "sitting"
elif check > 20 and state != "standing":
print("send mqtt - standing")
publish.single("PositionCheck", "Standing", hostname="test.mosquitto.org")
state = "standing"
av.pop(0)
32 This is the code for the first revision of MQTT pub/sub working