mocap: wire up reset_counter, estimator_type, quality fields#2791
mocap: wire up reset_counter, estimator_type, quality fields#2791julianoes merged 1 commit intomavlink:mainfrom
Conversation
776d378 to
131e1b8
Compare
|
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. |
julianoes
left a comment
There was a problem hiding this comment.
I tried to merge this and it didn't compile, see comment mavlink/MAVSDK-Proto#395 (comment).
|
Hey Juliano, you are right. This branch is stale in its current form and the old dependency assumption was not enough. I re-checked the proto/C++/generation path end-to-end and I would rather replace this with clean current-main PRs than keep patching stale history here. I will prepare a small fresh MAVSDK-Proto PR first, then a regenerated MAVSDK follow-up that keeps the frame mapping in C++. Very happy to align with any suggestion on that split if you prefer a different sequencing. |
|
I've merged proto, you can now fix this up. |
7d65884 to
f2b9178
Compare
|
@alireza787b I've rebased this and fixed it up. Hopefully that works for you like that. I want to get this into the next v3 release, so I went ahead. |
…oto fields 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 - send_vision_speed_estimate: use reset_counter field instead of hardcoded 0 - send_odometry: use reset_counter, estimator_type, quality_percent fields instead of hardcoded 0/MAV_ESTIMATOR_TYPE_MOCAP/0 For backward compatibility, estimator_type defaults to MAV_ESTIMATOR_TYPE_MOCAP when set to Unknown. Co-authored-by: Julian Oes <julian@oes.ch>
f2b9178 to
45b295a
Compare
…quality_percent from proto fields (mavlink#2791)
…oto fields (mavlink#2791) 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 - send_vision_speed_estimate: use reset_counter field instead of hardcoded 0 - send_odometry: use reset_counter, estimator_type, quality_percent fields instead of hardcoded 0/MAV_ESTIMATOR_TYPE_MOCAP/0 For backward compatibility, estimator_type defaults to MAV_ESTIMATOR_TYPE_MOCAP when set to Unknown. Co-authored-by: alireza787b <alireza787b@gmail.com> Co-authored-by: Julian Oes <julian@oes.ch>
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:
cmake -Bbuild/default -S. -DBUILD_MAVSDK_SERVER=ON -DWERROR=ON cmake --build build/default -j$(nproc)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).