Skip to content

Fix N-DoF state effector getter assertions#1419

Merged
schaubh merged 2 commits into
developfrom
feature/fix_numberOfDegreesOfFreedom
Jun 30, 2026
Merged

Fix N-DoF state effector getter assertions#1419
schaubh merged 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 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
@schaubh schaubh force-pushed the feature/fix_numberOfDegreesOfFreedom branch from 0a71d94 to 498756a Compare June 16, 2026 14:30
@schaubh schaubh moved this to 👀 In review in Basilisk Jun 22, 2026
schaubh added a commit that referenced this pull request Jun 27, 2026
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.
schaubh added a commit that referenced this pull request Jun 27, 2026
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 force-pushed the feature/fix_numberOfDegreesOfFreedom branch from 498756a to a36541e Compare June 27, 2026 21:12

@andrewmorell andrewmorell 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.

Looks good, nice catch and fix by you and Carlo!

schaubh added 2 commits June 30, 2026 11:33
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 force-pushed the feature/fix_numberOfDegreesOfFreedom branch from a36541e to 2e187f4 Compare June 30, 2026 17:33
@schaubh schaubh merged commit 6b594fc into develop Jun 30, 2026
7 checks passed
schaubh added a commit that referenced this pull request Jun 30, 2026
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.
@schaubh schaubh deleted the feature/fix_numberOfDegreesOfFreedom branch June 30, 2026 19:10
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Basilisk Jun 30, 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: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants