Treat cancellation and other errors differently

This commit is contained in:
Joe Knapper 2025-04-07 14:22:43 +01:00
parent 9995e5b3bb
commit a506625e40

View file

@ -207,9 +207,13 @@ class CameraStageMapper(Thing):
result: dict = calibrate_backlash_1d(
tracker, move, direction_array, logger=logger
)
except (InvocationCancelledError, MappingError) as e:
except InvocationCancelledError as e:
logger.info("User cancelled the camera stage mapping calibration")
logger.info("Returning to starting position")
stage.move_absolute(**starting_position, block_cancellation=True)
except MappingError as e:
logger.info("Returning to starting position due to failed calibration")
stage.move_absolute(**starting_position, block_cancellation=True)
raise e
result["move_history"] = move.history
result["image_resolution"] = hw.grab_image().shape[:2]