mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-29 02:21:41 +00:00
Robot offset point (#98)
* Add offset point calculation in backend * Add pipeline result caching * Add dual offset unit test
This commit is contained in:
@@ -321,7 +321,7 @@
|
||||
},
|
||||
deleteCurrentPipeline() {
|
||||
if (this.$store.getters.pipelineList.length > 1) {
|
||||
this.handleInputWithIndex('command', 'deleteCurrentPipeline');
|
||||
this.handleInputWithIndex('deleteCurrentPipeline');
|
||||
} else {
|
||||
this.snackbar = true;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user