Skip to content

Enable facet drag dynamic effector to link to state effectors#1289

Open
DavilaDawg wants to merge 4 commits intodevelopfrom
feature/facetDrag-branching
Open

Enable facet drag dynamic effector to link to state effectors#1289
DavilaDawg wants to merge 4 commits intodevelopfrom
feature/facetDrag-branching

Conversation

@DavilaDawg
Copy link
Contributor

@DavilaDawg DavilaDawg commented Feb 25, 2026

  • Tickets addressed: bsk-1151
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

The purpose of this PR is to augment the facet drag dynamic effector to be able to link to state effectors instead of just being able to link directly with the hub. To do this I added setter and getter functions for the states of the state effectors and updated the function that calculates drag based on the states of its parent so that if the parent is the hub it uses the hub states and if it is a state effector is uses the state effector's states. One commit contains the changes to the header, the next contains changes to the c+, the next contains changes to the integrated test and the last contains documentation changes.

Verification

I added to the integrated test: test_effectorBranching_integrated.py. I also wrote an aerobrake scenario and which compared two identical spacecraft one with facet drag with the hub as the parent and one where facet drag is also attached to 1DOF HRBs and 2DOF HRB's and the resulting dynamics make sense. The unit tests also pass.

Documentation

I added comments to the header file and c++ as well as added a column to the abilities table in bskPrinciples-11.rst. Also added to bskReleaseNotes.rst

Future work

Can use this change for a more accurate aerobraking maneuver scenario.

@DavilaDawg DavilaDawg requested a review from a team as a code owner February 25, 2026 20:13
@DavilaDawg DavilaDawg added the enhancement New feature or request label Feb 25, 2026
@schaubh schaubh moved this to 👀 In review in Basilisk Feb 28, 2026
@schaubh schaubh linked an issue Feb 28, 2026 that may be closed by this pull request
@schaubh schaubh force-pushed the feature/facetDrag-branching branch from f0adf7c to 8a29fe9 Compare March 2, 2026 15:39
@ReeceHumphreys
Copy link
Contributor

Can we update this PR to have a more descriptive title.

@schaubh
Copy link
Contributor

schaubh commented Mar 2, 2026

Both the PR title and the PR description need to be more informative. The PR description, right now, just tells me some files were edited. It tells me nothing about what this branch is about, the motivation, expected outcome, assumptions, etc.

@schaubh
Copy link
Contributor

schaubh commented Mar 2, 2026

[P1] Shadowed property-name fields break segment force routing for 2-DOF parents

FacetDragDynamicEffector re-declares propName_inertialPosition / ...Velocity / ...Attitude in the derived class. Setters update the derived fields, but spinningBodyTwoDOFStateEffector compares through DynamicEffector* and reads the base getter value. This can prevent facet-drag force/torque from being attributed to either segment.

Refs:

  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.h#L83
  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.cpp#L131
  • src/simulation/dynamics/_GeneralModuleFiles/dynamicEffector.h#L90
  • src/simulation/dynamics/spinningBodies/spinningBodiesTwoDOF/spinningBodyTwoDOFStateEffector.cpp#L344

@schaubh
Copy link
Contributor

schaubh commented Mar 2, 2026

[P1] Shadowed state-name fields ignore assigned hub state names

FacetDragDynamicEffector also re-declares stateNameOfSigma / stateNameOfVelocity and defaults them to "hubSigma" / "hubVelocity". Spacecraft assignment writes base-class names, but linkInStates() reads the derived shadowed values. With non-default hub naming, getStateObject() can return nullptr, then updateDragDir() dereferences it.

Refs:

  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.h#L79
  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.cpp#L43
  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.cpp#L113
  • src/simulation/dynamics/spacecraft/spacecraft.h#L99
  • src/simulation/dynamics/_GeneralModuleFiles/dynParamManager.cpp#L71
  • src/simulation/dynamics/facetDragEffector/facetDragDynamicEffector.cpp#L181

@schaubh
Copy link
Contributor

schaubh commented Mar 2, 2026

[P3] New numeric literals violate repo unit-comment rule

AGENTS requires inline unit comments for physically meaningful numeric literals in modified code. New literals were added without unit annotations.

Refs:

  • src/simulation/dynamics/_GeneralModuleFiles/_UnitTestDynamics/test_effectorBranching_integrated.py#L292
  • src/simulation/dynamics/_GeneralModuleFiles/_UnitTestDynamics/test_effectorBranching_integrated.py#L583
  • src/simulation/dynamics/_GeneralModuleFiles/_UnitTestDynamics/test_effectorBranching_integrated.py#L584
  • src/simulation/dynamics/_GeneralModuleFiles/_UnitTestDynamics/test_effectorBranching_integrated.py#L585

Copy link
Contributor

@schaubh schaubh left a comment

Choose a reason for hiding this comment

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

I did a rebase and fixed how release notes were added. In the future, when making a PR, please ensure your branch is already rebased on develop. Also, please make the PR title and description section more informative.

Overall getting close. Thanks for the support!
I'm waiting for @andrewmorell feedback on this PR as well.

Eigen::Vector3d v_hat_B; //!< class variable
BSKLogger bskLogger; //!< -- BSK Logging

// State names (for hub attachment)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these variables be private variables that are accessed through setters and getters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes they should be. I fixed this.

this->inertialAttitudeProperty = nullptr;

// Set default state names for hub attachment
this->stateNameOfSigma = "hubSigma";
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the default name for the position states?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you actually use inertialPositionProperty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this because it was unused.

this->hubVelocity = nullptr;

// Initialize property pointers
this->inertialPositionProperty = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure you actually use this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't, I removed it.

@DavilaDawg DavilaDawg changed the title Feature/facet drag branching Enable Facet drag to link to state effectors Mar 2, 2026
@DavilaDawg DavilaDawg changed the title Enable Facet drag to link to state effectors Enable facet drag dynamic effector to link to state effectors Mar 2, 2026
@DavilaDawg DavilaDawg force-pushed the feature/facetDrag-branching branch from f584912 to 4132d69 Compare March 3, 2026 00:53
@DavilaDawg DavilaDawg force-pushed the feature/facetDrag-branching branch from 4132d69 to af9e445 Compare March 3, 2026 00:57
@DavilaDawg
Copy link
Contributor Author

I have removed the unnecessary variables and also removed the getters as they are inherited from DynamicEffector. I kept the setter functions with an override but I could remove those too if needed.

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

Labels

enhancement New feature or request

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Hinged 2DOF branching

3 participants