Skip to content

Commit

Permalink
feat(hardware-testing): Belt calibration script defaults to just cali…
Browse files Browse the repository at this point in the history
…brate and not test (#13151)
  • Loading branch information
andySigler authored and ryanthecoder committed Jul 26, 2023
1 parent 4b036f8 commit 2f25b8b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions hardware-testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ test-examples:
.PHONY: test-scripts
test-scripts:
$(python) -m hardware_testing.scripts.bowtie_ot3 --simulate
$(python) -m hardware_testing.scripts.belt_calibration_ot3 --simulate

.PHONY: test-integration
test-integration: test-production-qc test-examples test-scripts test-gravimetric
Expand Down
49 changes: 30 additions & 19 deletions hardware-testing/hardware_testing/scripts/belt_calibration_ot3.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,38 +70,49 @@ async def _calibrate_belts(api: OT3API, mount: types.OT3Mount) -> None:
print(attitude)


async def _main(is_simulating: bool, mount: types.OT3Mount) -> None:
async def _main(is_simulating: bool, mount: types.OT3Mount, test: bool) -> None:
ui.print_title("BELT CALIBRATION")
api = await helpers_ot3.build_async_ot3_hardware_api(
is_simulating=is_simulating,
pipette_left="p1000_single_v3.4",
pipette_right="p1000_single_v3.4",
)
print("homing")
await api.home()
print("resetting robot calibration")
await api.reset_instrument_offset(mount)
api.reset_robot_calibration()

# SKIP calibrating the belts, then check accuracy
await _calibrate_pipette(api, mount)
await _check_belt_accuracy(api, mount)

# DO calibrate the belts, then check accuracy
await _calibrate_belts(api, mount) # <-- !!!
await _calibrate_pipette(api, mount)
await _check_belt_accuracy(api, mount)

print("done")
try:
print("homing")
await api.home()
attach_pos = helpers_ot3.get_slot_calibration_square_position_ot3(2)
current_pos = await api.gantry_position(mount)
await api.move_to(mount, attach_pos._replace(z=current_pos.z))
if not api.is_simulator:
ui.get_user_ready("ATTACH a probe")
print("resetting robot calibration")
await api.reset_instrument_offset(mount)
api.reset_robot_calibration()
if test:
# check accuracy of gantry-to-deck
await _calibrate_pipette(api, mount)
await _check_belt_accuracy(api, mount)
# calibrate the belts
await _calibrate_belts(api, mount) # <-- !!!
if test:
# check accuracy of gantry-to-deck
await _calibrate_pipette(api, mount)
await _check_belt_accuracy(api, mount)
print("done")
finally:
if not api.is_simulator:
print("restarting opentrons-robot-server")
helpers_ot3.start_server_ot3()


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--simulate", action="store_true")
parser.add_argument("--mount", type=str, choices=["left", "right"], required=True)
parser.add_argument("--test", action="store_true")
parser.add_argument("--mount", type=str, choices=["left", "right"], default="left")
args = parser.parse_args()
if args.mount == "left":
mnt = types.OT3Mount.LEFT
else:
mnt = types.OT3Mount.RIGHT
asyncio.run(_main(args.simulate, mnt))
asyncio.run(_main(args.simulate, mnt, args.test))

0 comments on commit 2f25b8b

Please sign in to comment.