Conversation
8f62d83 to
4a975ac
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a975ac706
ℹ️ 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".
4a975ac to
b6eb459
Compare
schaubh
left a comment
There was a problem hiding this comment.
Nice PR. Mostly small stuff to address.
src/simulation/dynamics/facetedSRPEffector/facetedSRPEffector.cpp
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/facetedSRPEffector/_UnitTest/test_facetedSRPEffector.py
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/facetedSRPEffector/facetedSRPEffector.cpp
Outdated
Show resolved
Hide resolved
...pport/bskReleaseNotesSnippets/1332-new-faceted-solar-radiation-pressure-dynamic-effector.rst
Outdated
Show resolved
Hide resolved
b6eb459 to
9aba80c
Compare
9aba80c to
abf9ac0
Compare
abf9ac0 to
e7827d6
Compare
e7827d6 to
93b8d06
Compare
schaubh
left a comment
There was a problem hiding this comment.
just some minor stuff now.
| } | ||
|
|
||
| // Read optional sun eclipse message | ||
| if (this->sunEclipseInMsg.isLinked() && this->sunEclipseInMsg.isWritten()) { |
There was a problem hiding this comment.
sunVisibilityFactor is only updated when sunEclipseInMsg is linked and written, but it is never reset to full sunlight before that optional read. If the module is reused/reset after previously reading an eclipse value, or if the optional message is linked but unavailable for a cycle, the previous illumination factor can continue scaling the force and torque. The older facetSRPDynamicEffector defaults the eclipse factor back to 1.0 before reading the optional message; this module should do the same in Reset() and/or at the start of each computeForceTorque() call.
Also, input messages can be disconnected, then reconnected. We should set the default 1.0 value before checking if sunEclipseInMsg is connected and written.
| Eigen::Matrix3d dcm_BN = sigma_BN.toRotationMatrix().transpose(); | ||
| Eigen::Vector3d r_BN_N = this->hubPosition->getState(); | ||
| Eigen::Vector3d r_SB_B = dcm_BN * (r_SN_N - r_BN_N); | ||
| Eigen::Vector3d sunDirHat_B = r_SB_B.normalized(); |
There was a problem hiding this comment.
r_SB_B.normalized() is used without checking that the Sun-spacecraft vector has nonzero norm. If the Sun state is accidentally left at the spacecraft position, for example both default to the origin during setup, this produces NaNs that then propagate into the spacecraft dynamics. The upstream projected-area module already guards this case and logs an error; this effector should similarly check the norm before normalizing and return zero force/torque with a clear BSK error.
|
|
||
| #. Import the required BSK modules:: | ||
|
|
||
| from Basilisk.simulation import facetedSRPEffector |
There was a problem hiding this comment.
The setup guide uses messaging, simIncludeGravBody, np, test_sim, task_name, and eclipse_msg, but the import/setup snippets only import three simulation modules and never define the optional eclipse message before subscribing to it. Since this is the primary new-module user guide, copying the documented steps will raise NameErrors. Please add the missing imports/context or make the snippets self-contained enough to run.
Overview
This new faceted solar radiation pressure dynamic effector module is created to utilize the two new modules recently added to the repository:
facetedSpacecraftModelandfacetedSpacecraftProjectedArea. The originalfacetSRPDynamicEffectormodule is complicated in that it contains several different calculations which are now isolated and checked in these new modules. This new SRP module now perform a compact SRP calculation that does not include any auxiliary calculations.Description
This module computes the aggregate force and torque acting on the spacecraft due to impinging photons from the Sun. The inertial Sun state information must be subscribed to the module
SpicePlanetStateMsgPayloadinput message. The module assumes the spacecraft is modeled as a collection of facets, where the facet geometry information is passed as a vector ofFacetElementBodyMsgPayloadinput messages to the module. The facet geometry information is required to be provided in the spacecraft body frame. This SRP module does not make any assumptions regarding whether the facets are rigid or articulate. ThefacetedSpacecraftModelmodule can be connected upstream and used to transform the facet geometry data from the facet frames to the spacecraft body frame. This upstream module can also be used to configure articulating facets.Finally, this SRP module also requires the sunlit area of all facets to be pre-computed and connected to the module vector ofProjectedAreaMsgPayloadinput messages. This information can be passed to the SRP module by connecting the facet geometry information to thefacetedSpacecraftProjectedAreamodule upstream.Verification
The module unit test verifies that the module correctly computes the aggregate SRP force and torque acting on the spacecraft due to impinging photons from the Sun. The test sets up a simulation with a faceted spacecraft modeled as a cubic hub with two attached circular solar arrays. Six square facets represent the cubic hub and four circular facets represent the two solar arrays. The test varies the initial state information of the spacecraft, the initial state information of the Sun, and the Sun illumination factor.
Documentation
RST documentation is added for the new module.
Future work
N/A