def test_new_deck_points(): # Checks that the correct deck calibration points are being used # if feature_flag is set (or not) advs.set_adv_setting('deckCalibrationDots', True) calibration_points = get_calibration_points() expected_points1 = expected_points() # Check that old calibration points are used in cli assert calibration_points[1] == (12.13, 6.0) assert calibration_points[2] == (380.87, 6.0) assert calibration_points[3] == (12.13, 351.5) # Check that endpoints are now using slot 7 for dots assert expected_points1['1'] == (12.13, 6.0) assert expected_points1['2'] == (380.87, 6.0) assert expected_points1['3'] == (12.13, 261.0) advs.set_adv_setting('deckCalibrationDots', False) calibration_points2 = get_calibration_points() expected_points2 = expected_points() # Check that new calibration points are used assert calibration_points2[1] == (12.13, 9.0) assert calibration_points2[2] == (380.87, 9.0) assert calibration_points2[3] == (12.13, 348.5) # Check that endpoints are now using slot 7 for crosses assert expected_points2['1'] == (12.13, 9.0) assert expected_points2['2'] == (380.87, 9.0) assert expected_points2['3'] == (12.13, 258.0)
async def test_save_calibration_file(dc_session, monkeypatch): hardware = dc_session.adapter hardware.reset() expected_pos = endpoints.expected_points() dc_session.points = { k: (v[0], v[1] + 0.3) for k, v in expected_pos.items() } dc_session.z_value = 0.2 persisted_data = [] def dummy_save(config, filename=None, tag=None): nonlocal persisted_data persisted_data.append((config, filename, tag)) monkeypatch.setattr(robot_configs, 'save_deck_calibration', dummy_save) await endpoints.save_transform({}) in_memory = hardware.config.gantry_calibration assert len(persisted_data) == 1 # back up now happens at beginning of sess assert persisted_data[0][0].gantry_calibration == in_memory expected = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.3], [0.0, 0.0, 1.0, 0.2], [0.0, 0.0, 0.0, 1.0]] assert np.allclose(in_memory, expected)