Skip to content

Conversation

ahmedmsalah99
Copy link

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.

@ahmedmsalah99
Copy link
Author

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:

EKF2_Pos_D EKF3_State_Values_Pos_D

@ahmedmsalah99
Copy link
Author

Currently now I added BARO_POS_* which accounts for 1 barometer only. Should I extend the work for all barometers possible ?

@@ -229,6 +229,13 @@ const AP_Param::GroupInfo AP_Baro::var_info[] = {
#endif
#endif // HAL_BARO_WIND_COMP_ENABLED

// @Param: BARO_POS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// @Param: BARO_POS
#if AP_BARO_POSITION_COMPENSATION_ENABLED
// @Param: BARO_POS

... this should be a zero-compiler-change output on 1MB boards. And definitely off on AP_Periph.

…OS_*. Add baro position offset variables BARO_POS_* in the barometer implementation.

Added correction for barometer offset in both EKF2 and EKF3.
…S_*. Add baro position offset variables BARO_POS_* in the barometer implementation.

Added correction for barometer offset in both EKF2 and EKF3.
…O_POS_*. Add baro position offset variables BARO_POS_* in the barometer implementation.

Added correction for barometer offset in both EKF2 and EKF3.
…O_POS_*. Add baro position offset variables BARO_POS_* in the barometer implementation.

Added correction for barometer offset in both EKF2 and EKF3.
…*. Add baro position offset variables BARO_POS_* in the barometer implementation.

Added correction for barometer offset in both EKF2 and EKF3.
@ahmedmsalah99 ahmedmsalah99 force-pushed the add_parometer_correction branch from b8352b8 to fa73650 Compare August 12, 2025 05:06
@ahmedmsalah99
Copy link
Author

@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) ?

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants