Add velocity_decay to Omnidirectional3D to prevent drift when odom goes silent#34
Draft
bkanator wants to merge 1 commit into
Draft
Add velocity_decay to Omnidirectional3D to prevent drift when odom goes silent#34bkanator wants to merge 1 commit into
bkanator wants to merge 1 commit into
Conversation
3 tasks
…ft when odom goes silent
3fa9dfd to
16233dd
Compare
There was a problem hiding this comment.
Pull request overview
Adds configurable exponential velocity decay to the Omnidirectional3D motion model to reduce drift when velocity observations stop, while preserving existing behavior by default.
Changes:
- Adds
velocity_decayparameter parsing, validation, storage, and propagation through Omnidirectional3D constraints. - Updates prediction functions and analytical Jacobians to apply decay to linear/angular velocity.
- Adds prediction tests for zero decay, velocity reduction, and decay-factor Jacobians.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
fuse_models/src/omnidirectional_3d.cpp |
Reads and forwards velocity_decay into prediction and constraints. |
fuse_models/src/omnidirectional_3d_state_kinematic_constraint.cpp |
Stores decay on the constraint and passes it to the cost function. |
fuse_models/include/fuse_models/omnidirectional_3d.hpp |
Documents and stores the new model parameter. |
fuse_models/include/fuse_models/omnidirectional_3d_state_kinematic_constraint.hpp |
Extends constructor/serialization with decay. |
fuse_models/include/fuse_models/omnidirectional_3d_state_cost_function.hpp |
Extends cost function with decay propagation. |
fuse_models/include/fuse_models/omnidirectional_3d_predict.hpp |
Applies decay in prediction and Jacobians. |
fuse_models/test/test_omnidirectional_3d_predict.cpp |
Adds tests for decay behavior and Jacobian scaling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+129
to
+131
| vel_linear2_x = vel_linear1_x * decay_factor + acc_linear1_x * dt; | ||
| vel_linear2_y = vel_linear1_y * decay_factor + acc_linear1_y * dt; | ||
| vel_linear2_z = vel_linear1_z * decay_factor + acc_linear1_z * dt; |
Comment on lines
+229
to
+231
| vel_linear2_x = vel_linear1_x * decay_factor + acc_linear1_x * dt; | ||
| vel_linear2_y = vel_linear1_y * decay_factor + acc_linear1_y * dt; | ||
| vel_linear2_z = vel_linear1_z * decay_factor + acc_linear1_z * dt; |
| * x_acc, y_acc, z_acc) | ||
| */ | ||
| Omnidirectional3DStateCostFunction(double const dt, fuse_core::Matrix15d const& A); | ||
| Omnidirectional3DStateCostFunction(double const dt, fuse_core::Matrix15d const& A, double velocity_decay = 0.0); |
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
When a nav2 controller deactivates, wheel odom stops publishing. Without a correcting velocity source,
Omnidirectional3Dpropagates the last known velocity indefinitely, causing unbounded position drift in the fuse estimate.Adds a
velocity_decayparameter (1/s, default0.0) toOmnidirectional3D. When set, predicted velocity is multiplied byexp(-k * dt)each step. Atk=1.0(20 Hz), velocity halves in ~0.7s. Default0.0preserves existing behavior.Updates analytical Jacobians:
d(vel2)/d(vel1) = exp(-k*dt)instead of1.0.Claude agent checks