Using the Roboflowoak module, how does one extract the y value from the predictions and use it in the Python script? An example of this syntax would be helpful, thanks!
I found that the Oak camera works more reliably when supplied with power via the barrel plug. The Raspberry Pi must not always supply enough via USB.
Hi, within the comments of the script, the y-value in predictions is accessible by: using [p.json()['y'] for p in predictions] after predictions is set to results[‘predictions’] within the while-loop.
ted@raspberrypi:~ $ python3 /home/ted/Herbie_Bot/Herbie_ai2.py
/home/ted/Herbie_Bot/Herbie_ai2.py:14: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(17, GPIO.OUT)
/home/ted/.local/lib/python3.9/site-packages/roboflowoak/pipe.py:105: RuntimeWarning: divide by zero encountered in true_divide
return 441.25 * 7.5 / disparity
Traceback (most recent call last):
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[1] in predictions]
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[1] in predictions]
NameError: name ‘p’ is not defined
ted@raspberrypi:~ $ python3 /home/ted/Herbie_Bot/Herbie_ai2.py
/home/ted/Herbie_Bot/Herbie_ai2.py:14: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(17, GPIO.OUT)
/home/ted/.local/lib/python3.9/site-packages/roboflowoak/pipe.py:105: RuntimeWarning: divide by zero encountered in true_divide
return 441.25 * 7.5 / disparity
Traceback (most recent call last):
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = ([p.json() for p[1] in predictions])
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = ([p.json() for p[1] in predictions])
NameError: name ‘p’ is not defined
ted@raspberrypi:~ $ python3 /home/ted/Herbie_Bot/Herbie_ai2.py
/home/ted/Herbie_Bot/Herbie_ai2.py:14: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(17, GPIO.OUT)
/home/ted/.local/lib/python3.9/site-packages/roboflowoak/pipe.py:105: RuntimeWarning: divide by zero encountered in true_divide
return 441.25 * 7.5 / disparity
Traceback (most recent call last):
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[y] in predictions]
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[y] in predictions]
NameError: name ‘p’ is not defined
ted@raspberrypi:~ $ python3 /home/ted/Herbie_Bot/Herbie_ai2.py
/home/ted/Herbie_Bot/Herbie_ai2.py:14: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(17, GPIO.OUT)
/home/ted/.local/lib/python3.9/site-packages/roboflowoak/pipe.py:105: RuntimeWarning: divide by zero encountered in true_divide
return 441.25 * 7.5 / disparity
Traceback (most recent call last):
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[‘y’] in predictions]
File “/home/ted/Herbie_Bot/Herbie_ai2.py”, line 54, in
aim = [p.json() for p[‘y’] in predictions]
NameError: name ‘p’ is not defined