Use calibration_required property to conditionally render z cal step
This commit is contained in:
parent
5875abbceb
commit
f68515b17d
5 changed files with 50 additions and 12 deletions
|
|
@ -166,6 +166,9 @@ class BaseStage(lt.Thing):
|
||||||
)
|
)
|
||||||
"""Used to convert coordinates between the program frame and the hardware frame."""
|
"""Used to convert coordinates between the program frame and the hardware frame."""
|
||||||
|
|
||||||
|
calibration_required: bool = lt.setting(default=False)
|
||||||
|
"""Whether calibration of the stage z axis is required."""
|
||||||
|
|
||||||
def update_position(self) -> None:
|
def update_position(self) -> None:
|
||||||
"""Update the position property from the stage."""
|
"""Update the position property from the stage."""
|
||||||
# Copy the position before the move.
|
# Copy the position before the move.
|
||||||
|
|
@ -535,3 +538,8 @@ class BaseStage(lt.Thing):
|
||||||
This method provides the interface expected by the camera_stage_mapping.
|
This method provides the interface expected by the camera_stage_mapping.
|
||||||
"""
|
"""
|
||||||
self.move_absolute(x=xyz_pos[0], y=xyz_pos[1], z=xyz_pos[2])
|
self.move_absolute(x=xyz_pos[0], y=xyz_pos[1], z=xyz_pos[2])
|
||||||
|
|
||||||
|
@lt.action
|
||||||
|
def mark_calibration_complete(self) -> None:
|
||||||
|
"""Mark stage calibration as complete."""
|
||||||
|
self.calibration_required = False
|
||||||
|
|
|
||||||
|
|
@ -236,3 +236,6 @@ class SangaboardThing(BaseStage):
|
||||||
self._sangaboard.query(f"{led_command} {on_brightness}")
|
self._sangaboard.query(f"{led_command} {on_brightness}")
|
||||||
else:
|
else:
|
||||||
self._sangaboard.query(f"{led_command} 0")
|
self._sangaboard.query(f"{led_command} 0")
|
||||||
|
|
||||||
|
calibration_required: bool = lt.setting(default=True)
|
||||||
|
"""By default, Sangaboard stage will require calibration of z direction."""
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
<script>
|
<script>
|
||||||
import singleStepTask from "./calibrationWizardComponents/singleStepTask.vue";
|
import singleStepTask from "./calibrationWizardComponents/singleStepTask.vue";
|
||||||
import welcomeStep from "./calibrationWizardComponents/welcomeStep.vue";
|
import welcomeStep from "./calibrationWizardComponents/welcomeStep.vue";
|
||||||
import zMotorDirectionStep from "./calibrationWizardComponents/zMotorDirectionStep.vue";
|
import zMotorCalibrationTask from "./calibrationWizardComponents/zMotorCalibrationTask.vue";
|
||||||
import cameraCalibrationTask from "./calibrationWizardComponents/cameraCalibrationTask.vue";
|
import cameraCalibrationTask from "./calibrationWizardComponents/cameraCalibrationTask.vue";
|
||||||
import cameraStageMappingTask from "./calibrationWizardComponents/cameraStageMappingTask.vue";
|
import cameraStageMappingTask from "./calibrationWizardComponents/cameraStageMappingTask.vue";
|
||||||
import finalStep from "./calibrationWizardComponents/finalStep.vue";
|
import finalStep from "./calibrationWizardComponents/finalStep.vue";
|
||||||
|
|
@ -69,6 +69,7 @@ export default {
|
||||||
this.$refs["calibrationModalEl"].addEventListener("hidden", this.onHide);
|
this.$refs["calibrationModalEl"].addEventListener("hidden", this.onHide);
|
||||||
// Check which Things are available on mount.
|
// Check which Things are available on mount.
|
||||||
const allCalibrationTasks = {
|
const allCalibrationTasks = {
|
||||||
|
stage: markRaw(zMotorCalibrationTask),
|
||||||
camera: markRaw(cameraCalibrationTask),
|
camera: markRaw(cameraCalibrationTask),
|
||||||
camera_stage_mapping: markRaw(cameraStageMappingTask),
|
camera_stage_mapping: markRaw(cameraStageMappingTask),
|
||||||
};
|
};
|
||||||
|
|
@ -121,15 +122,6 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask which way the z motor turns, right after the welcome screen but before any
|
|
||||||
// other tasks, so the stage is correctly oriented before anything else runs.
|
|
||||||
if (this.thingAvailable("stage") && this.thingDescription("stage").title != "DummyStage") {
|
|
||||||
tasks.push({
|
|
||||||
component: markRaw(singleStepTask),
|
|
||||||
props: { title: "Stage Calibration", stepComponent: zMotorDirectionStep },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add calibration task for each thing
|
// Add calibration task for each thing
|
||||||
for (const thing of thingsToCal) {
|
for (const thing of thingsToCal) {
|
||||||
const taskComponent = this.availableCalibrationTasks[thing];
|
const taskComponent = this.availableCalibrationTasks[thing];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<template>
|
||||||
|
<singleStepTask
|
||||||
|
title="Stage Calibration"
|
||||||
|
:step-component="zMotorDirectionStep"
|
||||||
|
@next="$emit('next')"
|
||||||
|
@back="$emit('back')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import singleStepTask from "./singleStepTask.vue";
|
||||||
|
import zMotorDirectionStep from "./zMotorDirectionStep.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ZMotorCalibrationTask",
|
||||||
|
|
||||||
|
components: {
|
||||||
|
singleStepTask,
|
||||||
|
},
|
||||||
|
|
||||||
|
emits: ["next", "back"],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
zMotorDirectionStep,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -69,7 +69,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$emit("awaiting-user", true);
|
this.checkCalibrationState();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -94,7 +94,9 @@ export default {
|
||||||
},
|
},
|
||||||
// Once a direction is selected, advance
|
// Once a direction is selected, advance
|
||||||
selectDir() {
|
selectDir() {
|
||||||
this.$emit("advance");
|
this.invokeAction("stage", "mark_calibration_complete").then(() => {
|
||||||
|
this.$emit("advance");
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// If motor moves clockwise, invert z direction, then progress to next step
|
// If motor moves clockwise, invert z direction, then progress to next step
|
||||||
triggerClockwise() {
|
triggerClockwise() {
|
||||||
|
|
@ -102,6 +104,10 @@ export default {
|
||||||
this.selectDir();
|
this.selectDir();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
async checkCalibrationState() {
|
||||||
|
const needsCal = await this.readThingProperty("stage", "calibration_required");
|
||||||
|
this.$emit("awaiting-user", needsCal);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue