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

ekf2: relax preflight yaw check when possible #8424

Merged
merged 3 commits into from
Dec 8, 2017

Conversation

priseborough
Copy link
Contributor

When the EKF is not fusing in position or velocity observations in a global reference frame to constrain navigation errors, the tolerance to yaw errors is much higher. Examples of this include operation using only optical flow (which is in body frame) or operation without aiding where only attitude and height is estimated.

These changes will help reduce false triggering associated with indoor operation where magnetic interference and anomaly levels are high.

LorenzMeier
LorenzMeier previously approved these changes Dec 7, 2017
@LorenzMeier
Copy link
Member

Jenkins test this please

@LorenzMeier LorenzMeier added this to the Release v1.7.0 milestone Dec 7, 2017
float yaw_test_limit;
uint32_t control_mode = 0;
_ekf.get_control_mode(&control_mode);
bool doing_ne_aiding = (control_mode & (2 << 2)) // Using GPS
Copy link
Member

Choose a reason for hiding this comment

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

From the definition of the control status flag, this should be 1<<2. I suggest you introduce some variables for the masks, in the form of static constexpr uint32_t filter_control_status_u::gps_fused_mask = 1 << 2...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will rework to use the exisiting filter_control_status_u type and rebase.

@priseborough
Copy link
Contributor Author

@bkueng I have reworked it to use the exisiting filter_control_status_u type and rebased.

…te aiding

When the EKF is not fusing in observations from the NE global reference frame, the tolerance to yaw errors is much higher. This changes will prevent false triggering of the preflight fail check when operating indoors without GPS where mag field errors can be high.
Reduce max yaw error when not using global frame aiding data to prevent large yaw yaw changes after takeoff.
Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Thanks @priseborough. This works better.
I still get the 'EKF INTERNAL CHECKS` error when I have the vehicle on the desk right next to the laptop - but looking at the mag, there are definitely strong interferences in this location.

Here's a test log:
https://logs.px4.io/plot_app?log=7ed33794-2a63-4d98-a4b6-fb4f41fa7302

@@ -1264,9 +1267,24 @@ void Ekf2::run()
_vel_d_innov_lpf = beta * _vel_d_innov_lpf + alpha * constrain(innovations.vel_pos_innov[2],
-_vel_innov_spike_lim, _vel_innov_spike_lim);

// set the max allowed yaw innovaton depending on whether we are not aiding navigation using
// observations in the NE reference frame.
float yaw_test_limit;
Copy link
Member

Choose a reason for hiding this comment

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

Can you move the definition of filter_control_status_u _ekf_control_mask in here, to minimize its scope, since it's only used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@priseborough
Copy link
Contributor Author

priseborough commented Dec 7, 2017

I've looked at the log and the reasons for the pre-arm failure has two causes. One is a large transient magnetic yaw error produced when the vehicle is moved. The other is a large and persistent vertical innovation offset that exceeds the 1.5m tolerance and appears to be the result of a combination of sensor errors and previous movement.

screen shot 2017-12-08 at 8 59 39 am

Flying in a height control mode with this amount vertical innovation and the resulting vertical velocity error would produce unacceptable height variation after takeoff and prevent the vehicle from landing due to excessive vertical velocity offset.

@LorenzMeier LorenzMeier merged commit 324c515 into PX4:master Dec 8, 2017
@priseborough priseborough deleted the pr-preFltCheck branch December 10, 2017 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants