Improve responsiveness and reliability of moves

Fixed a bug where incorrect values in the position control
caused incorrect relative moves.

Decreased the polling interval to make moves more responsive.
This commit is contained in:
Richard Bowman 2023-12-15 00:15:23 +00:00
parent a9fdb6fd52
commit 93757c2103

View file

@ -78,7 +78,7 @@
</li> </li>
<li class="uk-open"> <li class="uk-open">
<a class="uk-accordion-title" href="#">Move-to</a> <a class="uk-accordion-title" href="#">Position</a>
<div class="uk-accordion-content"> <div class="uk-accordion-content">
<form> <form>
<!-- Text boxes to set and view position --> <!-- Text boxes to set and view position -->
@ -102,6 +102,7 @@
:submit-data="setPosition" :submit-data="setPosition"
:submit-label="'Move'" :submit-label="'Move'"
:canTerminate="false" :canTerminate="false"
:pollInterval="0.05"
@taskStarted="moveLock = true" @taskStarted="moveLock = true"
@finished="moveLock = false" @finished="moveLock = false"
@error="modalError" @error="modalError"
@ -293,6 +294,7 @@ export default {
if (absolute){ if (absolute){
this.setPosition = {"x": x, "y": y, "z": z} this.setPosition = {"x": x, "y": y, "z": z}
}else{ }else{
await this.updatePosition();
this.setPosition = { this.setPosition = {
"x": this.setPosition.x + x, "x": this.setPosition.x + x,
"y": this.setPosition.y + y, "y": this.setPosition.y + y,
@ -300,10 +302,10 @@ export default {
} }
} }
await this.timeout(1); // Wait for Vue to update the position await this.timeout(1); // Wait for Vue to update the position
this.startMoveTask(); await this.startMoveTask();
}, },
startMoveTask() { async startMoveTask() {
this.$refs.moveTaskSubmitter.startTask(); await this.$refs.moveTaskSubmitter.startTask();
}, },
moveInImageCoordinatesRequest: function(x, y) { moveInImageCoordinatesRequest: function(x, y) {
// If not movement-locked // If not movement-locked
@ -347,15 +349,8 @@ export default {
}); });
}, },
updatePosition: function() { async updatePosition() {
axios this.setPosition = await this.readThingProperty("stage", "position")
.get(this.positionStatusUri)
.then(response => {
this.setPosition = response.data;
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
}, },
handleCaptureResponse: async function(response) { handleCaptureResponse: async function(response) {