Skip to content

HomePosition: only set home position using GNSS if bit 0 in EKF2_GPS_CTRL is active#26378

Merged
mahima-yoga merged 1 commit intomainfrom
pr-home-position-gps-ctrl-check
Jan 30, 2026
Merged

HomePosition: only set home position using GNSS if bit 0 in EKF2_GPS_CTRL is active#26378
mahima-yoga merged 1 commit intomainfrom
pr-home-position-gps-ctrl-check

Conversation

@mahima-yoga
Copy link
Contributor

@mahima-yoga mahima-yoga commented Jan 29, 2026

Solved Problem

The home position was being set using raw GNSS data even when the vehicle position estimate did not use GNSS. See video:

Screencast.from.01-29-2026.02.29.37.PM.webm

Solution

If the vehicle position is not set by GNSS, then the home position should not be either. The proposed solutions checks whether vehicle horizontal position is using GNSS by checking if bit 0 is enabled in EKF2_GPS_CTRL.

Changelog Entry

For release notes:

Feature/Bugfix only set home position using GNSS if vehicle position also uses GNSS

Test coverage

Tested in SIH (log).

Screencast.from.01-29-2026.01.44.14.PM.webm

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 88 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +88  +0.0%     +88    .text
  [NEW]     +40  [NEW]     +40    HomePosition::isGpsHorizontalFusionEnabled()
  +0.0%     +24  +0.0%     +24    [section .text]
  +4.4%     +16  +4.4%     +16    HomePosition::HomePosition()
  +0.9%      +8  +0.9%      +8    HomePosition::update()
+0.0%     +49  [ = ]       0    .debug_abbrev
+0.0%      +8  [ = ]       0    .debug_aranges
+0.0%     +28  [ = ]       0    .debug_frame
+0.0%    +277  [ = ]       0    .debug_info
+0.0%     +74  [ = ]       0    .debug_line
 -80.0%      -4  [ = ]       0    [Unmapped]
  +0.0%     +78  [ = ]       0    [section .debug_line]
+0.0%     +17  [ = ]       0    .debug_loclists
+0.0%     +20  [ = ]       0    .debug_rnglists
  [NEW]      +2  [ = ]       0    [Unmapped]
  +0.0%     +18  [ = ]       0    [section .debug_rnglists]
+0.0%    +107  [ = ]       0    .debug_str
+0.8%      +2  [ = ]       0    .shstrtab
+0.0%     +50  [ = ]       0    .strtab
  [NEW]     +50  [ = ]       0    HomePosition::isGpsHorizontalFusionEnabled()
 -40.0%     -16  [ = ]       0    __hrt_call_enter_veneer
  +100%     +16  [ = ]       0    __memset_veneer
+0.0%     +32  [ = ]       0    .symtab
  [NEW]     +32  [ = ]       0    HomePosition::isGpsHorizontalFusionEnabled()
 -40.0%     -32  [ = ]       0    __hrt_call_enter_veneer
   +67%     +32  [ = ]       0    __memset_veneer
 -25.0%     -16  [ = ]       0    __nxsem_restore_baseprio_irq_veneer
   +50%     +16  [ = ]       0    __nxsig_pendingset_veneer
   +33%     +16  [ = ]       0    __pthread_mutex_lock_veneer
 -33.3%     -16  [ = ]       0    __uart_recvchars_veneer
-1.0%     -88  [ = ]       0    [Unmapped]
+0.0%    +664  +0.0%     +88    TOTAL

px4_fmu-v6x [Total VM Diff: 88 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +88  +0.0%     +88    .text
  [NEW]     +40  [NEW]     +40    HomePosition::isGpsHorizontalFusionEnabled()
  +0.0%     +20  +0.0%     +20    [section .text]
  +4.4%     +16  +4.4%     +16    HomePosition::HomePosition()
  +0.9%      +8  +0.9%      +8    HomePosition::update()
   +44%      +4   +44%      +4    g_nullstring
+0.0%     +49  [ = ]       0    .debug_abbrev
+0.0%      +8  [ = ]       0    .debug_aranges
+0.0%     +28  [ = ]       0    .debug_frame
+0.0%    +277  [ = ]       0    .debug_info
+0.0%     +82  [ = ]       0    .debug_line
  +133%      +4  [ = ]       0    [Unmapped]
  +0.0%     +78  [ = ]       0    [section .debug_line]
+0.0%     +17  [ = ]       0    .debug_loclists
+0.0%     +20  [ = ]       0    .debug_rnglists
  [NEW]      +2  [ = ]       0    [Unmapped]
  +0.0%     +18  [ = ]       0    [section .debug_rnglists]
+0.0%    +107  [ = ]       0    .debug_str
-0.8%      -2  [ = ]       0    .shstrtab
+0.0%     +50  [ = ]       0    .strtab
  [NEW]     +50  [ = ]       0    HomePosition::isGpsHorizontalFusionEnabled()
+0.0%     +32  [ = ]       0    .symtab
  [NEW]     +32  [ = ]       0    HomePosition::isGpsHorizontalFusionEnabled()
-1.3%     -88  [ = ]       0    [Unmapped]
+0.0%    +668  +0.0%     +88    TOTAL

Updated: 2026-01-30T09:41:22

@mahima-yoga mahima-yoga force-pushed the pr-home-position-gps-ctrl-check branch from 0f08cf3 to 0b7d53c Compare January 29, 2026 13:32
@mahima-yoga mahima-yoga marked this pull request as ready for review January 29, 2026 13:37
@mahima-yoga mahima-yoga force-pushed the pr-home-position-gps-ctrl-check branch from 768fcf0 to 53a50f3 Compare January 29, 2026 17:23
Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

Nice, looks clean.

@mahima-yoga mahima-yoga force-pushed the pr-home-position-gps-ctrl-check branch from 53a50f3 to 3bdd053 Compare January 30, 2026 09:23
…CTRL is active

If the vehicle position is not set by GNSS, then the home position should not be either.
@mahima-yoga mahima-yoga force-pushed the pr-home-position-gps-ctrl-check branch from 3bdd053 to 0f7a4db Compare January 30, 2026 09:23
@mahima-yoga mahima-yoga merged commit 4e59a06 into main Jan 30, 2026
71 of 74 checks passed
@mahima-yoga mahima-yoga deleted the pr-home-position-gps-ctrl-check branch January 30, 2026 10:20
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