SunFounder PiCrawler Kit
(continued from previous page)
while True:
if Vilib.detect_obj_parameter['color_n']!=0 and Vilib.detect_obj_
˓→parameter['color_w']>100:
tts.say("will done")
sleep(0.05)
renew_color_detect()
with lock:
if key != None and key in ('wsad'):
action = key_dict[str(key)]
key = None
elif key == 'space':
tts.say("Look for " + color)
key = None
elif key == 'quit':
_key_t.join()
Vilib.camera_close()
print("\n\rQuit")
break
if action != None:
crawler.do_action(action,1,speed)
action = None
sleep(0.05)
if __name__ == "__main__":
main()
How it works?
In general, this project combines the knowledge points of Keyboard Control, Computer Vision and Sound Effect.
Its flow is shown in the figure below:
66 Chapter 3. Play with Python