Skip to content

Fix N-DoF state effector getter assertions#1419

Open
schaubh wants to merge 2 commits into
developfrom
feature/fix_numberOfDegreesOfFreedom
Open

Fix N-DoF state effector getter assertions#1419
schaubh wants to merge 2 commits into
developfrom
feature/fix_numberOfDegreesOfFreedom

Conversation

@schaubh

@schaubh schaubh commented Jun 15, 2026

Copy link
Copy Markdown
Contributor
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

Fixes invalid assertions in the N-DoF state effector getter methods.

The linear translation N-DoF getter assertion referenced numberOfDegreesOfFreedom, which belongs to the spinning-body N-DoF effector and is not a member of LinearTranslationNDOFStateEffector. This caused source builds with assertions enabled to fail at compile time.

While checking similar state effectors, the spinning-body N-DoF getter was found to have a related zero-based bounds issue: index == numberOfDegreesOfFreedom passed the assertion even though the subsequent vector access is out of range. This PR updates both getter assertions to use strict zero-based bounds.

Verification

Validated with focused module builds:

  • .venv/bin/cmake --build dist3 --target linearTranslationNDOFStateEffector -- -j2
  • .venv/bin/cmake --build dist3 --target spinningBodyNDOFStateEffector -- -j2

Validated with focused unit tests:

  • MPLBACKEND=Agg MPLCONFIGDIR=/private/tmp/mpl .venv/bin/pytest -q src/simulation/dynamics/linearTranslationalBodies/linearTranslationBodiesNDOF/_UnitTest/test_changeParameterslinearTranslatingBodyNDOF.py src/simulation/dynamics/linearTranslationalBodies/linearTranslationBodiesNDOF/_UnitTest/test_linearTranslationNDOFStateEffector.py src/simulation/dynamics/spinningBodies/spinningBodiesNDOF/_UnitTest/test_changeParametersSpinningBodyNDOF.py src/simulation/dynamics/spinningBodies/spinningBodiesNDOF/_UnitTest/test_spinningBodyNDOFStateEffector.py

Result: 8 passed.

No tests were added because this is a compile/configuration-sensitive assertion fix. Existing tests already exercise the valid getter paths; the original issue appears only when assertions are compiled in.

Documentation

Added/updated PR metadata documentation:

  • Added a release-note snippet in docs/source/Support/bskReleaseNotesSnippets/
  • Updated docs/source/Support/bskKnownIssues.rst

Future work

N/A

schaubh added 2 commits June 15, 2026 08:21
Update the getTranslatingBody() assertion to use the linear
translation effector's translating-body count instead of the
spinning-body-only degree-of-freedom member. Add the required release
note snippet and known-issues entry for the source-build fix.
Correct the linear translation N-DoF getter assertion to use the
linear effector body count instead of the spinning-body-only degree of
freedom member. Also tighten the spinning body N-DoF getter assertion
to reject the first out-of-range zero-based index.

Update the release note snippet and known issues entry for both getter
assertion fixes.
@schaubh schaubh requested a review from andrewmorell June 15, 2026 16:30
@schaubh schaubh self-assigned this Jun 15, 2026
@schaubh schaubh requested a review from a team as a code owner June 15, 2026 16:30
@schaubh schaubh added the bug Something isn't working label Jun 15, 2026
@schaubh schaubh added this to Basilisk Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant