GNSS simulator: report the real direction of travel (it drives the loop counterclockwise, so the bearing is -angle, not angle+90°)
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-23 16:15:15 +01:00
1 parent 06ae14bc02
commit 80d0039148
1 file changed
+4 -3
+4 -3
View File
@@ -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 = {