Fix N-DoF state effector getter assertions#1419
Open
schaubh wants to merge 2 commits into
Open
Conversation
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.
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.
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 ofLinearTranslationNDOFStateEffector. 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 == numberOfDegreesOfFreedompassed 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 -- -j2Validated 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.pyResult:
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:
docs/source/Support/bskReleaseNotesSnippets/docs/source/Support/bskKnownIssues.rstFuture work
N/A