Skip to content

Feature/1596 configure linearspringmassdamper for prescribed motion branching - #1634

Open
mdrum2304 wants to merge 9 commits into
developfrom
feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching
Open

mdrum2304 wants to merge 9 commits into
developfrom
feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching

Conversation

@mdrum2304

Copy link
Copy Markdown
Contributor
  • Tickets addressed: #000
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

It is desired to enable state effector branching off of a prescribed motion component. This issue will configure the linearSpringMassDamper module for this capability.

Verification

The prescribed branching is tested in the test_PrescribedMotionStateEffectorBranching.py file within the prescribedMotion/UnitTest folder. The test verifies that energy is conserved within tolerance and the motion behaves as expected.

Documentation

N/A

Future work

N/A

@mdrum2304 mdrum2304 self-assigned this Oct 19, 2026
@mdrum2304
mdrum2304 requested a review from a team as a code owner October 19, 2026 21:25
@mdrum2304
mdrum2304 force-pushed the feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching branch from 9a5704f to 7638f98 Compare October 21, 2026 00:22
@leahkiner leahkiner linked an issue Oct 21, 2026 that may be closed by this pull request
@leahkiner leahkiner moved this to 👀 In review in Basilisk Oct 21, 2026

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

Nice PR, there are just a few small changes you should make before we merge.

@mdrum2304
mdrum2304 force-pushed the feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching branch from 9d9c40d to 2881215 Compare November 2, 2026 19:56
@leahkiner

leahkiner commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Looks good, thanks for fixing those small things. I requested one more change and also a bunch of your commits should be squashed before we merge. One commit should contain everything added to the effector files to enable branching, and another can be all the unit test changes. So commit 3 can be split and the test part can be squashed with commit 4 for the unit test changes. The other part of commit 3 can be squashed with commits 1, 2, 5, 6, and 8 for the changes to the effector. Commit 7 can be kept separate. You can delete the last commit (see my previous comment). Also please add a release note snippet as the final commit.

@mdrum2304
mdrum2304 force-pushed the feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching branch from 2881215 to b46e275 Compare November 8, 2026 19:31

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

Reviewed b46e275. Requesting changes for the following five findings; inline comments cover findings 1, 2, 4, and 5.

  1. [P1] Configurable hub state names cause a segmentation fault. linkInStates() hard-codes hubOmega. Setting sc_object.hub.nameOfHubOmega = "customOmega" before initialization produces a missing-state warning and then a null-pointer crash in the coupling callback. Use the configured state name or angular velocity supplied through the dynamics callbacks.

  2. [P2] The new test passes without the spring attachment. Removing prescribed_platform.addStateEffector(smd) still passes. The test never verifies rho or rhoDot, its collinear geometry leaves rotational coupling terms unexercised, and conservation checks only compare endpoints. The baseline transient relative angular-momentum error reaches approximately 4.85e-5 despite passing the endpoint tolerance of 1e-6. Add independent particle-response checks, non-collinear configurations, and full-history conservation checks with justified tolerances.

  3. [P2] User documentation contradicts the new capability. src/simulation/dynamics/prescribedMotion/prescribedMotionStateEffector.rst:90-96 still lists only three supported effectors, and its testing section describes three tests. Update that guide and add a spring-module attachment example explaining the prescribed-parent-frame interpretation of pHat_B and r_PB_B. Retain the restriction against nested variable-mass operation. A release-note snippet alone does not explain how to use this feature.

  4. [P3] New API methods lack parameter documentation. linkInPrescribedMotionProperties() and addPrescribedMotionCouplingContributions() have brief comments but no @param sections. Generated Doxygen XML confirms these sections are absent. Document the arguments, contribution frame, and initialization/call prerequisites.

  5. [P3] New test literals need correct unit comments. Earth's gravitational parameter is labeled meters instead of m^3/s^2; the new timestep and profiler duration literals also need unit comments under AGENTS.md.

Validation: rebuilt the affected targets, compiled the header independently, and ran 276 focused tests successfully. An independent Newton/Euler check over 20 arbitrary geometries found force, torque, and spring-equation residuals below 2e-13, supporting the coupling algebra. Sphinx/Doxygen previews rendered with expected single-page cross-reference warnings. The full repository suite and full documentation build were not run.

this->c_B = states.getPropertyReference(this->propName_centerOfMassSC);
this->cPrime_B = states.getPropertyReference(this->propName_centerOfMassPrimeSC);
// Get access to the hub's states needed for dynamic coupling
this->hubOmega = states.getStateObject("hubOmega");

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.

1. [P1] Avoid hard-coding the hub angular-velocity state. Renaming the hub state to customOmega before initialization produces a missing-state warning and a segmentation fault at the later hubOmega->stateView() call. Propagate the configured state name or obtain angular velocity through the dynamics callback, and add a renamed-state regression test.

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.

pushed a fix, @mdrum2304 , please review.

plt.close("all")

# Test check
unit_test_check_verification(orb_ang_mom_n, orb_energy, rot_ang_mom_n)

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.

2. [P2] Assert the attached particle's actual response. This test still passes when prescribed_platform.addStateEffector(smd) is removed. Record rho and rhoDot and compare against an independent reference; include non-collinear geometry and check conservation across the time history with justified tolerances.

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.

pushed a fix, @mdrum2304 , please review.

Eigen::Vector3d omegaDot_BN_B,
Eigen::MRPd sigma_BN) override; //!< Method for each stateEffector to calculate derivatives
void addPrescribedMotionCouplingContributions(BackSubMatrices& backSubContr)
override; //!< Method for adding coupling contributions for state effector branching on prescribed motion

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.

4. [P3] Document the new callback parameters. Neither new callback produces a parameter section in Doxygen XML. Add @param documentation for backSubContr and for states in linkInPrescribedMotionProperties(), describing frames and required initialization/call order.

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.

pushed a fix, @mdrum2304 , please review.

# Add Earth gravity to the simulation
earth_gravity = gravityEffector.GravBodyData()
earth_gravity.planetName = "earth_planet_data"
earth_gravity.mu = 0.3986004415E+15 # meters

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.

5. [P3] Correct and complete physical unit comments. The gravitational parameter has units m^3/s^2, not meters. Also annotate the newly added timestep and profiler duration literals with their units, as required by AGENTS.md.

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.

pushed a fix, @mdrum2304 , please review.

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

@mdrum2304, thanks for the contribution. I pushed a few review comments and pushed commits to address each one of them. Please review and let me know if you agree or see issues. If you are ok with these changes, I'll go ahead and approve.

@schaubh
schaubh force-pushed the feature/1596-configure-linearspringmassdamper-for-prescribed-motion-branching branch from 4b3bda1 to 20565b1 Compare November 10, 2026 19:45

This branch has not been deployed

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

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Configure linearSpringMassDamper for Prescribed Motion Branching

3 participants