Setting up Raspberry Pi
As it is my first time using raspberry pi and the servos, it took some time for me to to get the camera for pycharm cv2 to work. I enabled the camera in the command prompt and could get the camera working via the command prompt and module picamera, however errors (especially relations to gstreamer) popped up when using cv2.
Turns out it was an index error in the cv2.VideoCapture and just had to change it to (-1). I decided to make use of the Wekinator as well to control the output as we would most likely using it for our final project as well. The range is controlled from 0-1, angle degree 0-180, and is further adjusted using the def scaleBetween.
Changing the script (to Wekinator) with reference to RM3 to detect the face as well as changing the def filter_handle (from Wekinator) to allow float output. Initially only sending point 29/30 (which is in the middle of the face) to Wekinator but ended up going back to sending all the points as it worked better.
Due to Wekinator being unstable, the motor ended up jittering quite a bit at it’s place. But this reminded me of a rabbit sniffing and looking for food. Hence I created a small bunny mascot with moldable plastic.
Video Demo with Wekinator