feat(ekf2): publish acceleration in VehicleOdometry#26944
Open
feat(ekf2): publish acceleration in VehicleOdometry#26944
Conversation
174d8cc to
b1fe920
Compare
Changes:
extend VehicleOdometry.msg to v1 with float32[3] acceleration in NED,
defined as the derivative of NED velocity averaged over the odometry
publish interval
read _ekf.getVelocityDerivative() once in EKF2::Run(), pass it to
PublishLocalPosition() and PublishOdometry(), and reset the
accumulation once after both publishers consume it
archive VehicleOdometryV0.msg in px4_msgs_old and add
VehicleOdometryV1Translation to translation_node
preserve ROS 2 interoperability between v0 and v1 clients:
v0 -> v1 fills acceleration with NaN, and v1 -> v0 drops it
This avoids mixed-rate aliasing or double consumption of the velocity derivative and enables one clean message with everything control theorists need for their work.
Tested:
make px4_sitl_default -j4
colcon build --packages-select px4_msgs
colcon build --packages-select px4_msgs_old translation_node
colcon test --packages-select translation_node --ctest-args -R translation_node_unit_tests
Signed-off-by: evannsmc <evannsmcuadrado@gmail.com>
b1fe920 to
8ffa2c1
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 120 byte (0.01 %)]px4_fmu-v6x [Total VM Diff: 120 byte (0.01 %)]Updated: 2026-04-10T19:38:55 |
The translation_node is a standalone ROS 2 package that depends on px4_msgs_old headers generated only in a colcon ROS build — they are not available in the px4_sitl_default-clang environment used by clang-tidy CI. All translation headers share this dependency; the new file triggers the error only because it is the sole diff entry. Add msg/translation_node to the exclude lists in three places so that no translation-node file is analysed in the SITL context: • CLANG_TIDY_EXCLUDE_EXTRA in Makefile (make clang-tidy) • EXCLUDE_EXTRA in Tools/ci/run-clang-tidy-pr.py (PR incremental run) • git diff pathspec in clang-tidy.yml (clang-tidy-diff-18 pr-review step) The translation_node already has dedicated CI coverage via ros_translation_node.yml (builds and tests under ROS 2 humble + jazzy).
…lishLocalPosition The previous commit added vel_deriv as a function parameter, changing the mangled C++ names and breaking ITCM linker-script entries on v6xrt, nxp_mr-tropic, and nxp_tropic-community (itcm_check CI failures). Use a member variable _vel_deriv instead: - compute once in Run() via _ekf.getVelocityDerivative() - read in PublishLocalPosition() and PublishOdometry() via _vel_deriv Original function signatures are preserved: PublishLocalPosition(const hrt_abstime &) PublishOdometry(const hrt_abstime &, const imuSample &) The single-sample-per-update sharing of the velocity derivative (to avoid mixed-rate aliasing between vehicle_local_position and vehicle_odometry) is maintained.
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.
Summary
VehicleOdometryto v1 with NED accelerationvehicle_local_positionandvehicle_odometry, then reset onceVehicleOdometryv0 inpx4_msgs_oldand adding atranslation_nodev0<->v1 translatorWhy
This follows the prior review direction from #25507 to extend
VehicleOdometryinstead of introducing a separateVehicleFullStatetopic. Sharing a single publish-window derivative sample avoids mixed-rate aliasing and double consumption.Testing
make px4_sitl_default -j4colcon build --packages-select px4_msgscolcon build --packages-select px4_msgs_old translation_nodecolcon test --packages-select translation_node --ctest-args -R translation_node_unit_testsNotes
v0 -> v1translation fillsaccelerationwithNaNv1 -> v0translation dropsacceleration