fix(mavlink): correct BODY_NED position setpoint parsing and bitmasks#27686
Open
PuRe-ToX wants to merge 4 commits into
Open
fix(mavlink): correct BODY_NED position setpoint parsing and bitmasks#27686PuRe-ToX wants to merge 4 commits into
PuRe-ToX wants to merge 4 commits into
Conversation
Previously, SET_POSITION_TARGET_LOCAL_NED messages using MAV_FRAME_BODY_NED with position-only or partial-velocity bitmasks were incorrectly rejected. This fix properly rotates body position offsets to local Earth coordinates and replaces the bitwise OR with AND for velocity/acceleration ignore masks.
Contributor
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 248 byte (0.01 %)]px4_fmu-v6x [Total VM Diff: 248 byte (0.01 %)]Updated: 2026-06-17T19:57:36 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, 'SET_POSITION_TARGET_LOCAL_NED' messages using 'MAV_FRAME_BODY_NED' with position-only or partial-velocity bitmasks were incorrectly rejected. This fix properly rotates body-position offsets to local Earth coordinates and replaces the bitwise OR with AND for the velocity/acceleration ignore masks.
Solved Problem
Fixes #27617
The current implementation of 'MavlinkReceiver::handle_message_set_position_target_local_ned' incorrectly rejects valid 'MAV_FRAME_BODY_NED' messages from companion computers.
Solution
Changelog Entry
Bugfix: MavlinkReceiver now correctly parses position-only and partial-velocity SET_POSITION_TARGET_LOCAL_NED messages in the BODY_NED frame.
###Alternatives
N/A. Without this fix, offboard companion computers cannot reliably use the BODY_NED frame for targeted positional movements or partial velocity vectors.
###Test coverage
Tested locally in PX4 SITL (Gazebo gz_x500). Wrote a custom PyMAVLink script to send position-only MAV_FRAME_BODY_NED messages with a type_mask ignoring velocity and acceleration.
Before: Firmware rejected the command with WARN [mavlink] SET_POSITION_TARGET_LOCAL_NED invalid.
After: Firmware successfully parsed the bitmask, transformed the position coordinates, and accepted the command silently without throwing warnings.
Context
This is highly relevant for edge-AI companion computers (such as the Jetson Nano) that attempt to send relative coordinate movements to the flight controller via MAVLink.