Release lock at end of ROM test
This commit is contained in:
parent
b8eb1907c3
commit
82f435256b
1 changed files with 33 additions and 29 deletions
|
|
@ -152,6 +152,7 @@ class RangeofMotionThing(lt.Thing):
|
||||||
if not got_lock:
|
if not got_lock:
|
||||||
raise RuntimeError("Trying to run ROM test when a test is already running.")
|
raise RuntimeError("Trying to run ROM test when a test is already running.")
|
||||||
|
|
||||||
|
try:
|
||||||
rom_deps = RomDeps(
|
rom_deps = RomDeps(
|
||||||
autofocus=autofocus, stage=stage, csm=csm, cam=cam, logger=logger
|
autofocus=autofocus, stage=stage, csm=csm, cam=cam, logger=logger
|
||||||
)
|
)
|
||||||
|
|
@ -176,7 +177,9 @@ class RangeofMotionThing(lt.Thing):
|
||||||
for axis_dir in directions:
|
for axis_dir in directions:
|
||||||
# Create a new tracker at start of measurement.
|
# Create a new tracker at start of measurement.
|
||||||
self._rom_data = RomDataTracker()
|
self._rom_data = RomDataTracker()
|
||||||
self._move_until_edge(axis=axis, direction=axis_dir, rom_deps=rom_deps)
|
self._move_until_edge(
|
||||||
|
axis=axis, direction=axis_dir, rom_deps=rom_deps
|
||||||
|
)
|
||||||
# Append final position from tracker
|
# Append final position from tracker
|
||||||
axis_limits.append(self._rom_data.final_position[axis])
|
axis_limits.append(self._rom_data.final_position[axis])
|
||||||
# Calculate step range.
|
# Calculate step range.
|
||||||
|
|
@ -185,7 +188,8 @@ class RangeofMotionThing(lt.Thing):
|
||||||
total_time = time.time() - start_time
|
total_time = time.time() - start_time
|
||||||
logger.info(f"Range of motion is {step_range[0]} x {step_range[1]} steps")
|
logger.info(f"Range of motion is {step_range[0]} x {step_range[1]} steps")
|
||||||
self.calibrated_range = step_range
|
self.calibrated_range = step_range
|
||||||
|
finally:
|
||||||
|
self._lock.release()
|
||||||
return {
|
return {
|
||||||
"Time": total_time,
|
"Time": total_time,
|
||||||
"CSM Matrix": csm.image_to_stage_displacement_matrix,
|
"CSM Matrix": csm.image_to_stage_displacement_matrix,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue