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

Pr wind est work queue #9079

Merged
merged 17 commits into from
Mar 21, 2018
Merged

Pr wind est work queue #9079

merged 17 commits into from
Mar 21, 2018

Conversation

RomanBapst
Copy link
Contributor

@RomanBapst RomanBapst commented Mar 14, 2018

This is a replacement of #9041 and implements the standalone wind and airspeed scale factor estimator as a work queue. Previously, the estimator was living in the sensors module which did not really make sense.

Advantages:

  • the estimator is now a separate module and can be run only for VTOL and fixed wing configs
  • we can extend this module to take data of multiple airspeed sensors and run multiple estimators and then use this information for airspeed failure detection

Disadvantages:

  • we have some overhead in terms of memory due to the work queue and the fact that we need to subscribe to three topics, one of them is local_position which is rather large

@dagar @priseborough FYI

@RomanBapst RomanBapst mentioned this pull request Mar 14, 2018
/* schedule a cycle to start things */
work_queue(LPWORK, &_work, (worker_t)&WindEstimatorModule::cycle_trampoline, nullptr, 0);

// wait until task is up & running (the mode_* commands depend on it)
Copy link
Member

Choose a reason for hiding this comment

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

(the mode_* commands depend on it) can be removed

static int print_usage(const char *reason = nullptr);

/**
* run the main loop: if running as task, continuously iterate, otherwise execute only one single cycle
Copy link
Member

Choose a reason for hiding this comment

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

This comment is incorrect as well

@RomanBapst RomanBapst force-pushed the pr-wind-est-work-queue branch from 52f3cc2 to aecf5c6 Compare March 14, 2018 14:45
@dagar
Copy link
Member

dagar commented Mar 14, 2018

Disadvantages:

we have some overhead in terms of memory due to the work queue and the fact that we need to subscribe to three topics, one of them is local_position which is rather large

The work queue should be a slight improvement. Previously in sensors you were keeping copies of local_position, attitude, airspeed in the sensors object, and updating the subscriptions constantly (sensors task usually running at 250 Hz). Now you only pay for it during each iteration of the wind estimator at a significantly lower rate.

@RomanBapst
Copy link
Contributor Author

@PX4/testflights Could you please give this a test flight, preferably when it's windy.
Thanks!

@RomanBapst
Copy link
Contributor Author

@PX4/testflights I forgot to mention that you can't test it on fmu-v2 due to lacking flash space.

@RomanBapst RomanBapst force-pushed the pr-wind-est-work-queue branch from 85c9c33 to a6ca4bd Compare March 15, 2018 08:43
@r0gelion
Copy link
Contributor

@RomanBapst our FW has a fmu-v3 (Pixhawk mini). It's a rainy day, but as soon as the weather allows it we will test it.

Regards.

@dagar
Copy link
Member

dagar commented Mar 16, 2018

Merge the ECL side and update this PR?

@r0gelion
Copy link
Contributor

@RomanBapst @dagar Is this ready for flight testing?

@RomanBapst
Copy link
Contributor Author

@r0gelion It's good that you ask, no this is not ready. I just came back from a test flight and there seems to be a problem with the work queue which i need to discuss with @dagar
I'll ping you as soon as we solve it.

@dagar
Copy link
Member

dagar commented Mar 21, 2018

The issue here was mixing different work queues for the initial and repeated cycles. See #9122

@RomanBapst
Copy link
Contributor Author

@dagar Thanks! I just tested it and it works fine now. Below are the results of the wind estimate using only sideslip fusion (no airspeed data).

These were the forecasted wind conditions at the time of the test flight:
wind: NE direction @ 10 knots (5.1 m/s)
windy_zurich

Luckily there was a wind sock near the flying field which confirmed the wind coming out of NE.
The big building to the left of the wind sock lies roughly in north direction.

whatsapp image 2018-03-21 at 11 09 41 am

Results of the estimator when flying circles:

Wind component estimate and absolute value:

wind_estimator_beta

Sideslip innovation & innovation standard deviation
wind_sideslip_innov

Ground speed and vehicle heading
wind_groundspeed

The absolute value estimate of 5 m/s seems quite accurate and also the wind components suggest wind out of Northeast, North-northeast.
Two separate test flight were conducted and the results of both were similar:

https://logs.px4.io/plot_app?log=a842cef4-03f8-4722-92db-6bf38f7d7788
https://logs.px4.io/plot_app?log=46e98042-87c9-4117-9f8f-fe4536ff7ca6

@RomanBapst RomanBapst force-pushed the pr-wind-est-work-queue branch from c4d460a to baf1ffa Compare March 21, 2018 11:20
@dagar
Copy link
Member

dagar commented Mar 21, 2018

For reference here's what it looks like running in the low priority work queue (first log).

image

Which means that the cycle is being called every 101317us on average (~ 10Hz), and average runtime for each cycle is 159 microseconds. The rate skews a bit because the end of every cycle after the filter update schedules another 100 ms later.

@RomanBapst RomanBapst force-pushed the pr-wind-est-work-queue branch from baf1ffa to 989934d Compare March 21, 2018 17:04
@dagar
Copy link
Member

dagar commented Mar 21, 2018

Update ecl to current master and this should be good to go.

- if it's not estimating wind it won't publish it below (was fixed)

Signed-off-by: Roman <[email protected]>
- need to make some flash space for fmuv2 to avoid user confusion about
why it wind estimator only runs on some platforms

Signed-off-by: Roman <[email protected]>
@RomanBapst RomanBapst force-pushed the pr-wind-est-work-queue branch from 009cde4 to 697bfc3 Compare March 21, 2018 17:32
@RomanBapst RomanBapst merged commit e504dc8 into master Mar 21, 2018
@RomanBapst RomanBapst deleted the pr-wind-est-work-queue branch March 21, 2018 17:47
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.

4 participants