1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1156 changed yaw math from interval [0..360] to [-180..180]

This commit is contained in:
Corvus Corax 2014-08-16 20:48:56 +02:00
parent d26d717d8c
commit 760ae118e9

View File

@ -420,12 +420,7 @@ static float updateTailInBearing()
TakeOffLocationData t;
TakeOffLocationGet(&t);
// atan2f always returns in between + and - 180 degrees
float yaw = RAD2DEG(atan2f(p.East - t.East, p.North - t.North));
// result is in between 0 and 360 degrees
if (yaw < 0.0f) {
yaw += 360.0f;
}
return yaw;
return RAD2DEG(atan2f(p.East - t.East, p.North - t.North));
}
/**
@ -437,12 +432,7 @@ static float updateCourseBearing()
VelocityStateGet(&v);
// atan2f always returns in between + and - 180 degrees
float yaw = RAD2DEG(atan2f(v.East, v.North));
// result is in between 0 and 360 degrees
if (yaw < 0.0f) {
yaw += 360.0f;
}
return yaw;
return RAD2DEG(atan2f(v.East, v.North));
}
/**
@ -462,12 +452,7 @@ static float updatePathBearing()
path_progress(&pathDesired, cur, &progress);
// atan2f always returns in between + and - 180 degrees
float yaw = RAD2DEG(atan2f(progress.path_vector[1], progress.path_vector[0]));
// result is in between 0 and 360 degrees
if (yaw < 0.0f) {
yaw += 360.0f;
}
return yaw;
return RAD2DEG(atan2f(progress.path_vector[1], progress.path_vector[0]));
}
/**