舵机转动后摄像头帧率会掉到很低,怎么办?
-
import sensor, image, time from pyb import Servo pan_servo=Servo(1)# P7 sensor.reset() sensor.set_contrast(1) sensor.set_gainceiling(16) sensor.set_framesize(sensor.HQVGA) sensor.set_pixformat(sensor.GRAYSCALE) clock = time.clock() while (True): clock.tick() for i in range(-45,45): pan_servo.angle(i) time.sleep(20) print('servo.angle():',pan_servo.angle()) for i in range(45,-45,-1): pan_servo.angle(i) time.sleep(20) print('servo.angle():',pan_servo.angle()) print('fps:',clock.fps())
帧率掉到0.278,有什么办法提高帧率到10以上吗?
-
你的代码里有time.sleep,所以帧率低。
解决办法:删除time.sleep