10-28-2021, 01:11 PM
(This post was last modified: 10-30-2021, 05:21 PM by Romaxx.
Edit Reason: update
)
Edit:
It does not work in the sense you proposed.
I was experimenting a little bit, but line 28 and line 38 do not work.
My Code is:
The error is:
And is it possible to get higher frequency than 400 Hz? The implemented Sensor BMI260 should be possible to sample up to 1600 Hz. Is this restricted from the phone?
Thanks
It does not work in the sense you proposed.
I was experimenting a little bit, but line 28 and line 38 do not work.
My Code 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"]
PP_CHANNELS_def_x = ["accX=full"]
PP_CHANNELS_def_y = ["accY=full"] #If using different CC channels, define multiple phyphox buffers
PP_CHANNELS_def_z = ["accZ=full"] #If using different CC channels, define multiple phyphox buffers
else:
PP_CHANNELS_def = ["acc_time=" + str(time_update)]
PP_CHANNELS_def_x = ["acc_time=" + str(time_update), "accX=" + str(time_update) + "|acc_time"] #If using different CC channels, define multiple phyphox buffers
PP_CHANNELS_def_y = ["accY=" + str(time_update)] #If using different CC channels, define multiple phyphox buffers
PP_CHANNELS_def_z = ["accZ=" + str(time_update)] #If using different CC channels, define multiple phyphox buffers
url = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS_def))
url_x = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS_def_x))
url_y = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS_def_y))
url_z = PP_ADDRESS + "/get?" + ("&".join(PP_CHANNELS_def_z))
data = requests.get(url=url).json()
data_x = requests.get(url=url_x).json()
data_y = requests.get(url=url_y).json()
data_z = requests.get(url=url_z).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_x["buffer"]["accX"]["buffer"])
value_y = numpy.array(data_y["buffer"]["accY"]["buffer"])
value_z = numpy.array(data_z["buffer"]["accZ"]["buffer"])
# values_all = numpy.transpose(numpy.vstack((value_x,value_y,value_z,time_value,numpy.hstack((numpy.mean(1/(time_value[1:-1]-time_value[0:-2])),1/(time_value[1:]-time_value[0:-1]))))))
# print("Sending" + ", values " + str(values_all))
The error is:
Code:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roman/Phyphox/phyphox2.py", line 38, in <module>
data_x = requests.get(url=url_x).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'))
And is it possible to get higher frequency than 400 Hz? The implemented Sensor BMI260 should be possible to sample up to 1600 Hz. Is this restricted from the phone?
Thanks