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

EV_yaw: reset ev_to_ekf to identity when yaw is reset to EV #1016

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

bresch
Copy link
Member

@bresch bresch commented Jun 17, 2021

Otherwise, the old rotation matrix is used and not updated anymore because the EKF is fusing EV yaw data.

Note that this issue only occurs when MASK_ROTATE_EV and MASK_EV_YAW are set at the same time (because otherwise, if MASK_ROTATE_EV isn't set, the wrong rotation matrix is never used).

Explanation of the race condition:

  1. Initially, EV yaw fusion isn't active, the rotation matrix between the local frame (NED, initialized using mag) and EV frame is computed
  2. EV yaw starts, the yaw estimate is reset to the EV yaw
  3. During the fusion, if MASK_ROTATE_EV is set, the data is rotated using the rotation matrix computed in 1 (which is now wrong)
  4. Because EV yaw fusion is now active, the rotation matrix isn't updated anymore

Added a unit test that triggers the race condition above (fails without the fix).

Otherwise, the old rotation matrix is used and not updated anymore
because the EKF is fusing EV yaw data.
@bresch bresch requested review from priseborough and mhkabir June 17, 2021 12:54
@bresch bresch self-assigned this Jun 17, 2021
Copy link
Collaborator

@priseborough priseborough left a comment

Choose a reason for hiding this comment

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

I've run the test with and without the change to resetYawToEV() and verified it catches the bug.

@bresch bresch merged commit 611ace0 into master Jun 22, 2021
@bresch bresch deleted the pr-ev-yaw-reset-fix-upstream branch June 22, 2021 08:25
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.

2 participants