11-04-2021, 05:40 PM
(This post was last modified: 11-04-2021, 06:10 PM by Romaxx.
Edit Reason: Update
)
(11-03-2021, 11:18 AM)Jens Noritzsch Wrote: Hm, we are talking about smartphone sensors, aren't we? There is a difference between the capabilities of built-in sensors and that what the API provides us. The rates in https://phyphox.org/sensordb/ are upper limits and I could not find anything (common) avove 500 Hz…
Thanks, yes, I found this site a few days ago, and the limit seems to be 500Hz overall. Yes, we are talking about smartphone sensors. But the BMI260 from Bosch seems to be capable of 1600 Hz. So perhaps this is somehow restricted by Android or Apple. Did you know about https://developer.android.com/reference/...ectChannel ?
Your code porposal is still not working for me. I have espesially problems with the "...|acc_time..." connection, so the "or" I think.
The Code I tried is:
Code:
#MIDI configuration
M_OUTPUT = "Midi Through:Midi Through Port-0 14:0"
M_CHANNEL = 0
M_CONTROLS = [1, 2, 3, 4] #You can send on different CC channels
# M_CONTROLS = [70]
#phyphox configuration
PP_ADDRESS = "http://192.168.178.29:8080"
PP_CHANNELS = ["accX", "accY", "accZ", "acc_time"] #If using different CC channels, define multiple phyphox buffers
# PP_CHANNELS = ["accY"]
import requests
import time
import numpy
value_temp = 0
time_update = 0
count = 0
while True:
if count == 0:
PP_CHANNELS_def = ["acc_time=full","accX=full","accY=full","accZ=full"]
else:
PP_CHANNELS_def = ["acc_time=" + str(time_update), "accX=" + str(time_update) + "|acc_time","accY=" + str(time_update) + "|acc_time","accZ=" + str(time_update) + "|acc_time"] #If using different CC channels, define multiple phyphox buffers
url = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS_def))
data = requests.get(url=url).json()
time.sleep(0.04)
count = count + 1
time_update = count * 0.04;
# Uncomment to send pitch bend
time_value = numpy.array(data["buffer"]["acc_time"]["buffer"])
value_x = numpy.array(data["buffer"]["accX"]["buffer"])
value_y = numpy.array(data["buffer"]["accY"]["buffer"])
value_z = numpy.array(data["buffer"]["accZ"]["buffer"])
The error is:
Code:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roman/ownCloud/Documents/Phyphox/phyphox2.py", line 39, in <module>
data = requests.get(url=url).json()
File "/home/roman/anaconda3/envs/phyphox/lib/python3.9/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/home/roman/anaconda3/envs/phyphox/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/roman/anaconda3/envs/phyphox/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/roman/anaconda3/envs/phyphox/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/roman/anaconda3/envs/phyphox/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Thanks again.