Skip to content

Add gravity compensated acceleration and quaternion tests - #304

Open
bjornhbengtsson wants to merge 1 commit into
integration/state-estims-telemetryfrom
feature/gravity-compensated-acceleration
Open

Add gravity compensated acceleration and quaternion tests#304
bjornhbengtsson wants to merge 1 commit into
integration/state-estims-telemetryfrom
feature/gravity-compensated-acceleration

Conversation

@bjornhbengtsson

@bjornhbengtsson bjornhbengtsson commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Updates the mod submodule with gravity compensated accelerometer processing and adds unit tests for the quaternion vector rotations used by that implementation.

Dependency

This PR depends on the corresponding mod PR:
SunDevilRocketry/mod#138

Changes

  • Update the mod submodule to include gravity compensated acceleration processing.
  • Add a standalone math_sdr unit test target.
  • Add a minimal test main.h for host compilation.
  • Test quaternion world to body and body to world vector rotations.
  • Test a known positive 90 degree yaw rotation.
  • Test body to world to body round trip behavior.
  • Test that stationary acceleration at the identity attitude becomes zero after gravity subtraction.

Issue Link

github.com/SunDevilRocketry/mod/issues/139

Testing

  • Passes existing unit tests
  • [X ] Unit tests modified
  • Integration test performed

If a non-automated test was executed that provides an artifact, please attach below (e.g. flash extract data).

Other

Leave any additional notes here

Reviewer Checklist

Standards

  • Follows FCF Architectural Standards
  • Follows SDR Coding Standards
  • Code complexity/function Size is minimized
  • Code is testable
  • Code is readable and commented properly
  • License terms are respected

Accuracy

  • Code implements the correct requirement (a.k.a. does the right thing)
  • Code is logically correct (a.k.a. does the thing right)

Error Handling

  • Potentially unsafe functions return a status code
  • Error returns properly handled
  • Fail-fast errors are only thrown when unsafe to continue software execution
  • Debug errors are thrown for exceptions where execution should still continue (to be noticed during development)

Memory

  • Stack allocated memory is scoped correctly
  • Heap allocated memory is not used
  • Statically/Globally allocated memory is minimized except when necessary
  • Pointers are used correctly
  • Concurrent access has been considered (especially by/from interrupt service routines)

Performance

  • Rate limiters are respected
  • Busy waiting is avoided in performance sensitive code
  • "Delay" calls are not used in performance sensitive code
  • If performance is negatively impacted, a justification is provided and the impact is quantified

@ETSells ETSells left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to migrate this test to mod.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cr: If this file lives in mod, its test should too. I can help get the submodule set up if you'd like.

That means this PR may not be needed. We can close it out unmerged once we get that ready.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the math_sdr unit tests into the mod repository and added the SDR test framework as a submodule. The migrated tests pass locally with 26 passes and 0 failures. We can close this PR unmerged as suggested once the mod PR is ready.

@NArmistead NArmistead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to add the mod tests to CI which you can do if you want, and if not, I'll do it at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants