if drive.close_tray(): break log.warn("Could not close drive tray, retry '{}' of '{}'".format(i, config.close_tray_max_attempts)) display.msg("ERR DRIVE CLOSE") drive.open_tray() # Move the arm away so that the camera can make a photo of the disc arm.move_abs(config.src_tray_pos) log.info("Archiving disc in drive tray") display.msg("IMAGING ...") dest_tray = config.done_tray_pos if not drive.read_disc(capture_id): log.error("Disk could not be imaged, putting into FAILED tray") display.msg("IMAGING FAIL") dest_tray = config.error_tray_pos else: log.info("Disc successfuly imaged, putting to DONE tray") drive.open_tray() try: tmp_image_filename = vision.image_acquire() vision.write_cover_image(tmp_image_filename, '{}/{}/cover.png'.format(storage_path, capture_id), calibration_markers) except: log.error("Could not acquire image and write a cover file") display.msg("ERR ACQ. COVER IMG") dest_tray = config.error_tray_pos