diff --git a/src/plugins/imagery/components/Compass/Compass.vue b/src/plugins/imagery/components/Compass/Compass.vue index 9080b38b84..c9527c9a3c 100644 --- a/src/plugins/imagery/components/Compass/Compass.vue +++ b/src/plugins/imagery/components/Compass/Compass.vue @@ -27,7 +27,6 @@ > 0; }, - // compass direction from north in degrees + // horizontal rotation from north in degrees heading() { return this.image.heading; }, - pitch() { - return this.image.pitch; - }, - // compass direction from north in degrees + // horizontal rotation from north in degrees sunHeading() { return this.image.sunOrientation; }, - // relative direction from heading in degrees + // horizontal rotation from north in degrees cameraPan() { return this.image.cameraPan; }, - cameraTilt() { - return this.image.cameraTilt; - }, cameraAngleOfView() { return CAMERA_ANGLE_OF_VIEW; }, diff --git a/src/plugins/imagery/components/Compass/CompassHUD.vue b/src/plugins/imagery/components/Compass/CompassHUD.vue index b3a66e090f..c3920c0bd7 100644 --- a/src/plugins/imagery/components/Compass/CompassHUD.vue +++ b/src/plugins/imagery/components/Compass/CompassHUD.vue @@ -94,10 +94,6 @@ const COMPASS_POINTS = [ export default { props: { - heading: { - type: Number, - required: true - }, sunHeading: { type: Number, default: undefined @@ -136,8 +132,8 @@ export default { }, visibleRange() { return [ - rotate(this.heading, this.cameraPan, -this.cameraAngleOfView / 2), - rotate(this.heading, this.cameraPan, this.cameraAngleOfView / 2) + rotate(this.cameraPan, -this.cameraAngleOfView / 2), + rotate(this.cameraPan, this.cameraAngleOfView / 2) ]; } } diff --git a/src/plugins/imagery/components/Compass/CompassRose.vue b/src/plugins/imagery/components/Compass/CompassRose.vue index 07af6a266f..0a0ca27d2b 100644 --- a/src/plugins/imagery/components/Compass/CompassRose.vue +++ b/src/plugins/imagery/components/Compass/CompassRose.vue @@ -27,7 +27,7 @@ >
0; + cameraPanStyle() { + const rotation = rotate(this.north, this.cameraPan); + + return { + transform: `rotate(${ rotation }deg)` + }; }, // left half of camera field of view - // rotated counter-clockwise from camera field of view heading + // rotated counter-clockwise from camera pan angle cameraFOVStyleLeftHalf() { return { transform: `translateX(50%) rotate(${ -this.cameraAngleOfView / 2 }deg)` }; }, // right half of camera field of view - // rotated clockwise from camera field of view heading + // rotated clockwise from camera pan angle cameraFOVStyleRightHalf() { return { transform: `translateX(-50%) rotate(${ this.cameraAngleOfView / 2 }deg)` diff --git a/src/plugins/imagery/components/Compass/utils.js b/src/plugins/imagery/components/Compass/utils.js index 67e82f5db8..2d6a0a8a65 100644 --- a/src/plugins/imagery/components/Compass/utils.js +++ b/src/plugins/imagery/components/Compass/utils.js @@ -1,23 +1,28 @@ -export function rotate(direction, ...rotations) { +/** + * + * sums an arbitrary number of absolute rotations + * (meaning rotations relative to one common direction 0) + * normalizes the rotation to the range [0, 360) + * + * @param {...number} rotations in degrees + * @returns {number} normalized sum of all rotations - [0, 360) degrees + */ +export function rotate(...rotations) { const rotation = rotations.reduce((a, b) => a + b, 0); - return normalizeCompassDirection(direction + rotation); -} - -export function normalizeCompassDirection(degrees) { - const base = degrees % 360; - - return base >= 0 ? base : 360 + base; + return normalizeCompassDirection(rotation); } export function inRange(degrees, [min, max]) { + const point = rotate(degrees); + return min > max - ? (degrees >= min && degrees < 360) || (degrees <= max && degrees >= 0) - : degrees >= min && degrees <= max; + ? (point >= min && point < 360) || (point <= max && point >= 0) + : point >= min && point <= max; } export function percentOfRange(degrees, [min, max]) { - let distance = degrees; + let distance = rotate(degrees); let minRange = min; let maxRange = max; @@ -31,3 +36,9 @@ export function percentOfRange(degrees, [min, max]) { return (distance - minRange) / (maxRange - minRange); } + +function normalizeCompassDirection(degrees) { + const base = degrees % 360; + + return base >= 0 ? base : 360 + base; +} diff --git a/src/plugins/imagery/components/ImageryViewLayout.vue b/src/plugins/imagery/components/ImageryViewLayout.vue index 07defd9ba5..037a18728e 100644 --- a/src/plugins/imagery/components/ImageryViewLayout.vue +++ b/src/plugins/imagery/components/ImageryViewLayout.vue @@ -348,7 +348,7 @@ export default { // related telemetry keys this.spacecraftPositionKeys = ['positionX', 'positionY', 'positionZ']; - this.spacecraftOrientationKeys = ['heading', 'roll', 'pitch']; + this.spacecraftOrientationKeys = ['heading']; this.cameraKeys = ['cameraPan', 'cameraTilt']; this.sunKeys = ['sunOrientation']; @@ -468,7 +468,12 @@ export default { // set data ON image telemetry as well as in focusedImageRelatedTelemetry for (let key of this.relatedTelemetry.keys) { - if (this.relatedTelemetry[key] && this.relatedTelemetry[key].historical) { + if ( + this.relatedTelemetry[key] + && this.relatedTelemetry[key].historical + && this.relatedTelemetry[key].requestLatestFor + + ) { let valuesOnTelemetry = this.relatedTelemetry[key].hasTelemetryOnDatum; let value = await this.getMostRecentRelatedTelemetry(key, this.focusedImage); diff --git a/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js b/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js index 272552126c..b4393044c8 100644 --- a/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js +++ b/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js @@ -73,7 +73,7 @@ export default class RelatedTelemetry { await this._initializeHistorical(key); } - if (this[key].realtime && this[key].realtime.telemetryObjectId) { + if (this[key].realtime && this[key].realtime.telemetryObjectId && this[key].realtime.telemetryObjectId !== '') { await this._intializeRealtime(key); } } @@ -82,7 +82,9 @@ export default class RelatedTelemetry { } async _initializeHistorical(key) { - if (this[key].historical.telemetryObjectId) { + if (!this[key].historical.telemetryObjectId) { + this[key].historical.hasTelemetryOnDatum = true; + } else if (this[key].historical.telemetryObjectId !== '') { this[key].historicalDomainObject = await this._openmct.objects.get(this[key].historical.telemetryObjectId); this[key].requestLatestFor = async (datum) => { @@ -96,8 +98,6 @@ export default class RelatedTelemetry { return results[results.length - 1]; }; - } else { - this[key].historical.hasTelemetryOnDatum = true; } }