I’m encountering this error when running a python script on a raspberry pi 5, and it instantly aborts the process without even printing a stacktrace or something. The weirdest thing is it happens at seemingly random intervals, not when is request the ccc blocks. I couldn’t find any examples of others encountering this problem, what could be causing this?
The pixy-relevant portion of the script (basically just detetcting whenever the robot sees a red or a green object):
import pixy
pixy.init()
…
def getColor(attempts:int=5)->int:
i=0
rt=-1
while rt==-1 and i<attempts:
blocks=pixy.BlockArray(1)
n=pixy.ccc_get_blocks(100,blocks)
log("detected %s blocks"%n,INFO)
for i in range(n):
b:pixy.Block=blocks[i]
log("detected at %s %s, size %s %s with signature: %s"%(b.m_x,b.m_y,b.m_width,b.m_height,b.m_signature),INFO)
if n>1:
beep_parallel()
log("multiple blocks detected!",WARNING)
if n==0:
beep_parallel()
log("no blocks detected!",WARNING)
rt=-1
else:
b1:pixy.Block=blocks[0]
rt= GREEN if b1.m_signature==1 else RED
i+=1
sleep(0.1)
if rt==-1:
log("did not find object!",ERROR)
rt=GREEN
log("Detected final color %s"%("GREEN" if rt==GREEN else "RED"),INFO)
return rt
I tried to provide the right context, but if something else is needed let me know!
Thanks,
Csaba