From b4a58165ee374bd895b090b4d0fe540c2fb85c3e Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Wed, 18 Oct 2023 23:41:52 -0400 Subject: [PATCH] Fix rotation issues with showing ATFL --- .../settings/ApriltagControlCard.vue | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/photon-client/src/components/settings/ApriltagControlCard.vue b/photon-client/src/components/settings/ApriltagControlCard.vue index ada5c5a3a8..b726cf6b6a 100644 --- a/photon-client/src/components/settings/ApriltagControlCard.vue +++ b/photon-client/src/components/settings/ApriltagControlCard.vue @@ -3,13 +3,16 @@ import { useSettingsStore } from "@/stores/settings/GeneralSettingsStore"; import { Euler, Quaternion as ThreeQuat } from "three"; import type { Quaternion } from "@/types/PhotonTrackingTypes"; -const quatToEuler = (quat: Quaternion): Euler => { - const three_quat = new ThreeQuat(quat.X, quat.Y, quat.Z, quat.W); - return new Euler().setFromQuaternion(three_quat, "ZYX"); -}; +const quaternionToEuler = (rot_quat: Quaternion): {x: number, y: number, z: number} => { + const quat = new ThreeQuat(rot_quat.X, rot_quat.Y, rot_quat.Z, rot_quat.W); + const euler = new Euler().setFromQuaternion(quat, "ZYX"); -// Convert from radians to degrees. -const degrees = (radians: number): number => radians * (180.0 / Math.PI); + return { + x: euler.x * (180.0 / Math.PI), + y: euler.y * (180.0 / Math.PI), + z: euler.z * (180.0 / Math.PI) + }; +};