The code for face tracking

The code for this behavior will seem very familiar—it started as a copy of the previous behavior, and was adapted for this present purpose. It's possible that refactoring could yield more common code, but it is currently simpler to work with a copy for now. This code will go into the face_track_behavior.py file. I've not even created a new template, as the color track template will work just fine for this. The imports are the same as before:

import timefrom image_app_core import start_server_process, get_control_instruction, put_output_imageimport cv2import numpy as npimport pi_camera_streamfrom pid_controller import PIControllerfrom robot import Robot...

The init function for our class is slightly different, and ...

Get Learn Robotics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.