Open
Description
from pitop import (
Camera,
UltrasonicSensor,
)
from time import sleep
camera = Camera(resolution=(640, 480))
ultrasonic = UltrasonicSensor("D3")
while True:
print(f"Distance: {ultrasonic.distance}")
sleep(0.1)
If the camera instantiation is commented out, the program runs normally and distance readings make sense.
With the camera, the following problems occur:
- The first call to
ultrasonic.distance
hangs for 8-10 seconds. This hanging also happens sporadically throughout subsequent calls too. - The readings returned are unstable and do not represent the actual distance at all. For example, the distance returned with the hand at around 0.1m away from the sensor is 0.6m - the returned readings seem to span 0.6-1.0m regardless of the true distance.
Pin Factory Test: Problem occurs whether using the default pin factory or if using NativeFactory() as we did previously - so I don't think this is caused by a382aa5
htop screenshot whilst program running:
Metadata
Metadata
Assignees
Labels
No labels