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: reset position by fusion #23279

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

haumarco
Copy link
Contributor

@haumarco haumarco commented Jun 17, 2024

Solved Problem

When the external position reset gets triggered we can now fuse the new position as a "normal" measurement. Therefore the position error (estimate-position on map) gets included in the other states and mainly the wind can be better estimated. For large jumps we still reset the position to ensure we dont induce a really strong wind estimate.
Also adjusted the "set global origin" possibility before takeoff during GNSS denied conditions.

Alternatives

We could also, reset the position and fuse the "measurement" with a high variance. The estimated position would then perfectly align with the sent measurement position but the effects on the other states would not be as harsh for large position jumps (previous estimate / sent measurement).

@haumarco haumarco requested a review from bresch June 17, 2024 13:49
@dagar dagar added the EKF2 label Jun 17, 2024
@dagar
Copy link
Member

dagar commented Jun 17, 2024

Could you do this depending on the context (state of the filter, provided accuracy, etc) and then either use it as a correction if you can (with an appropriate gate), otherwise fallback to a hard position reset?

@haumarco haumarco force-pushed the pr-ekf2_reset_pos_by_fusion branch from 8318382 to c9197b2 Compare June 19, 2024 07:13
@haumarco haumarco force-pushed the pr-ekf2_reset_pos_by_fusion branch from c9197b2 to 1f8c15d Compare June 19, 2024 07:18
@haumarco haumarco force-pushed the pr-ekf2_reset_pos_by_fusion branch from 8e1a104 to c6634c6 Compare June 24, 2024 16:51
@haumarco haumarco requested a review from dagar June 24, 2024 16:52
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.h Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf_helper.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf_helper.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf_helper.cpp Outdated Show resolved Hide resolved
@haumarco haumarco force-pushed the pr-ekf2_reset_pos_by_fusion branch from fd4e113 to c5290d1 Compare June 27, 2024 08:18
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.h Outdated Show resolved Hide resolved
sfuhrer
sfuhrer previously approved these changes Jul 2, 2024
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.h Outdated Show resolved Hide resolved
@dagar dagar force-pushed the pr-ekf2_reset_pos_by_fusion branch from f383042 to 6c6660d Compare July 5, 2024 02:47
@haumarco
Copy link
Contributor Author

haumarco commented Jul 5, 2024

I added two things:

  1. When inertial dead reckoning is true, there was already no aid data for no_aid_timeout_max. Therefore we need to subtract the timeout from the _time_last_horizontal_aiding.

  2. In the beginning, the starting condition was satisfied for the fake-pos fusion becaue horizontal aiding time is exceeded. I added the _horizontal_deadreckon_time_exceeded to the continuing condition (now same as starting condition). This does not change the logic since isHorizontalAidingActive directly disables the fake pos as soon as there are any external measurements.

} else {
_time_last_horizontal_aiding = _time_delayed_us;
if (_time_delayed_us > _params.no_aid_timeout_max) {
_time_last_horizontal_aiding = _time_delayed_us - _params.no_aid_timeout_max;
Copy link
Member

Choose a reason for hiding this comment

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

Did you find this was still necessary? I didn't think it was because isTimedOut() is handling when it's zero and now checking the elapsed time without subtraction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Define necessary ;)
If we want that valid_timeout_max defines the maximum time where we're using inertial dead reckoning then yes. Because after the last measurement, the system is already dead reckoning with IMU data, but we only label it as such after no_aid_timeout_max, which is correct.

The question is:
Where does one define the starting point of the inertial dead reckoning? After the last sensor-measurement or after the last sensor timed out.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, we could probably change it to use the actual timestamps (but it hardly matters).

Copy link
Member

@dagar dagar left a comment

Choose a reason for hiding this comment

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

Needs testing, but otherwise looks good to go from my perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👀 In review/test
Development

Successfully merging this pull request may close these issues.

None yet

3 participants