I want to stream what the picam capture while i control the GoPiGo with “w” “a” “s” “d” as the script provided “basic_test_all.py”.
In order to the streaming video i wrote this little code and it works:
import all the libraries needed h=200 w=300 camera = PiCamera() camera.resolution(w,h) camera.framerate = 5 rawCapture = PiRGBArray(camera, size(w,h)) time.sleep(0.1) from frame in camera.capture_continuous (rawCapture, format"bgr", use_video_port=True): image_RGB = frame.array cv2.imshow("Image", image_RGB) key = cv2.waitKey(1) & 0xFF rawCapture.truncate(0) if key == ord("q"): break
With this code, where and how would you put the:
while True: print "nCmd:", a = raw_input() if a=='w': fwd() elif a=='a': left() elif a=='d': right() elif a=='s': bwd() elif a=='x': stop()
in order to work at the same time?
Thanks a bunch again!