smashyanand / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Incorrect abs_press_gnd calibration #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Turn on APM and wait for it to initialize

What is the expected output? What do you see instead?
I expect that abs_press_gnd should fairly closely match APM_BMP085.Press 
directly following initialization; instead, it is smaller.

What version of the product are you using? On what operating system?
r887

Suggestion:
Change

abs_press_gnd = (abs_press_gnd * 9l + APM_BMP085.Press) / 10l;

to

abs_press_gnd = (abs_press_gnd * 9 + APM_BMP085.Press) / 10;

Original issue reported on code.google.com by bjpcalt...@gmail.com on 18 Sep 2010 at 12:26

GoogleCodeExporter commented 9 years ago
We do not bother to preload the filter, which would be an acceptable way to 
address this "problem".  Not sure why it is a problem because the filter will 
stabilize before you get in the air, won't it?  I can add code to address it if 
you can explain why it is a problem.

The code you propose is functionally the same as the current code.  Why would 
changing the constants from long integer to integer be of value?  It is a long 
integer calculation and result.

Original comment by dewei...@gmail.com on 18 Sep 2010 at 12:43

GoogleCodeExporter commented 9 years ago
The current code sets the new value of abs_press_gnd to 91% of its old value 
and 1% of the new value, so abs_press_gnd shrinks by 8% every iteration with 
constant APM_BMP085.Press.  With my change, it gets set to 90% its old value 
and 10% its new value, so it stays the same size with constant 
APM_BMP085.Press.  Another valid line would be

abs_press_gnd = (abs_press_gnd * 9l + APM_BMP085.Press) / 92;

Another would be

abs_press_gnd = (abs_press_gnd * 9l + APM_BMP085.Press * 10) / 10l;

The filter is preloaded before the 400 iterations though, so that's good.

Original comment by bjpcalt...@gmail.com on 18 Sep 2010 at 12:54

GoogleCodeExporter commented 9 years ago
Oh, totally my bad.  I read the lowercase L as a one.  Never mind.

Original comment by bjpcalt...@gmail.com on 18 Sep 2010 at 12:58

GoogleCodeExporter commented 9 years ago

Original comment by dewei...@gmail.com on 18 Sep 2010 at 2:54