byu-magicc / rosplane

A basic fixed-wing autopilot for ROS - based on the textbook "Small Unmanned Aircraft: Theory and Practice" by Randy Beard and Tim McLain
100 stars 47 forks source link

Added gating for outlier rejection on diff_pressure measurements #41

Closed dallinbriggs closed 7 years ago

dallinbriggs commented 7 years ago

The airspeed sensor was returning a very negative differential pressure measurement sometimes. This would cause the airspeed to go really negative for a second. This will hopefully reject those outlier measurements.

diff_pres

dallinbriggs commented 7 years ago

Good point. I was just trying to follow the equations of the UAV book as closely as possible. 10 is m/s. So if you see anything greater than a change of 10 m/s from your last measurement, it's probably an outlier. It seemed to eliminate the outlier measurements without affecting the valid measurements. I can make that a #define. pow(speed, 2) is just following the formula from the book.

gellings commented 7 years ago

@superjax just pushed some stuff to github.com/rosflight/firmware/pull/221 that fixed a barometer error, any chance it will make this PR unnecessary? What do you think @dallinbriggs?

superjax commented 7 years ago

I don't think that fix will solve this PR. Those fixes mainly address an idiotic bug that I introduced in a previous PR. ( I was trying to update the barometer at something like 3000Hz and it was hanging the I2C peripheral on us because it couldn't keep up)

I think it might be solvable on the firmware side of things, but it's a tricky bug - I'm pretty sure that it's incorrectly indexing a 3-byte array as the bits come back from the barometer. I can't be sure though. I would need to spend some quality time with a saelae. In the meantime, it's super easy to detect and I'm not certain that it is possible to fix entirely, so I think that that PR is completely valid, especially with how significant these outliers could potentially be.

dallinbriggs commented 7 years ago

Correct. @superjax 's fixes don't fix this issue. I'm still working on cleaning up this code though.

gellings commented 7 years ago

This stuff was merged in through cherry-picking the commit from the tuning_mode branch 2c3a7dc. Thanks for resolving the conflict!