Merge branch 'csm-return-to-start' into 'v3'
CSM always returns to start on error See merge request openflexure/openflexure-microscope-server!227
This commit is contained in:
commit
d4247235e3
2 changed files with 7 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ classifiers = [
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"labthings-fastapi[server] == 0.0.7",
|
"labthings-fastapi[server] == 0.0.7",
|
||||||
"labthings-sangaboard",
|
"labthings-sangaboard",
|
||||||
"camera-stage-mapping ~= 0.1.7",
|
"camera-stage-mapping ~= 0.1.8",
|
||||||
"opencv-python ~= 4.7.0",
|
"opencv-python ~= 4.7.0",
|
||||||
"pillow ~= 10.4",
|
"pillow ~= 10.4",
|
||||||
"anyio ~= 4.0",
|
"anyio ~= 4.0",
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ from camera_stage_mapping.camera_stage_calibration_1d import (
|
||||||
calibrate_backlash_1d,
|
calibrate_backlash_1d,
|
||||||
image_to_stage_displacement_from_1d,
|
image_to_stage_displacement_from_1d,
|
||||||
)
|
)
|
||||||
|
from camera_stage_mapping.exceptions import MappingError
|
||||||
from labthings_fastapi.dependencies.invocation import (
|
from labthings_fastapi.dependencies.invocation import (
|
||||||
InvocationCancelledError,
|
InvocationCancelledError,
|
||||||
InvocationLogger,
|
InvocationLogger,
|
||||||
|
|
@ -207,9 +208,14 @@ class CameraStageMapper(Thing):
|
||||||
tracker, move, direction_array, logger=logger
|
tracker, move, direction_array, logger=logger
|
||||||
)
|
)
|
||||||
except InvocationCancelledError as e:
|
except InvocationCancelledError as e:
|
||||||
|
logger.info("User cancelled the camera stage mapping calibration")
|
||||||
logger.info("Returning to starting position")
|
logger.info("Returning to starting position")
|
||||||
stage.move_absolute(**starting_position, block_cancellation=True)
|
stage.move_absolute(**starting_position, block_cancellation=True)
|
||||||
raise e
|
raise e
|
||||||
|
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["move_history"] = move.history
|
||||||
result["image_resolution"] = hw.grab_image().shape[:2]
|
result["image_resolution"] = hw.grab_image().shape[:2]
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue