From 80d0039148a12c86191fa1450786c8accb89e331 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 23 Nov 2026 16:15:15 +0100 Subject: [PATCH] =?UTF-8?q?GNSS=20simulator:=20report=20the=20real=20direc?= =?UTF-8?q?tion=20of=20travel=20(it=20drives=20the=20loop=20counterclockwi?= =?UTF-8?q?se,=20so=20the=20bearing=20is=20-angle,=20not=20angle+90=C2=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/gnss_simulator.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/gnss_simulator.rb b/bin/gnss_simulator.rb index c8e57fe..637eec7 100755 --- a/bin/gnss_simulator.rb +++ b/bin/gnss_simulator.rb @@ -45,9 +45,10 @@ loop do angle = (elapsed / LOOP_SECONDS) * 2 * Math::PI lat, lon = point_on_loop(LAT, LON, RADIUS_M, angle) - # Bearing of travel: tangent to the circle, 90 degrees ahead of the - # radius vector at this point. - track = (angle * 180 / Math::PI + 90) % 360 + # Bearing of travel (compass: 0 = north, clockwise). The loop runs + # counterclockwise from east (angle is a math angle), so the velocity + # points (east, north) = (-sin, cos): bearing atan2(-sin, cos) = -angle. + track = (-angle * 180 / Math::PI) % 360 speed = (2 * Math::PI * RADIUS_M) / LOOP_SECONDS # m/s, constant pace report = {