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 split output predictor and publish attitude immediately #9832

Merged
merged 2 commits into from
Jul 8, 2018

Conversation

dagar
Copy link
Member

@dagar dagar commented Jul 3, 2018

Requires PX4/PX4-ECL#471

The EKF is updated to run the output predictor immediately after receiving new IMU data. Then PX4 side we publish vehicle_attitude immediately, and only publish positions at the EKF predication rate (every 8 milliseconds).

@dagar dagar requested a review from priseborough July 3, 2018 21:09
@LorenzMeier
Copy link
Member

@bkueng @RomanBapst Would be great if you could review & quickly flight-test.

@dagar
Copy link
Member Author

dagar commented Jul 3, 2018

This lowers EKF2 cpu usage as well as other modules like position controllers driven by position publications.

@dagar dagar force-pushed the pr-ekf_imu_update branch 2 times, most recently from 5250b07 to bf58ed4 Compare July 4, 2018 02:53
_ekf.get_control_mode(&control_status.value);

// only publish position after successful alignment
if (control_status.flags.tilt_align && control_status.flags.yaw_align) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should only be gated on tilt align. yaw alignment can momentarily go false.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, I'll change it. Currently it's both in master. https://github.com/PX4/ecl/blob/b26c2d62b80d6bee148fbfe01eb36809bfa721ea/EKF/ekf.cpp#L134

@dagar dagar force-pushed the pr-ekf_imu_update branch from e63d5f3 to 05b3cd3 Compare July 4, 2018 13:32
@priseborough
Copy link
Contributor

Replay testing is showing PX4/PX4-ECL#471 giving larger logged output observer tracking errors than ecl master so I will investigate further.

@priseborough
Copy link
Contributor

@dagar has fixed the difference so it should now be good to flight test provided we use PX4/PX4-ECL#471 at commit aaff047e5852761f8d15bc695c7a1ca70beeeeb1

@dagar dagar force-pushed the pr-ekf_imu_update branch from 05b3cd3 to 0356846 Compare July 4, 2018 17:25
@dagar dagar changed the title [WIP] EKF2 split output predictor and publish attitude immediately EKF2 split output predictor and publish attitude immediately Jul 4, 2018
@dagar dagar requested a review from a team July 4, 2018 17:35
@r0gelion
Copy link
Contributor

r0gelion commented Jul 4, 2018

@priseborough @dagar px4/ecl commit aaff047e5852761f8d15bc695c7a1ca70beeeeb1 hasn't been merged yet, do we need to wait for that commit to be merged or can we test this pull request as it is right now? we use to download the firmware from Jenkins artifacts.

@dagar
Copy link
Member Author

dagar commented Jul 4, 2018

Yes in this case it's okay to use the artifacts directly from Jenkins, but it was a good thing to check when other submodules are involved.

Copy link
Contributor

@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.

Code review complete.

Awaiting flight test

@dagar
Copy link
Member Author

dagar commented Jul 5, 2018

For reference here's a close comparison from master (same vehicle, same flightplan, same day).
Master: https://logs.px4.io/plot_app?log=33cff20f-ef72-44ff-ba9d-440e26f352a0
PR: https://logs.px4.io/plot_app?log=74ad4749-0a4b-4617-b2ee-c7e08194524f

CPU usage before
image

CPU usage after
image

@mhkabir
Copy link
Member

mhkabir commented Jul 5, 2018

Wow!

@dannyfpv
Copy link

dannyfpv commented Jul 6, 2018

@priseborough priseborough merged commit 850b1ad into master Jul 8, 2018
@priseborough priseborough deleted the pr-ekf_imu_update branch July 8, 2018 22:13
sfalexrog pushed a commit to sfalexrog/Firmware that referenced this pull request Apr 7, 2019
* EKF2 split output predictor and publish attitude immediately

* ecl: incorporate magic number tidy up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants