def weed_scan(): """ pause before taking image """ def plant_detection(): device.wait(1000) device.execute_script(label='plant-detection') """ scans length of X axis """ def scan_line(): while device.get_current_position('x') < X_MAX: if coord.get_axis_position('x') + X_MOVE > X_MAX: coord.set_axis_position('x', X_MAX) else: coord.set_axis_position('x', coord.get_axis_position('x') + X_MOVE) plant_detection() """ start scan """ coord = Coordinate(X_START, Y_START) coord.move_abs() device.execute_script(label='plant-detection') scan_line() while device.get_current_position('y') < Y_MAX: if coord.get_axis_position('y') + Y_MOVE > Y_MAX: coord.set_coordinate(X_START, Y_MAX) else: coord.set_coordinate(X_START, coord.get_axis_position('y') + Y_MOVE) coord.move_abs() plant_detection() scan_line() device.sync() device.log('Scan Complete.', 'info', ['toast'])
def sync(self): if not self.debug: time.sleep(1) # wait a bit for previously send requests to settle device.sync() sync: str for cnt in range(1, 30): sync = self.bot_state().informational_settings.sync_status device.log(f"interim status {sync}") if sync == "synced": break if sync == "sync_error": raise ValueError('Sync error, bot failed to complete syncing') time.sleep(0.5) else: raise ValueError('Sync timeout, bot failed to complete syncing')
def setup(self): 'Pre-test config.' print('-' * 50) print('TEST SETUP:') fw_out_log_opt = app.get_property('fbos_config', LOG_FW_CMD_CONFIG_KEY, get_info=app_login) if fw_out_log_opt: print('{}`{}`{} option already enabled.'.format( COLOR.bold, LOG_FW_CMD_CONFIG_KEY, COLOR.reset)) else: app.put('fbos_config', payload={LOG_FW_CMD_CONFIG_KEY: True}, get_info=app_login) self.wait_for_log(LOG_FW_CMD_CONFIG_KEY, count_time=False) send(device.sync()['command'], self.login_info) print('-' * 50)
sys.exit() weeder_tool_retrieve_sequence_id = Qualify.sequence(PKG, 'tool_weed_retrieve') weeder_tool_return_sequence_id = Qualify.sequence(PKG, 'tool_weed_return') if len(input_errors): for err in input_errors: device.log(err, 'error', ['toast']) sys.exit() else: device.log('No config errors detected') device.write_pin(PIN_LIGHTS, 1, 0) points = app.get_points() if len(points): device.log('Deleting existing points...') del_all_points() device.sync() weed_scan() points = app.get_points() weed_points = get_weed_points() #device.log(json.dumps(weed_points)) if len(weed_points): zap_weeds() else: device.log('No weeds detected, going home...') device.home('all') device.write_pin(PIN_LIGHTS, 0, 0)