Skip to content

Consume wind msgs in all drag effectors#1333

Open
carlo98 wants to merge 4 commits intoAVSLab:developfrom
carlo98:feature/atmo_rel_vel_drag
Open

Consume wind msgs in all drag effectors#1333
carlo98 wants to merge 4 commits intoAVSLab:developfrom
carlo98:feature/atmo_rel_vel_drag

Conversation

@carlo98
Copy link
Contributor

@carlo98 carlo98 commented Mar 17, 2026

Description

Extends atmosphere-relative velocity to all three drag effectors: DragDynamicEffector, FacetDragDynamicEffector, and CannonballDrag. Replaces the former manual co-rotation approach with consumption of the WindMsgPayload produced by the wind environment modules introduced in PR #1329.

Motivation

DragDynamicEffector previously exposed a useAtmosphereRelativeVelocity / planetOmega_N
pair to approximate co-rotating atmosphere drag (PR #1318 ). FacetDragDynamicEffector and CannonballDrag
lacked any relative-velocity support at all. Now that WindBase / ZeroWindModel produce a
well-defined WindMsgPayload, the drag modules can consume it directly and all three effectors
share an identical, consistent interface.

Changes

DragDynamicEffector

  • Added optional windVelInMsg (ReadFunctor<WindMsgPayload>).
  • updateDragDir() now subtracts v_air_N from v_BN_N when the message is linked, yielding
    v_B_air_N (spacecraft velocity relative to air, body frame) as the drag velocity.
  • Removed useAtmosphereRelativeVelocity, setPlanetOmega_N(), getPlanetOmega_N(),
    hubPosition, and the associated Reset() guard — superseded by the wind message.
  • Removed astroConstants.h include.

FacetDragDynamicEffector

  • Added windVelInMsg (ReadFunctor<WindMsgPayload>) — same contract as DragDynamicEffector.
  • updateDragDir() follows the same v_BN_N / v_B_air_N pattern.
  • FacetDragDynamicEffector previously had no relative-velocity support.

CannonballDrag

  • Added optional windVelInMsg (ReadFunctor<WindMsgPayload>).
  • UpdateState() subtracts v_air_N from v_BN_N when the message is linked before rotating into
    the site frame, yielding v_B_air_N.

Examples

  • scenarioDragDeorbit.py: added optional useWind=False argument to run(); when True, loads SPICE with the IAU_EARTH frame, instantiates ZeroWindModel, and subscribes dragEffector.windVelInMsg to it so drag is computed against the atmosphere-relative velocity.
  • scenarioDragRendezvous.py: same useWind=False argument added to both drag_simulator() and run(); when True, a single ZeroWindModel is shared between chief and deputy - each spacecraft is registered via addSpacecraftToModel and the corresponding output message subscribed to each drag effector independently.
  • scenarioStochasticDragSpacecraft.py: useWind=False argument added to run(); SPICE + ZeroWindModel block inserted after the gravity setup, linked to the cannonball drag effector.
  • scenarioAerocapture.py: useWind=False argument added to run(); the wind block is guarded by planetCase == "Earth" so the Mars case is unaffected.

Verification

Unit tests updated in each effector's _UnitTest/ directory.

test_atmoDrag.py:

  • test_dragInertialVelocity — numerical check: drag matches cannonball reference when no wind
    message is linked (inertial velocity path).
  • test_drag_wind_velocity_automatic_usage — smoke test: simulation initialises and Reset()
    completes without error when windVelInMsg is not linked.
  • test_drag_wind_velocity_with_wind_message — integration test with ZeroWindModel: verifies
    that v_air_N is non-trivial (co-rotation) and is consumed by the effector.
  • test_scenarioDragOrbit — pre-existing orbit scenario retained unchanged.

test_unitFacetDrag.py:

  • test_facetDragInertialVelocity — numerical check: facet drag matches reference when no wind is
    linked.
  • test_facet_drag_wind_velocity_automatic_usage — smoke test (no wind linked).
  • test_facet_drag_wind_velocity_with_wind_message — integration test with ZeroWindModel.
  • Pre-existing test_DragCalculation and test_ShadowCalculation parametrised tests retained.

test_cannonballDrag.py:

  • test_cannonball_drag_wind_velocity_automatic_usage — smoke test (no wind linked).
  • test_cannonball_drag_wind_velocity_with_wind_message — integration test with ZeroWindModel.
  • Pre-existing test_cannonballDrag (isolated numerical) and test_orbit (MuJoCo integration)
    retained unchanged.

Documentation

  • dragDynamicEffector.rst: replaced "Atmosphere Relative Velocity" section with "Wind Velocity
    Input"; added windVelInMsg to I/O table; updated v_B member comment.
  • facetDragDynamicEffector.rst: Wind Velocity Input section, and windVelInMsg to I/O table.
  • cannonballDrag.rst: added windVelInMsg to I/O table; updated Detailed Behavior step list to
    describe the relative-velocity computation.
  • Release snippet: docs/source/Support/bskReleaseNotesSnippets/1325-atmo_rel_vel_all_drag.rst.
  • Release snippet 1317-atmo_rel_vel_dragDynEff.rst removed.

@carlo98 carlo98 changed the title Feature/atmo rel vel drag Consume wind msgs and implement density correction in all drag effectors Mar 17, 2026
@carlo98 carlo98 force-pushed the feature/atmo_rel_vel_drag branch from 90a63b8 to b3b4f48 Compare March 17, 2026 23:49
@carlo98 carlo98 changed the title Consume wind msgs and implement density correction in all drag effectors Consume wind msgs in all drag effectors Mar 18, 2026
@carlo98 carlo98 force-pushed the feature/atmo_rel_vel_drag branch 4 times, most recently from 5c07b1b to 9a0cc56 Compare March 18, 2026 19:32
@carlo98 carlo98 marked this pull request as ready for review March 18, 2026 19:39
@carlo98 carlo98 requested a review from a team as a code owner March 18, 2026 19:39
Copy link

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

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: 9a0cc5622c

ℹ️ 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".

@carlo98 carlo98 force-pushed the feature/atmo_rel_vel_drag branch from 9a0cc56 to 1747fe8 Compare March 18, 2026 21:15
@carlo98
Copy link
Contributor Author

carlo98 commented Mar 18, 2026

Should I add example scenarios demonstrating the use of wind messages with drag effectors?

@schaubh schaubh self-requested a review March 19, 2026 00:05
@schaubh schaubh self-assigned this Mar 19, 2026
@schaubh schaubh added the enhancement New feature or request label Mar 19, 2026
@schaubh schaubh added this to Basilisk Mar 19, 2026
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.

nice work. Very minor recommendation only. Should be quick to address my feedback.

@schaubh
Copy link
Contributor

schaubh commented Mar 19, 2026

Example scenarios are always nice. Or, instead of adding a new scenario, we have an atmospheric drag example already. Why not enhance that scenario to include the wind model? This way we have one scenario that shows everything. You can state in the python example script that the use of the wind module is optional?

@carlo98 carlo98 force-pushed the feature/atmo_rel_vel_drag branch from 1747fe8 to ade24d9 Compare March 19, 2026 03:02
@carlo98 carlo98 force-pushed the feature/atmo_rel_vel_drag branch from ade24d9 to cbd65c7 Compare March 19, 2026 03:14
@carlo98 carlo98 requested a review from schaubh March 19, 2026 15:02
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: No status

Development

Successfully merging this pull request may close these issues.

2 participants