mocap: wire up reset_counter, estimator_type, quality fields#2791
Open
alireza787b wants to merge 2 commits intomavlink:mainfrom
Open
mocap: wire up reset_counter, estimator_type, quality fields#2791alireza787b wants to merge 2 commits intomavlink:mainfrom
alireza787b wants to merge 2 commits intomavlink:mainfrom
Conversation
Replace hardcoded values with the corresponding proto fields added in mavlink/MAVSDK-Proto#395: - send_vision_position_estimate: use reset_counter field instead of hardcoded 0 (resolves the FIXME comment) - send_vision_speed_estimate: use reset_counter field instead of hardcoded 0 (resolves the FIXME comment) - send_odometry: use reset_counter, estimator_type, quality fields instead of hardcoded 0/MAV_ESTIMATOR_TYPE_MOCAP/0 Also fixes frame_id mapping: the proto MavFrame enum uses values that don't match MAVLink (0 instead of 14 for MOCAP_NED), so add a switch to map to correct MAVLink MAV_FRAME values. For backward compatibility, estimator_type defaults to MAV_ESTIMATOR_TYPE_MOCAP when set to UNKNOWN.
776d378 to
131e1b8
Compare
Match proto rename from MAVSDK-Proto PR mavlink#395 review feedback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JonasVautherin
approved these changes
Mar 11, 2026
Contributor
Author
|
Hi — just a note that the CI failures here are expected: this PR references Once #395 is merged and the proto submodule pointer is updated, the build should pass. Dependency chain:
Happy to rebase or address anything else in the meantime. |
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.
Problem
The Mocap plugin hardcodes several fields when packing MAVLink messages,
ignoring values that PX4's EKF2 can use for better sensor fusion:
send_vision_position_estimate:
send_vision_speed_estimate:
send_odometry:
Additionally,
static_cast<uint8_t>(odometry.frame_id)sends the proto enumvalue (0) instead of the MAVLink value (14 =
MAV_FRAME_MOCAP_NED), becausethe proto enum uses sequential values rather than MAVLink values.
Changes
Wire up
reset_counterinsend_vision_position_estimate— resolvesthe FIXME comment
Wire up
reset_counterinsend_vision_speed_estimate— resolvesthe FIXME comment
Wire up
reset_counter,estimator_type,qualityinsend_odometry— replaces all three hardcoded values with the proto fields
Fix frame_id mapping — add switch to map proto
MavFrameenum valuesto correct MAVLink
MAV_FRAMEconstants (14 for MOCAP_NED, 20 for LOCAL_FRD)Backward compatibility — when
estimator_typeisUNKNOWN(proto3 default),fall back to
MAV_ESTIMATOR_TYPE_MOCAPto preserve existing behaviorDependencies
tools/generate_from_protos.shto regenerate auto-generated codeRelated PRs
Testing
After proto submodule update:
Verified: all changes maintain backward compatibility — existing users who
don't set the new fields get identical MAVLink output (reset_counter=0,
estimator_type=MOCAP, quality=0, frame_id=MOCAP_NED).