-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drift and set formulas are incorrect #116
Comments
IMHO one should never use magnetic directions in any of the calculations. The only place the where magnetic stuff is involved is when converting a compass reading to true: true heading = compass heading + deviation + variation. If the compass is self-calibrating for deviation then deviation=0. That's it. From there one always use true directions. Saves a lot of headache. If you want to go back to magnetic for output purposes, you can always convert back after the actual calculation. set/drift must not depend on magnetic variation! How to calculate set and drift correctly? SOG and COG follow this equation
with (phi,r) being a vector in polar form and + denotes the sum of polar vectors. I would not actually calculate this sum that way. I would rather transform the vectors to cartesian space, add them, transform to polar space. ❗ The angle in the nautical system starts north and goes clockwise! So you get
with
|
Python version of addition of polar vectors def add_polar(a, b):
"sum of polar vectors (phi,r)"
# to cartesian with phi going clock-wise from north
a = a[1] * sin(radians(a[0])), a[1] * cos(radians(a[0]))
b = b[1] * sin(radians(b[0])), b[1] * cos(radians(b[0]))
# sum of cartesian vectors
s = a[0] + b[0], a[1] + b[1]
# back to polar with phi going clock-wise from north
r = sqrt(s[0] ** 2 + s[1] ** 2)
phi = (90 - degrees(atan2(s[1], s[0])) + 360) % 360
return phi, r |
The output vales do not have any units associated with them in SignalK. |
for the calculations these formulas should be used https://github.com/quantenschaum/mapping/blob/master/coursedata.py |
Math.cos (courseOverGroundTrue-headingMagnetic)
Should be difference of either true or magnetic (can't mix both)
The text was updated successfully, but these errors were encountered: