rosflight / rosflight_ros_pkgs

ROS packages for the ROSflight autopilot
http://rosflight.org/
BSD 3-Clause "New" or "Revised" License
86 stars 56 forks source link

Sensor calibration in presence of bad measurements #34

Closed drinkdhmo closed 6 years ago

drinkdhmo commented 6 years ago

The current scheme of sensor calibration that averages the first 100 samples from a sensor is susceptible to problems when a sensor outputs a few grossly bad measurements. This can pull the calibration way off.

I suggest we add some intelligence to the calibration to check if the samples collected are reasonable. For example, we could calculate the sample variance and reject the calibration if it is above some threshold.

superjax commented 6 years ago

We are actually doing this with the IMU already, just not with the baro or airspeed. As a pretty easy hack, I just check the max and min values, and if they are super far apart, then I say that the calibration didn't work.
sensors.cpp #L353

superjax commented 6 years ago

Thanks @drinkdhmo for fixing this.