phyphox Forums
PHYPHOX TO - Printable Version

+- phyphox Forums (https://phyphox.org/forums)
+-- Forum: Discussion (https://phyphox.org/forums/forumdisplay.php?fid=1)
+--- Forum: General (https://phyphox.org/forums/forumdisplay.php?fid=3)
+--- Thread: PHYPHOX TO (/showthread.php?tid=1854)



PHYPHOX TO - Hydro1e - 01-21-2024

Hello, I am currently working on a personal project. However, I need to send the data collected by phyphox to Python. I modeled the following program based on the depth sensor (lidar) category, but in the Python console, it gets stuck at d=0.2m. I want to obtain the real-time distance from my phone to the object in Python. THANK YOU! Here's my code (PS: I'm hiding my IP):

PP_ADDRESS = "XXXXXXX"
PP_CHANNELS = ["d"]

import requests
import time

while True:
    try:
        url = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS))
        data = requests.get(url=url).json() 
        for i, control in enumerate(PP_CHANNELS):
            value = data["buffer"][PP_CHANNELS[i]]["buffer"][0]
            print("Channel " + str(control) + " = " + str(value))
    except Exception as e:
        print("An error occurred:", e)
    time.sleep(1)


RE: PHYPHOX TO - Jens Noriʇzsɔɥ - 01-21-2024

You need to fetch “x” (depth in meter) or “xmm” (depth in millimeter). The container “d” is the width of the LOESS fit in the settings tab.

You can find such details in the experiment's source at https://github.com/phyphox/phyphox-experiments/blob/master/depth.phyphox