Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

RTK GPS heading integration #497

Merged
merged 9 commits into from
Sep 18, 2018
Merged

RTK GPS heading integration #497

merged 9 commits into from
Sep 18, 2018

Conversation

priseborough
Copy link
Collaborator

@priseborough priseborough commented Aug 21, 2018

Overview

Added in response to PX4/PX4-Autopilot#10284

Requires PX4/PX4-Autopilot#10355

These changes add support for use of the GPS measured yaw data that is available here: https://github.com/PX4/Firmware/blob/master/msg/vehicle_gps_position.msg#L35

This data is derived from a dual antenna array which requires knowledge of the yaw angle of the antenna array to be able to utilise the data correctly due to the flipping of the yaw angle that occurs when the line that passes through both antennas goes through the vertical.

New yaw angle fusion and reset methods that takes the yaw offset of the antenna array into account have been added.

There is currently no accuracy estimate available for the GPS heading message data. This implementation uses the same yaw observation noise as set by the EKF2_HEAD_NOISE parameter.

Testing

Test with PX4/PX4-Autopilot#10355

Testing this branch requires settig EKF2_AID_MASK = 129 and EKF2_MAG_TYPE = 5. That will force the EKF to wait until GPS yaw is available before performing the yaw alignment. If EKF2_MAG_TYPE = 0, then the yaw will be set using the magnetomer intially and then reset to the GPS yaw when it becomes available.

Logs starting at boot or a minimum of 20 seconds prior to flight are required to test this feature using the replay facility.

@@ -0,0 +1,433 @@
/****************************************************************************
*
* Copyright (c) 2015 Estimation and Control Library (ECL). All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018 :)

@priseborough
Copy link
Collaborator Author

priseborough commented Aug 23, 2018

@bkueng I have doen some testing using the d9bc48f9-3270-4ff9-8141-c33a006f9f9d.ulg log file posted here: PX4/PX4-Autopilot#10284

The heading measurement is updated at a lower rate by the driver which is holding the last measurement for subsequent frames instead of setting the value to NAN. This results in repeated fusion of the same data and large innovation transients when the vehicle yaws:

screen shot 2018-08-24 at 7 46 15 am

Other than that issue, the fusion appears to be working as expected.

screen shot 2018-08-24 at 7 48 58 am

@priseborough
Copy link
Collaborator Author

Rebased and cleaned commit history. Have included a non-functional clean up change
3c483b9

@priseborough
Copy link
Collaborator Author

priseborough commented Aug 27, 2018

I will wait until PX4/PX4-Autopilot#10346 is merged and we can get some new log data for replay testing.

@LorenzMeier
Copy link
Member

@priseborough PX4/PX4-Autopilot#10346 is merged.

@priseborough
Copy link
Collaborator Author

PX4/PX4-Autopilot#10346 has been merged. This PR can now be tested using PX4/PX4-Autopilot#10355

@priseborough
Copy link
Collaborator Author

@bkueng Are you able to get another test log using PX4/PX4-Autopilot#10355?

The change to PX4/PX4-Autopilot#10355 requested by the reviewers changed the GPS uORB topic and the previous logs will no longer replay. Also it now includes the dual receiver support.

@bkueng
Copy link
Member

bkueng commented Sep 6, 2018

I probably won't go out testing this week again, but I can do it next week.

@priseborough
Copy link
Collaborator Author

priseborough commented Sep 12, 2018

Test log here: https://logs.px4.io/plot_app?log=9bdbab10-cb54-4f9d-85e6-0b53f338235a

Figure showing EKF yaw, GPS yaw and EKF yaw innovations:

screen shot 2018-09-13 at 7 58 36 am

Same figure from replay:

screen shot 2018-09-13 at 9 00 25 am

Same figure with heading_offset hard coded to correct value of radians(90) to replace 0 value in test log caused by PX4/Firmware bug fixed here
PX4/PX4-Autopilot@7d604fe

screen shot 2018-09-13 at 9 05 38 am

Effect of changing the heading_offset value was minimal in this example.

@priseborough
Copy link
Collaborator Author

@RomanBapst or @bresch Please complete review and approval / required changes when available.

The parameter used to control the maximum dead reckoning time had 'gps' in the parameter name which was confusing because it was used for all measurement types capable of constraining horizontal velocity error growth. The parameter variable has been renamed and the documentation for it improved.
The parameter used to control the maximum time since fusing a measurement before the measurement is considered to be not contributing to aiding had misleading documentation which has been updated.
Heading data is assumed to be from a  dual antenna array at a specified yaw angle offset in body frame, but with the heading data already corrected for antenna offset. The offset is required to apply the correct compensation for combined rotations and to determine when the yaw observation has become badly conditioned.
Double precision accuracy is not required for this operation.
@priseborough
Copy link
Collaborator Author

Rebased (clean, no conflicts).

@thomasgubler
Copy link

@RomanBapst @bresch please review and approve if good

RomanBapst
RomanBapst previously approved these changes Sep 18, 2018
Copy link
Contributor

@RomanBapst RomanBapst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priseborough Looks good in general, only minor comments.


if (resetGpsAntYaw()) {
// flag the yaw as aligned
_control_status.flags.yaw_align = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priseborough This is a duplicate, you have the same thing below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix

float PH[4];
_heading_innov_var = R_YAW;

for (unsigned row = 0; row <= 3; row++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priseborough Any reason you are using unsigned for the row but uint8_t for the col?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a hang over from early optimisation tests that showed slightly reduced execution times if the inner loop index type was unsigned instead of uint8_t.

healthy = false;

// update individual measurement health status
_fault_status.flags.bad_mag_hdg = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priseborough Technically the term 'mag_hdg' can be a bit confusing here, no? Not sure though if it's worth renaming it to just 'bad_hdg'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think thats worth doing now.

This flag now reports on  fusion of data that is not from a magnetometer.
@priseborough
Copy link
Collaborator Author

@RomanBapst Please review changes pushed in response to reviewer suggestions. TXS.

Copy link
Contributor

@RomanBapst RomanBapst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@priseborough priseborough merged commit f240eaa into master Sep 18, 2018
@priseborough priseborough deleted the pr-ekfGpsYaw branch September 18, 2018 20:35
@priseborough priseborough restored the pr-ekfGpsYaw branch October 17, 2018 10:51
@priseborough priseborough deleted the pr-ekfGpsYaw branch May 23, 2019 22:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants