GNSS simulator: report the real direction of travel (it drives the loop counterclockwise, so the bearing is -angle, not angle+90°)
This commit is contained in:
1 parent
06ae14bc02
commit
80d0039148
1 file changed
+4
-3
@@ -45,9 +45,10 @@ loop do
|
|||||||
angle = (elapsed / LOOP_SECONDS) * 2 * Math::PI
|
angle = (elapsed / LOOP_SECONDS) * 2 * Math::PI
|
||||||
lat, lon = point_on_loop(LAT, LON, RADIUS_M, angle)
|
lat, lon = point_on_loop(LAT, LON, RADIUS_M, angle)
|
||||||
|
|
||||||
# Bearing of travel: tangent to the circle, 90 degrees ahead of the
|
# Bearing of travel (compass: 0 = north, clockwise). The loop runs
|
||||||
# radius vector at this point.
|
# counterclockwise from east (angle is a math angle), so the velocity
|
||||||
track = (angle * 180 / Math::PI + 90) % 360
|
# 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
|
speed = (2 * Math::PI * RADIUS_M) / LOOP_SECONDS # m/s, constant pace
|
||||||
|
|
||||||
report = {
|
report = {
|
||||||
|
|||||||
Reference in new issue
Block a user