Skip to content

Baro offset calibration based on GNSS height#24859

Merged
haumarco merged 5 commits intomainfrom
pr-sensor_baro_gnss_calibration
Jun 2, 2025
Merged

Baro offset calibration based on GNSS height#24859
haumarco merged 5 commits intomainfrom
pr-sensor_baro_gnss_calibration

Conversation

@haumarco
Copy link
Copy Markdown
Contributor

Solved Problem

Account for baro offset between GNSS heigth and baro height from very beginning. Store it as offset, since its not a bias but a "fixed" value from the start.

Solution

When vehicle is still on the ground, GNSS-height gets fused and GNSS is selected as the height reference (EKF2_HGT_REF) then the baro pressure offset gets adjusted to match the GNSS height.

Test coverage

Tested on hardware

@haumarco haumarco requested a review from bresch May 15, 2025 14:02
@github-actions
Copy link
Copy Markdown

github-actions bot commented May 15, 2025

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 720 byte (0.04 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +720  +0.0%    +720    .text
  [NEW]    +536  [NEW]    +536    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
   +13%     +64   +13%     +64    sensors::VehicleAirData::VehicleAirData()
  +0.0%     +36  +0.0%     +36    g_cromfs_image
  +1.9%     +30  +1.9%     +30    do_not_explicitly_use_this_namespace::Param<>::update()
   +14%     +16   +14%     +16    px4::wq_configurations::lp_default
  +0.0%      +8  +0.0%      +8    [section .text]
  +0.1%      +8  +0.1%      +8    px4::parameters
  +4.5%      +8  +4.5%      +8    sensors::VehicleAirData::UpdateRelativeCalibrations()
  +4.7%      +8  +4.7%      +8    sensors::VehicleAirData::~VehicleAirData()
   +18%      +6   +18%      +6    sensors::VehicleAirData::updateParamsImpl()
  +4.8%      +4  +4.8%      +4    FlightTask
  +0.2%      +4  +0.2%      +4    px4::parameters_type
  -0.3%      -4  -0.3%      -4    sensors::VehicleAirData::Run()
  -0.4%      -4  -0.4%      -4    two_over_pi
+0.0%    +218  [ = ]       0    .debug_abbrev
+0.0%     +24  [ = ]       0    .debug_aranges
+0.0%    +168  [ = ]       0    .debug_frame
+0.0% +5.77Ki  [ = ]       0    .debug_info
+0.0% +1.08Ki  [ = ]       0    .debug_line
 -50.0%      -2  [ = ]       0    [Unmapped]
  +0.0% +1.08Ki  [ = ]       0    [section .debug_line]
+0.0%    +772  [ = ]       0    .debug_loclists
+0.0%    +108  [ = ]       0    .debug_rnglists
+0.0% +1.25Ki  [ = ]       0    .debug_str
+0.0%    +140  [ = ]       0    .strtab
   +23%     +16  [ = ]       0    ___ZN4uORB12DeviceMaster19getDeviceNodeLockedEPK12orb_metadatah_veneer
 -33.3%     -16  [ = ]       0    __nxsched_add_readytorun_veneer
  +2.0%     +86  [ = ]       0    do_not_explicitly_use_this_namespace::Param<>::update()
  [NEW]     +54  [ = ]       0    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
+0.0%     +80  [ = ]       0    .symtab
   +67%     +32  [ = ]       0    ___ZN4uORB12DeviceMaster19getDeviceNodeLockedEPK12orb_metadatah_veneer
 -40.0%     -32  [ = ]       0    __nxsched_add_readytorun_veneer
  +1.7%     +32  [ = ]       0    do_not_explicitly_use_this_namespace::Param<>::update()
  [NEW]     +48  [ = ]       0    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
  +100%     +16  [ = ]       0    sensors::VehicleAirData::updateParamsImpl()
  -7.7%     -16  [ = ]       0    uORB::SubscriptionCallback::registerCallback()
 +40% +3.30Ki  [ = ]       0    [Unmapped]
+0.0% +13.6Ki  +0.0%    +720    TOTAL

px4_fmu-v6x [Total VM Diff: 712 byte (0.04 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +712  +0.0%    +712    .text
  [NEW]    +536  [NEW]    +536    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
   +13%     +64   +13%     +64    sensors::VehicleAirData::VehicleAirData()
  +0.0%     +36  +0.0%     +36    g_cromfs_image
  +2.0%     +30  +2.0%     +30    do_not_explicitly_use_this_namespace::Param<>::update()
  +0.0%     +20  +0.0%     +20    [section .text]
  +0.1%      +8  +0.1%      +8    px4::parameters
  +4.5%      +8  +4.5%      +8    sensors::VehicleAirData::UpdateRelativeCalibrations()
  +4.7%      +8  +4.7%      +8    sensors::VehicleAirData::~VehicleAirData()
   +18%      +6   +18%      +6    sensors::VehicleAirData::updateParamsImpl()
  -0.3%      -4  -0.3%      -4    sensors::VehicleAirData::Run()
+0.0%    +218  [ = ]       0    .debug_abbrev
+0.0%     +24  [ = ]       0    .debug_aranges
+0.0%    +168  [ = ]       0    .debug_frame
+0.0% +5.68Ki  [ = ]       0    .debug_info
+0.0% +1.08Ki  [ = ]       0    .debug_line
 -33.3%      -2  [ = ]       0    [Unmapped]
  +0.0% +1.08Ki  [ = ]       0    [section .debug_line]
+0.0%    +820  [ = ]       0    .debug_loclists
+0.0%    +108  [ = ]       0    .debug_rnglists
+0.0% +1.25Ki  [ = ]       0    .debug_str
+0.0%    +140  [ = ]       0    .strtab
  +2.1%     +86  [ = ]       0    do_not_explicitly_use_this_namespace::Param<>::update()
  [NEW]     +54  [ = ]       0    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
+0.0%     +80  [ = ]       0    .symtab
  +1.8%     +32  [ = ]       0    do_not_explicitly_use_this_namespace::Param<>::update()
  [NEW]     +48  [ = ]       0    sensors::VehicleAirData::BaroGNSSAltitudeOffset()
  +100%     +16  [ = ]       0    sensors::VehicleAirData::updateParamsImpl()
  -7.7%     -16  [ = ]       0    uORB::SubscriptionCallback::registerCallback()
-10.5%    -712  [ = ]       0    [Unmapped]
+0.0% +9.53Ki  +0.0%    +712    TOTAL

Updated: 2025-05-27T15:29:53

@mrpollo mrpollo force-pushed the pr-sensor_baro_gnss_calibration branch from 17394df to 98ee6ae Compare May 16, 2025 17:06
@haumarco haumarco force-pushed the pr-sensor_baro_gnss_calibration branch from 98ee6ae to 7344cf0 Compare May 19, 2025 06:27
… is small enough and gnss data is consistent with baro
Copy link
Copy Markdown
Member

@bresch bresch left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise good to go!

bresch
bresch previously approved these changes May 27, 2025
@haumarco haumarco merged commit 8d3c94c into main Jun 2, 2025
69 checks passed
@haumarco haumarco deleted the pr-sensor_baro_gnss_calibration branch June 2, 2025 06:38
mrpollo pushed a commit that referenced this pull request Nov 24, 2025
* apply offset to baro sensors based on gnss measurements when gnss is selected as hgt-ref

* always calibrate baro with gnss if new param SENS_BAR_AUTOCAL is set accordingly

* always do baro-gnss calibration when AUTOCALIB is set, but ensure epv is small enough and gnss data is consistent with baro

* avoid update and reset in the same step

* minor change of constexpr usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants