November 2018
Beginner
472 pages
13h 5m
English
We'll put this in a file called color_track_behavior.py. There's no surprise that we start with the imports. Because we are bringing together many elements, there are quite a few, but we have seen them all 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...
Now, we set up our Behavior class. We pass this the robot object, and also set up some tunable values for the object size and color:
...class ColorTrackingBehavior(object): """Behavior to find and get close to a colored object""" def __init__(self, robot): self.robot = robot # Tuning values self.low_range ...
Read now
Unlock full access