Skip to content
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

Use course over ground as the default for fixed wing navigation "heading" #8529

Merged
merged 6 commits into from
Nov 22, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/navigation/navigation_pos_estimator.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ static void restartGravityCalibration(void)
}

static bool gravityCalibrationComplete(void)
{
{
if (!gyroConfig()->init_gyro_cal_enabled) {
return true;
}

return zeroCalibrationIsCompleteS(&posEstimator.imu.gravityCalibration);
}

Expand Down Expand Up @@ -774,8 +774,10 @@ static void publishEstimatedTopic(timeUs_t currentTimeUs)
{
static navigationTimer_t posPublishTimer;

/* IMU operates in decidegrees while INAV operates in deg*100 */
updateActualHeading(navIsHeadingUsable(), DECIDEGREES_TO_CENTIDEGREES(attitude.values.yaw));
/* IMU operates in decidegrees while INAV operates in deg*100
* Use GPS course over ground for fixed wing navigation yaw/heading when possible */
int16_t yawValue = isGPSHeadingValid() && STATE(AIRPLANE) ? gpsSol.groundCourse : attitude.values.yaw;
updateActualHeading(navIsHeadingUsable(), DECIDEGREES_TO_CENTIDEGREES(yawValue));

/* Position and velocity are published with INAV_POSITION_PUBLISH_RATE_HZ */
if (updateTimer(&posPublishTimer, HZ2US(INAV_POSITION_PUBLISH_RATE_HZ), currentTimeUs)) {
Expand Down