Robot offset point (#98)

* Add offset point calculation in backend

* Add pipeline result caching

* Add dual offset unit test
This commit is contained in:
Banks T
2020-08-27 14:41:03 -04:00
committed by GitHub
parent 9f0e89ea29
commit b6d9fe216a
22 changed files with 415 additions and 218 deletions

View File

@@ -321,7 +321,7 @@
},
deleteCurrentPipeline() {
if (this.$store.getters.pipelineList.length > 1) {
this.handleInputWithIndex('command', 'deleteCurrentPipeline');
this.handleInputWithIndex('deleteCurrentPipeline');
} else {
this.snackbar = true;
}

View File

@@ -31,7 +31,7 @@
small
color="yellow darken-3"
style="width: 100%;"
@click="clearSlope"
@click="clearPoints"
>
Clear All Points
</v-btn>
@@ -43,45 +43,16 @@
<script>
export default {
name: "DualCalibration",
// eslint-disable-next-line vue/require-prop-types
props: ['rawPoint'],
data() {
return {
pointA: undefined,
pointB: undefined
}
},
methods: {
clearPoints() {
this.handleInputWithIndex("robotOffsetPoint", 0, this.$store.state.currentCameraIndex)
},
takePointA() {
this.pointA = this.rawPoint;
this.calcSlope();
this.handleInputWithIndex("robotOffsetPoint", 2, this.$store.state.currentCameraIndex)
},
takePointB() {
this.pointB = this.rawPoint;
this.calcSlope();
},
calcSlope() {
if (this.pointA !== undefined && this.pointB !== undefined) {
let m = (this.pointB[1] - this.pointA[1]) / (this.pointB[0] - this.pointA[0]);
let b = this.pointA[1] - (m * this.pointA[0]);
if (isNaN(m) === false && isNaN(b) === false) {
this.sendSlope(m, b, true);
} else {
this.$emit('snackbar', "Points are too close");
}
this.pointA = undefined;
this.pointB = undefined;
}
},
sendSlope(m, b) {
this.handleInput('dualTargetCalibrationM', m);
this.handleInput('dualTargetCalibrationB', b);
this.$emit('update');
},
clearSlope() {
this.sendSlope(1, 0, false);
this.pointA = undefined;
this.pointB = undefined;
this.handleInputWithIndex("robotOffsetPoint", 3, this.$store.state.currentCameraIndex)
}
}
}

View File

@@ -32,20 +32,12 @@
<script>
export default {
name: "SingleCalibration",
// eslint-disable-next-line vue/require-prop-types
props: ['rawPoint'],
methods: {
clearPoint() {
this.handleInput('point', []);
this.$emit('update');
this.handleInputWithIndex("robotOffsetPoint", 0, this.$store.state.currentCameraIndex)
},
takePoint() {
if (this.rawPoint[0] && this.rawPoint[1]) {
this.handleInput('point', this.rawPoint);
this.$emit('update');
} else {
this.$emit('snackbar', "No target found");
}
this.handleInputWithIndex("robotOffsetPoint", 1, this.$store.state.currentCameraIndex)
}
}
}