Skip to content

Mavlink: GLOBAL_POSITION for aux positioning#26307

Merged
haumarco merged 5 commits intomainfrom
mavlink_global_position
Feb 27, 2026
Merged

Mavlink: GLOBAL_POSITION for aux positioning#26307
haumarco merged 5 commits intomainfrom
mavlink_global_position

Conversation

@haumarco
Copy link
Copy Markdown
Contributor

@haumarco haumarco commented Jan 20, 2026

This PR is part of the split up of #26151

Solved Problem

There was no MAVLink interface to inject auxiliary global position data into PX4. External systems using MAVLink (instead of ROS2/DDS) could not provide alternative positioning sources for EKF2 fusion.

Solution

This PR adds MAVLink GLOBAL_POSITION_SENSOR message support (see mavlink/mavlink#2422, mavlink/mavlink#2423):

  1. Incoming message handler (mavlink_receiver.cpp)

    • Converts GLOBAL_POSITION_SENSOR MAVLink message to aux_global_position uORB topic
    • Maps id and source fields for multi-instance support
    • Publishes via PublicationMulti for multi-instance routing
  2. Outgoing stream (streams/GLOBAL_POSITION_SENSOR.hpp)

    • Streams aux_global_position uORB topic as GLOBAL_POSITION_SENSOR MAVLink message
    • Supports multiple instances via SubscriptionMultiArray
  3. MAVLink submodule update

    • Bumped to include GLOBAL_POSITION_SENSOR in common.xml

Changelog Entry

For release notes:

Feature: MAVLink GLOBAL_POSITION_SENSOR message support for auxiliary positioning
- Receive: GLOBAL_POSITION_SENSOR messages published to aux_global_position uORB topic
- Send: GLOBAL_POSITION_SENSOR stream uses aux_global_position topic with multi-instance support

Test coverage

Tested by sending GLOBAL_POSITION_SENSOR messages via MAVLink and verifying they appear on the aux_global_position uORB topic.

- Add handler for incoming GLOBAL_POSITION MAVLink messages
- Publish received positions to aux_global_position uORB topic
- Update GLOBAL_POSITION stream to use aux_global_position topic
@haumarco haumarco force-pushed the mavlink_global_position branch from 5cbb17d to 1ad8cf5 Compare February 25, 2026 17:38
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 25, 2026

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 888 byte (0.04 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +888  +0.0%    +888    .text
  [NEW]    +240  [NEW]    +240    MavlinkStreamGlobalPositionSensor::send()
  [NEW]    +184  [NEW]    +184    MavlinkReceiver::handle_message_global_position_sensor()
  [NEW]    +136  [NEW]    +136    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +60  [NEW]     +60    CSWTCH.1946
  [NEW]     +60  [NEW]     +60    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
  +0.9%     +48  +0.9%     +48    Mavlink::configure_streams_to_default()
  [NEW]     +48  [NEW]     +48    MavlinkStreamGlobalPositionSensor
  [NEW]     +44  [NEW]     +44    CSWTCH.2731
 -99.3%     +38 -99.3%     +38    [9 Others]
  +0.0%     +36  +0.0%     +36    [section .text]
  [NEW]     +34  [NEW]     +34    MavlinkStreamGlobalPositionSensor::get_size()
  +2.9%     +32  +2.9%     +32    MavlinkReceiver::handle_message()
  +1.4%     +32  +1.4%     +32    _GLOBAL__sub_I_mavlink_system
  [NEW]     +14  [NEW]     +14    CSWTCH.3490
  [NEW]     +14  [NEW]     +14    CSWTCH.3491
  +0.9%     +12  +0.9%     +12    MavlinkReceiver::MavlinkReceiver()
  -2.0%     -12  -2.0%     -12    MavlinkReceiver::CheckHeartbeats()
  [DEL]     -14  [DEL]     -14    CSWTCH.3460
  [DEL]     -14  [DEL]     -14    CSWTCH.3461
  [DEL]     -44  [DEL]     -44    CSWTCH.2712
  [DEL]     -60  [DEL]     -60    CSWTCH.1932
+0.0%     +55  [ = ]       0    .debug_abbrev
+0.0%     +64  [ = ]       0    .debug_aranges
+0.1%    +248  [ = ]       0    .debug_frame
+0.0% +4.57Ki  [ = ]       0    .debug_info
+0.0% +1.44Ki  [ = ]       0    .debug_line
  +100%      +2  [ = ]       0    [Unmapped]
  +0.0% +1.43Ki  [ = ]       0    [section .debug_line]
+0.0% +1.12Ki  [ = ]       0    .debug_loclists
+0.0%    +265  [ = ]       0    .debug_rnglists
  [NEW]      +1  [ = ]       0    [Unmapped]
  +0.0%    +264  [ = ]       0    [section .debug_rnglists]
+0.1% +2.58Ki  [ = ]       0    .debug_str
+0.1%    +508  [ = ]       0    .strtab
  [DEL]     -12  [ = ]       0    CSWTCH.1932
  [NEW]     +12  [ = ]       0    CSWTCH.1946
  [DEL]     -12  [ = ]       0    CSWTCH.2712
  [NEW]     +12  [ = ]       0    CSWTCH.2731
  [DEL]     -24  [ = ]       0    CSWTCH.3460
  [DEL]     -24  [ = ]       0    CSWTCH.3461
  [NEW]     +24  [ = ]       0    CSWTCH.3490
  [NEW]     +24  [ = ]       0    CSWTCH.3491
  [NEW]     +81  [ = ]       0    MavlinkReceiver::handle_message_global_position_sensor()
  [NEW]     +40  [ = ]       0    MavlinkStreamGlobalPositionSensor
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_id()
  [NEW]     +51  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_name()
  [NEW]     +50  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_size()
  [NEW]     +63  [ = ]       0    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +46  [ = ]       0    MavlinkStreamGlobalPositionSensor::send()
  [NEW]    +129  [ = ]       0    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
   +84%     +16  [ = ]       0    __param_get_veneer
 -38.1%     -16  [ = ]       0    __perf_set_elapsed_veneer
+0.1%    +400  [ = ]       0    .symtab
  [DEL]     -32  [ = ]       0    CSWTCH.1932
  [NEW]     +32  [ = ]       0    CSWTCH.1946
  [DEL]     -32  [ = ]       0    CSWTCH.2712
  [NEW]     +32  [ = ]       0    CSWTCH.2731
  [DEL]     -48  [ = ]       0    CSWTCH.3460
  [DEL]     -48  [ = ]       0    CSWTCH.3461
  [NEW]     +48  [ = ]       0    CSWTCH.3490
  [NEW]     +48  [ = ]       0    CSWTCH.3491
 -16.7%     -16  [ = ]       0    ManualControlSelector::isInputValid()
  [NEW]     +48  [ = ]       0    MavlinkReceiver::handle_message_global_position_sensor()
  +100%     +16  [ = ]       0    MavlinkStreamESCStatus::update_data()
  [NEW]     +32  [ = ]       0    MavlinkStreamGlobalPositionSensor
  [NEW]     +16  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_id()
  [NEW]     +64  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_name()
  [NEW]     +32  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_size()
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::send()
  [NEW]     +96  [ = ]       0    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
 -33.3%     -16  [ = ]       0    MavlinkStreamStatustext::get_size()
  +100%     +16  [ = ]       0    MavlinkULog::start_ack_received()
 -99.9%     +16  [ = ]       0    [4 Others]
-9.9%    -888  [ = ]       0    [Unmapped]
+0.0% +11.2Ki  +0.0%    +888    TOTAL

px4_fmu-v6x [Total VM Diff: 880 byte (0.05 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +880  +0.0%    +880    .text
  [NEW]    +240  [NEW]    +240    MavlinkStreamGlobalPositionSensor::send()
  [NEW]    +184  [NEW]    +184    MavlinkReceiver::handle_message_global_position_sensor()
  [NEW]    +136  [NEW]    +136    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +60  [NEW]     +60    CSWTCH.1946
  [NEW]     +60  [NEW]     +60    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
  +0.9%     +48  +0.9%     +48    Mavlink::configure_streams_to_default()
  [NEW]     +48  [NEW]     +48    MavlinkStreamGlobalPositionSensor
  [NEW]     +44  [NEW]     +44    CSWTCH.2731
 -99.3%     +38 -99.3%     +38    [9 Others]
  [NEW]     +34  [NEW]     +34    MavlinkStreamGlobalPositionSensor::get_size()
  +2.9%     +32  +2.9%     +32    MavlinkReceiver::handle_message()
  +1.4%     +32  +1.4%     +32    _GLOBAL__sub_I_mavlink_system
  +0.0%     +28  +0.0%     +28    [section .text]
  [NEW]     +14  [NEW]     +14    CSWTCH.3490
  [NEW]     +14  [NEW]     +14    CSWTCH.3491
  +0.9%     +12  +0.9%     +12    MavlinkReceiver::MavlinkReceiver()
  -2.0%     -12  -2.0%     -12    MavlinkReceiver::CheckHeartbeats()
  [DEL]     -14  [DEL]     -14    CSWTCH.3460
  [DEL]     -14  [DEL]     -14    CSWTCH.3461
  [DEL]     -44  [DEL]     -44    CSWTCH.2712
  [DEL]     -60  [DEL]     -60    CSWTCH.1932
+0.0%     +55  [ = ]       0    .debug_abbrev
+0.0%     +64  [ = ]       0    .debug_aranges
+0.1%    +248  [ = ]       0    .debug_frame
+0.0% +4.57Ki  [ = ]       0    .debug_info
+0.0% +1.44Ki  [ = ]       0    .debug_line
  +200%      +2  [ = ]       0    [Unmapped]
  +0.0% +1.43Ki  [ = ]       0    [section .debug_line]
+0.0% +1.10Ki  [ = ]       0    .debug_loclists
+0.0%    +267  [ = ]       0    .debug_rnglists
  [NEW]      +3  [ = ]       0    [Unmapped]
  +0.0%    +264  [ = ]       0    [section .debug_rnglists]
+0.1% +2.58Ki  [ = ]       0    .debug_str
+0.1%    +508  [ = ]       0    .strtab
  [DEL]     -12  [ = ]       0    CSWTCH.1932
  [NEW]     +12  [ = ]       0    CSWTCH.1946
  [DEL]     -12  [ = ]       0    CSWTCH.2712
  [NEW]     +12  [ = ]       0    CSWTCH.2731
  [DEL]     -24  [ = ]       0    CSWTCH.3460
  [DEL]     -24  [ = ]       0    CSWTCH.3461
  [NEW]     +24  [ = ]       0    CSWTCH.3490
  [NEW]     +24  [ = ]       0    CSWTCH.3491
  [NEW]     +81  [ = ]       0    MavlinkReceiver::handle_message_global_position_sensor()
  [NEW]     +40  [ = ]       0    MavlinkStreamGlobalPositionSensor
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_id()
  [NEW]     +51  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_name()
  [NEW]     +50  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_size()
  [NEW]     +63  [ = ]       0    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +46  [ = ]       0    MavlinkStreamGlobalPositionSensor::send()
  [NEW]    +129  [ = ]       0    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
+0.1%    +400  [ = ]       0    .symtab
  [DEL]     -32  [ = ]       0    CSWTCH.1932
  [NEW]     +32  [ = ]       0    CSWTCH.1946
  [DEL]     -32  [ = ]       0    CSWTCH.2712
  [NEW]     +32  [ = ]       0    CSWTCH.2731
  [DEL]     -48  [ = ]       0    CSWTCH.3460
  [DEL]     -48  [ = ]       0    CSWTCH.3461
  [NEW]     +48  [ = ]       0    CSWTCH.3490
  [NEW]     +48  [ = ]       0    CSWTCH.3491
  [NEW]     +48  [ = ]       0    MavlinkReceiver::handle_message_global_position_sensor()
 -16.7%     -16  [ = ]       0    MavlinkReceiver::handle_messages_in_gimbal_mode()
  +100%     +16  [ = ]       0    MavlinkStreamESCStatus::update_data()
  [NEW]     +32  [ = ]       0    MavlinkStreamGlobalPositionSensor
  [NEW]     +16  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_id()
  [NEW]     +64  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_name()
  [NEW]     +32  [ = ]       0    MavlinkStreamGlobalPositionSensor::get_size()
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::new_instance()
  [NEW]     +48  [ = ]       0    MavlinkStreamGlobalPositionSensor::send()
  [NEW]     +96  [ = ]       0    MavlinkStreamGlobalPositionSensor::~MavlinkStreamGlobalPositionSensor()
 -33.3%     -16  [ = ]       0    MavlinkStreamStatustext::get_size()
  +100%     +16  [ = ]       0    MavlinkULog::start_ack_received()
 -99.9%     +16  [ = ]       0    [2 Others]
-12.0%    -880  [ = ]       0    [Unmapped]
+0.0% +11.2Ki  +0.0%    +880    TOTAL

Updated: 2026-02-27T06:59:09

@haumarco haumarco requested a review from sfuhrer February 26, 2026 08:45
Comment thread src/modules/mavlink/mavlink_receiver.cpp Outdated
Comment thread src/modules/mavlink/mavlink_receiver.h
@haumarco haumarco enabled auto-merge (squash) February 27, 2026 16:50
@haumarco haumarco merged commit fab9874 into main Feb 27, 2026
75 checks passed
@haumarco haumarco deleted the mavlink_global_position branch February 27, 2026 16:50
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