November 2018
Beginner
472 pages
13h 5m
English
The next part we will need is the behavior. This will not be that complex and use code seen before in the visual processing chapters, with a small bit of additional code in the control message area. I'll put this in manual_drive.py, starting with the imports we've seen for visual processing:
import timefrom robot import Robotfrom image_app_core import start_server_process, get_control_instruction, put_output_imageimport pi_camera_stream...
We'll make a ManualDriveBehavior class. In this, we'll store a robot object, and keep track of timeouts. The timeout will stop the robot if there are no more control messages:
...class ManualDriveBehavior(object): def __init__(self, robot): self.robot = robot self.timeout = time.time() ...
Read now
Unlock full access