fix(simulation): clamp simulated FIFO accel/gyro samples to int16#27927
Open
Bartok9 wants to merge 1 commit into
Open
fix(simulation): clamp simulated FIFO accel/gyro samples to int16#27927Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
salvage of PX4#27864 (credit @farhangnaderi). Prevents float-to-int16 wrap in SimulatorMavlink FIFO path so high-rate sim no longer inverts gyro/accel. Uses math::constrainFloatToInt16 for stock PX4 style. Fixes PX4#23469. Co-authored-by: Farhang Naderi <farhangnaderi@users.noreply.github.com> AI-assisted; human-reviewed.
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
Salvage of draft CONFLICTING #27864 by @farhangnaderi. Clamp simulated FIFO accel/gyro samples with math::constrainFloatToInt16 so float→int16 saturates instead of wrapping (inverted gyro at high rates).
Motivation
#27864 useful but CONFLICTING after SimulatorMavlink FIFO refactor. Rebased on main with stock math helper.
Related
Fixes #23469. Salvages #27864 (credit @farhangnaderi).
Verification
Simulation HIL FIFO id==0 only; no flight safety path changes. AI-assisted rebase; human-reviewed.
Co-authored-by: Farhang Naderi farhangnaderi@users.noreply.github.com