def __init__(self, *args, **kwargs): # Create camera and start stream self.cam = cam.CameraStream().start() # Create user interface self.userinterface = gui.UserInterface(self) # Add RUN function to button 1 to start Scan self.start_page = self.userinterface.frames[ self.userinterface.StartPage] self.start_page.add_function_to_button1(self.run) self.shot_frame = [[] for x in range(200)] # Create Stepper and add function to button 4 self.stepper = step.Stepper("/dev/ttyACM0") self.start_page.add_function_to_button4(self.stepper.moveBack) self.stepper_set = 0 self.start_page.add_function_to_button2(self.stepper.moveStep) # Create image processor self.img_proc = ImageProcessor()
# Get args. args = docopt(__doc__) # Check the mode: recording vs TF driving vs TF driving + recording. if args['record']: we_are_autonomous = False we_are_recording = True print("\n------ Ready to record training data ------\n") elif args['tf']: we_are_autonomous = True we_are_recording = True print("\n****** READY TO DRIVE BY NEURAL NET and record data ******\n") # Set up camera and key watcher. camera_stream = camera.CameraStream(src=config.camera_id).start() last_key = [''] key_watcher.KeyWatcher(last_key).start() # Setup buffers and vars used by arduinos. buffer_in = '' buffer_out = '' milliseconds = 0.0 last_odometer_reset = 0 odometer_ticks = 0 button_arduino_out = 0 button_arduino_in = 0 def setup_serial_and_reset_arduinos(): # This will set up the serial ports. If they are already set up, it will