-
Notifications
You must be signed in to change notification settings - Fork 4
Added a complementary filter to rangefinder data (for 3.6) #149
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
base: mttr-rebase-3.6.7
Are you sure you want to change the base?
Conversation
@tridge Flight logs will be uploaded later today. |
afb13f3
to
27f1e2f
Compare
I've added a slew to the complementary filter cutoff frequency when in loiter (time wait on a waypoint) in auto mode. The time constant goes from 0.5Hz in normal flight down to 0.05Hz when in the loiter. |
The slew of the cutoff is working well for when we change from a higher cutoff to a lower cutoff, but is producing a nasty artefact when slewing from lower cutoff frequency to higher. Flight test results are good, but only because we happen to not be using the output of the complementary filter during the period where the artefact happens. In the above:
As you can see, we get an artefact in RF2.Out when we finish a position hold at a waypoint and move to normal flight. We don't get the artefact when we move the other way. Possible solutions:
|
this should reduce the impact of noise in the rangefinder data
slew the time constant of the filter when in a loiter towards a much longer time constant to avoid long period noise from the rangefinder
this prevents a numercial error on increase in filter cutoff frequency
27f1e2f
to
900e56f
Compare
/* | ||
return the current value | ||
*/ | ||
float ComplementaryFilter::get(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tridge is there any reason not to define get
(and set_cutoff_frequency
) in the header?
don't input invalid data into the filter, allowing it to reset if data is more than 1s old
This adds a 2 pole complementary filter to rangefinder data. The low frequency component is from the rangefinder and the high frequency is from the inertial altitude (the main EKF). The cutover frequency is set to 0.25Hz.

Here is an example in SITL:
in this case we've added a 0.6Hz sinusoidal noise source to the rangefinder. The red line is the rangefinder reading (low frequency input). The green line is the INS reading (high frequency). The resulting output is the blue line. The noise has been reduced by a factor of 5x.
The 0.25Hz cutover does mean we will respond more slowly to changing rangefinder conditions. We can add this as a tunable parameter if needed.