Skip to content

[#97] Modernize Eigen MRPd support and attitude conversions - #1464

Open
schaubh wants to merge 11 commits into
developfrom
feature/97-eigen-MRPd
Open

[#97] Modernize Eigen MRPd support and attitude conversions#1464
schaubh wants to merge 11 commits into
developfrom
feature/97-eigen-MRPd

Conversation

@schaubh

@schaubh schaubh commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
  • Tickets addressed: bsk-97
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

This PR modernizes Eigen MRP support and moves selected attitude handling to Eigen::MRPd where the values semantically represent MRPs. The commits are organized as small library upgrades and then downstream usage updates, ending with a standalone release-note snippet.

Key changes include more robust Eigen::MRPd conversions, short-rotation quaternion/DCM handling, scalar casts for mapped MRP expressions, clearer assignment diagnostics, and expanded MRP unit test coverage. Dynamics attitude interfaces now pass MRP attitudes as Eigen::MRPd while preserving raw vector storage at state/message/SWIG boundaries.

Verification

Validated with:

  • make -C dist3 test_avsEigenMRP
  • make -C dist3 test_avsEigenSupport
  • dist3/architecture/utilities/tests/test_avsEigenMRP
  • dist3/architecture/utilities/tests/test_avsEigenSupport
  • .venv/bin/pytest -q src/simulation/mujocoDynamics/_GeneralModuleFiles/_UnitTest/test_integration.py
  • git diff --check origin/develop...HEAD

The MRP GoogleTest suite was expanded to cover constructors, maps, casts, assignment paths, DCM/AngleAxis conversion branch behavior, composition, shadow sets, setFromTwoVectors(), coefficient arithmetic, and small-vector handling.

Documentation

Updated avsEigenMRP.h Doxygen comments to clarify MRP norm/normalization behavior, coefficient arithmetic, supported assignment paths, and helper internals. Added a release-note snippet documenting the Eigen::MRPd conversion updates and the eigenMRPd2CArray() signature change. Updated AGENTS.md review guidance to check for Eigen::MRPd use where appropriate.

Future work

None

@schaubh schaubh self-assigned this Jul 5, 2026
@schaubh
schaubh requested a review from a team as a code owner July 5, 2026 18:46
@schaubh schaubh added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Jul 5, 2026
@schaubh schaubh added this to Basilisk Jul 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abdf08ddd3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

TEST(eigenMRP, testCoefficientConstructorsAndAccessors) {
const double rawCoefficients[3] = {0.10, -0.20, 0.30}; // [-]

Eigen::MRPd fromScalars(0.10, -0.20, 0.30);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add unit comments to MRP literal definitions

AGENTS.md requires trailing inline unit comments for numeric literal assignments/definitions when the quantity has physical meaning. These added MRP coefficient definitions are dimensionless attitude quantities, but this line (and the similar new MRP/vector coefficient definitions in this test) lacks a // [-] unit comment, so it violates the repository's review rule.

Useful? React with 👍 / 👎.

@schaubh schaubh moved this to 👀 In review in Basilisk Jul 5, 2026
@schaubh
schaubh requested a review from leahkiner July 5, 2026 19:01
@schaubh
schaubh force-pushed the feature/97-eigen-MRPd branch from 731e11b to d5b6f41 Compare July 6, 2026 13:55
schaubh added 11 commits July 9, 2026 07:29
Update MRP conversion helpers to accept and return Eigen::MRPd directly, and convert clear attitude read sites away from generic Vector3d handling. Add focused test coverage updates and a release-note snippet.
Update hub and state-effector dynamics methods to pass attitude MRPs as Eigen::MRPd instead of generic Vector3d values. Convert spacecraft and spacecraftSystem callers to construct MRPd values at hub-state reads, and clean up now-redundant attitude casts in affected state effectors.
Fix Eigen MRP conversion and operator behavior so DCM/AngleAxis conversions,
composition, vector rotation, scalar casts, and setFromTwoVectors behave
consistently with Basilisk MRP conventions. Keep DCM-to-MRP conversion on the
short-rotation set and clarify MRP norm/normalization documentation.

Expand avsEigenMRP unit coverage across constructors, maps, assignment,
composition, shadow sets, Bmat, inverse/conjugate, angular distance, and casts.
Update the MuJoCo integration attitude comparison to be robust to quaternion
sign while preserving strict checks on the remaining qpos states.
Migrate remaining internal semantic MRP attitudes from Eigen::Vector3d
detours to Eigen::MRPd where this does not cross message, state-manager,
Python/SWIG, or estimator-state storage boundaries.

Keep raw coefficient vectors at those boundaries and convert with MRPd only
where attitude operations are performed.
@schaubh
schaubh force-pushed the feature/97-eigen-MRPd branch from d5b6f41 to 864ac0e Compare July 9, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

1 participant