From 87ca73cb1d6fa7a95952ae44064345ae5807d2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?qkr7828=28=EB=B0=95=EC=9E=AC=EC=9A=B0=29?= Date: Thu, 14 Dec 2023 17:42:51 +0900 Subject: [PATCH] =?UTF-8?q?=ED=97=A4=EB=94=A9=EA=B0=81=20360=EB=8F=84=20?= =?UTF-8?q?=EC=B4=88=EA=B3=BC=ED=95=98=EB=8A=94=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- document/dron_test/pav-utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/document/dron_test/pav-utils.js b/document/dron_test/pav-utils.js index 9b3f1d9..8112bef 100644 --- a/document/dron_test/pav-utils.js +++ b/document/dron_test/pav-utils.js @@ -74,9 +74,10 @@ function calculateHeading(x1, y1, x2, y2) { var dx = x2 - x1; var dy = y2 - y1; var heading = (Math.atan2(dy, dx) * 180) / Math.PI; - if (heading < 0) { - heading += 360; - } + + // Ensure heading is within the range [0, 360) + heading = (heading + 360) % 360; + return heading; } @@ -93,7 +94,7 @@ const dumyData = { elev: 125.4, speedType: 'm/s', speed: 40.5, - heading: 227.94, + heading: 0, terminalRcvDt: '20210629173145', betteryLevel: 91, betteryVoltage: 50,