AP_Baro: support for barometer position compensation
Addressing: #30727
Added baro position offset simulation and variables SIM_BARO_POS_. Added baro position offset variables BARO_POS_ in the barometer implementation.
Added correction for barometer offset in both EKF2 and EKF3.
Test:
After launching a plane SITL simulation with a normal mission
wp load ../Tools/autotest/Generic_Missions/CMAC-circuit.txt
param set SIM_BARO_POS_X 60 param set SIM_BARO_POS_Y 60 param set SIM_BARO_POS_Z 10
mode auto arm throttle
then mid flight set BARO_POS_* to same values as above
results for EKF2 and EKF3 show big fluctuations in estimation when compensation variables are not set correctly which is corrected when the parameters are set:
Currently now I added BARO_POS_* which accounts for 1 barometer only. Should I extend the work for all barometers possible ?
@peterbarker I added the if condition and the variable in the baro configurations. Should I add the if statement to every change in the code related to the compensation too (EKF2 and EKF3 code) ?
@Williangalvani will be interested in this
@peterbarker I didn't work with the testing part before. The EKF3 algorithm accounts for height offset with fusion so it's hard to see the effect immediately. Instead the effect shows well with big offset + plane turns.
Normal baro with no offset or with offset + compensation in turning
Baro with offset and no compensation:
This maybe tricky to test (or not, IDK).
There was also a small logic error which I fixed