fix non-gimbling camera azimuth

correct pan to azimuth
This commit is contained in:
David Tsay 2023-02-09 16:11:09 -08:00
parent ae623b8552
commit 0476466441
6 changed files with 35 additions and 32 deletions

View File

@ -275,7 +275,7 @@ function pointForTimestamp(timestamp, name, imageSamples, delay) {
local: Math.floor(timestamp / delay) * delay, local: Math.floor(timestamp / delay) * delay,
url, url,
sunOrientation: getCompassValues(0, 360), sunOrientation: getCompassValues(0, 360),
cameraPan: getCompassValues(0, 360), cameraAzimuth: getCompassValues(0, 360),
heading: getCompassValues(0, 360), heading: getCompassValues(0, 360),
transformations: navCamTransformations, transformations: navCamTransformations,
imageDownloadName imageDownloadName

View File

@ -26,14 +26,12 @@
:style="`width: 100%; height: 100%`" :style="`width: 100%; height: 100%`"
> >
<CompassHUD <CompassHUD
v-if="showCompassHUD"
:sun-heading="sunHeading" :sun-heading="sunHeading"
:camera-angle-of-view="cameraAngleOfView" :camera-angle-of-view="cameraAngleOfView"
:camera-pan="cameraPan" :camera-azimuth="cameraAzimuth"
/> />
<CompassRose <CompassRose
v-if="showCompassRose" :camera-azimuth="cameraAzimuth"
:camera-pan="cameraPan"
:heading="heading" :heading="heading"
:sized-image-dimensions="sizedImageDimensions" :sized-image-dimensions="sizedImageDimensions"
:sun-heading="sunHeading" :sun-heading="sunHeading"
@ -62,12 +60,6 @@ export default {
} }
}, },
computed: { computed: {
showCompassHUD() {
return this.hasCameraPan && this.cameraAngleOfView > 0;
},
showCompassRose() {
return (this.hasCameraPan || this.hasHeading) && this.cameraAngleOfView > 0;
},
// horizontal rotation from north in degrees // horizontal rotation from north in degrees
heading() { heading() {
return this.image.heading; return this.image.heading;
@ -80,11 +72,11 @@ export default {
return this.image.sunOrientation; return this.image.sunOrientation;
}, },
// horizontal rotation from north in degrees // horizontal rotation from north in degrees
cameraPan() { cameraAzimuth() {
return this.image.cameraPan; return this.image.cameraPan;
}, },
hasCameraPan() { hasCameraAzimuth() {
return this.cameraPan !== undefined; return this.cameraAzimuth !== undefined;
}, },
cameraAngleOfView() { cameraAngleOfView() {
return this.transformations?.cameraAngleOfView; return this.transformations?.cameraAngleOfView;

View File

@ -102,7 +102,7 @@ export default {
type: Number, type: Number,
default: undefined default: undefined
}, },
cameraPan: { cameraAzimuth: {
type: Number, type: Number,
required: true required: true
} }
@ -132,8 +132,8 @@ export default {
}, },
visibleRange() { visibleRange() {
return [ return [
rotate(this.cameraPan, -this.cameraAngleOfView / 2), rotate(this.cameraAzimuth, -this.cameraAngleOfView / 2),
rotate(this.cameraPan, this.cameraAngleOfView / 2) rotate(this.cameraAzimuth, this.cameraAngleOfView / 2)
]; ];
} }
} }

View File

@ -75,7 +75,6 @@
:style="sunHeadingStyle" :style="sunHeadingStyle"
/> />
<!-- Camera FOV -->
<mask <mask
id="mask2" id="mask2"
class="c-cr__cam-fov-l-mask" class="c-cr__cam-fov-l-mask"
@ -117,10 +116,10 @@
class="cr-vrover" class="cr-vrover"
:style="camAngleAndPositionStyle" :style="camAngleAndPositionStyle"
> >
<!-- Equipment body. Rotates relative to the camera pan value for cams that gimbal. --> <!-- Equipment body. Rotates relative to the camera pan value for cameras that gimble. -->
<path <path
class="cr-vrover__body" class="cr-vrover__body"
:style="camGimbalAngleStyle" :style="gimbledCameraPanStyle"
x x
fill-rule="evenodd" fill-rule="evenodd"
clip-rule="evenodd" clip-rule="evenodd"
@ -128,6 +127,7 @@
/> />
</g> </g>
<!-- Camera FOV -->
<g <g
class="c-cr__cam-fov" class="c-cr__cam-fov"
> >
@ -160,7 +160,7 @@
<!-- NSEW and ticks --> <!-- NSEW and ticks -->
<g <g
class="c-cr__nsew" class="c-cr__nsew"
:style="compassRoseStyle" :style="compassDialStyle"
> >
<g class="c-cr__ticks-major"> <g class="c-cr__ticks-major">
<path d="M50 3L43 10H57L50 3Z" /> <path d="M50 3L43 10H57L50 3Z" />
@ -270,7 +270,7 @@ export default {
type: Number, type: Number,
default: undefined default: undefined
}, },
cameraPan: { cameraAzimuth: {
type: Number, type: Number,
default: undefined default: undefined
}, },
@ -289,8 +289,14 @@ export default {
}; };
}, },
computed: { computed: {
cameraHeading() { hasGimble() {
return this.cameraPan ?? this.heading; return this.cameraAzimuth !== undefined;
},
// compass ordinal orientation of camera
normalizedCameraAzimuth() {
return this.hasGimble
? rotate(this.cameraAzimuth)
: rotate(this.heading, -this.transformations?.rotation ?? 0);
}, },
cameraAngleOfView() { cameraAngleOfView() {
return this.transformations?.cameraAngleOfView; return this.transformations?.cameraAngleOfView;
@ -303,18 +309,22 @@ export default {
return { transform: `translate(${translateX}%, ${translateY}%) rotate(${rotation}deg) scale(${scale})` }; return { transform: `translate(${translateX}%, ${translateY}%) rotate(${rotation}deg) scale(${scale})` };
}, },
camGimbalAngleStyle() { gimbledCameraPanStyle() {
const rotation = rotate(this.heading); if (!this.hasGimble) {
return;
}
const gimbledCameraPan = rotate(this.normalizedCameraAzimuth, -this.heading);
return { return {
transform: `rotate(${ rotation }deg)` transform: `rotate(${ -gimbledCameraPan }deg)`
}; };
}, },
compassRoseStyle() { compassDialStyle() {
return { transform: `rotate(${ this.north }deg)` }; return { transform: `rotate(${ this.north }deg)` };
}, },
north() { north() {
return this.lockCompass ? rotate(-this.cameraHeading) : 0; return this.lockCompass ? rotate(-this.normalizedCameraAzimuth) : 0;
}, },
cardinalTextRotateN() { cardinalTextRotateN() {
return { transform: `translateY(-27%) rotate(${ -this.north }deg)` }; return { transform: `translateY(-27%) rotate(${ -this.north }deg)` };
@ -342,7 +352,7 @@ export default {
}; };
}, },
cameraHeadingStyle() { cameraHeadingStyle() {
const rotation = rotate(this.north, this.cameraHeading); const rotation = rotate(this.north, this.normalizedCameraAzimuth);
return { return {
transform: `rotate(${ rotation }deg)` transform: `rotate(${ rotation }deg)`

View File

@ -35,7 +35,7 @@ describe("The Compass component", () => {
roll: 90, roll: 90,
pitch: 90, pitch: 90,
cameraTilt: 100, cameraTilt: 100,
cameraPan: 90, cameraAzimuth: 90,
sunAngle: 30 sunAngle: 30
}; };
let propsData = { let propsData = {

View File

@ -431,8 +431,9 @@ export default {
&& this.zoomFactor === 1 && this.zoomFactor === 1
&& this.imagePanned !== true; && this.imagePanned !== true;
const hasCameraConfigurations = this.focusedImage?.transformations !== undefined; const hasCameraConfigurations = this.focusedImage?.transformations !== undefined;
const hasHeading = this.focusedImage?.heading !== undefined;
return display && hasCameraConfigurations; return display && hasCameraConfigurations && hasHeading;
}, },
isSpacecraftPositionFresh() { isSpacecraftPositionFresh() {
let isFresh = undefined; let isFresh = undefined;