Module: facetedSpacecraftModel
Executive Summary
The faceted spacecraft module maps spacecraft facet geometry from the local facet frames to the spacecraft hub body frame. The module supports both fixed facets and single-axis articulating facets. For all facets, the facet geometry information is provided in each local facet frame as a vector of FacetElementMsgPayload input messages. Additionally, for articulated facets the current facet articulation angles must be provided as a vector of HingedRigidBodyMsgPayload input messages. After mapping the facet information to the spacecraft body frame, the transformed facet geometry data is written to the vector of module FacetElementBodyMsgPayload output messages.
Important
The total number of facets must be set by the user using the setNumTotalFacets() setter method
before connecting the facet geometry messages.
Important
The module assumes all articulating facets are added first, in order, to the facetElementInMsgs vector of
facet geometry FacetElementMsgPayload input messages. Therefore, the first numArticulatedFacets entries
of the module facetElementInMsgs correspond to the articulating facets. In addition, the facet articulation
angle HingedRigidBodyMsgPayload input messages must be set using the addArticulatedFacet() method.
Important
User calling of the adder/setter methods is order-independent, meaning the setNumTotalFacets() method
can be called before or after the addArticulatedFacet() method. The setNumTotalFacets() method reuses
previously added articulated facets if called multiple times.
Message Connection Descriptions
The following table lists all module input and output messages. The module msg connections are set by the user from Python. The msg type contains a link to the message structure definition, while the description provides information on what each message is used for.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
articulatedFacetDataInMsgs |
(Optional) Input msg vector for the articulating facet angles |
|
facetElementInMsgs |
Input msg vector containing all facet geometry data expressed in each local facet frame |
|
facetElementBodyOutMsgs |
Output msg vector containing all facet geometry data expressed in the spacecraft body frame |
Module Functions
Below is a list of functions this simulation module performs:
Reads and stores all
FacetElementMsgPayloadfacet geometry data at resetComputes fixed-facet body-frame geometry once at reset
Reads articulating facet angles at each time update
Computes body-frame facet geometry for articulating facets at each time update
Writes one
FacetElementBodyMsgPayloadoutput message for each facet
Module Assumptions and Limitations
The user must set the total number of facets using the
setNumTotalFacets()method before connecting facet messages.All facet element input messages are expected to be linked and written before initialization.
Articulating facets are assumed to have 1 DOF rotation about their defined rotation axes
rotHat_F.Articulating facets must be indexed first in
facetElementInMsgs.For each articulating facet, a valid articulation angle message must be available at each time update.
Test Description and Success Criteria
The unit test for this module is located in test_facetedSpacecraftModel. The test verifies that the module correctly transforms facet geometry data from the local facet frames to the spacecraft hub body frame. This test sets up the module with two facets. The first facet articulates while the second is fixed.
The simulation is executed in two chunks. Between chunks, the articulating facet angle message is updated to verify
the module correctly handles facet articulation changes. The test is parameterized over the initial,
intermediate, and final articulating facet angles, and the fixed facet initial angle. The test checks that the facet
geometry data is correctly transformed to the spacecraft hub body frame. The specific variables checked are the facet
center of pressure locations r_CopB_B, the facet normal vectors nHat_B, and the facet articulation
axes rotHat_B. The simulation values are checked to match the computed truth values with an absolute tolerance
of 1e-12.
User Guide
The following steps are required to set up the facetedSpacecraftModel module in Python.
Import the module:
from Basilisk.simulation import facetedSpacecraftModel
Create the module and set the total number of facets:
faceted_sc_model = facetedSpacecraftModel.FacetedSpacecraftModel() faceted_sc_model.ModelTag = "facetedSCModel" faceted_sc_model.setNumTotalFacets(1)
For each articulating facet, create a
HingedRigidBodyMsgPayloadmessage and add it:articulated_facet_angle_message_data = messaging.HingedRigidBodyMsgPayload() articulated_facet_angle_message_data.theta = 10 * macros.D2R # [rad] articulated_facet_angle_message_data.thetaDot = 0.0 # [rad] articulated_facet_angle_message = messaging.HingedRigidBodyMsg().write(articulated_facet_angle_message_data) faceted_sc_model.addArticulatedFacet(articulated_facet_angle_message)
Create and connect the facet geometry input messages. For example:
articulated_facet_element_message_data = messaging.FacetElementMsgPayload( area = 0.5, r_CopF_F = np.array([-0.1, 0.1, -0.1]), nHat_F = np.array([1.0, 0.0, 0.0]), rotHat_F = np.array([0.0, 1.0, 0.0]), dcm_F0B = facet_dcm_F0B, r_FB_B = np.array([0.0, 1.0, 0.0]), c_diffuse = 0.1, c_specular = 0.9, ) articulated_facet_element_message = messaging.FacetElementMsg().write(articulated_facet_element_message_data) faceted_sc_model.facetElementInMsgs[0].subscribeTo(articulated_facet_element_message)
Add the module to a task:
sim.AddModelToTask(task_name, faceted_sc_model)
Optionally, log each body frame facet output message:
facet_element_body_data_log = [] for outMsg in faceted_sc_model.facetElementBodyOutMsgs: facet_element_body_data_log.append(outMsg.recorder()) test_sim.AddModelToTask(task_name, facet_element_body_data_log[-1])
-
class FacetedSpacecraftModel : public SysModel
- #include <facetedSpacecraftModel.h>
Faceted Spacecraft model.
Public Functions
-
FacetedSpacecraftModel() = default
Constructor.
-
~FacetedSpacecraftModel() override
Destructor.
-
void Reset(uint64_t callTime) override
Reset method.
This method resets required module variables and checks the input messages to ensure they are linked.
- Parameters:
callTime – [ns] Time the method is called
-
void UpdateState(uint64_t callTime) override
Update method.
Module update method.
- Parameters:
callTime – [s] Time the method is called
-
void writeOutputMessages(uint64_t callTime)
Method to write output messages.
Method to write module output messages.
- Parameters:
callTime – [s] Time the method is called
-
void addArticulatedFacet(Message<HingedRigidBodyMsgPayload> *tmpMsg)
Method required to add articulated facets.
This method subscribes the articulated facet angle input messages to the module articulatedFacetDataInMsgs input messages.
- Parameters:
tmpMsg – hingedRigidBody input message containing facet articulation angle data
-
void setNumTotalFacets(const uint64_t numFacets)
Setter method for total number of spacecraft facets.
Setter method for the total number of spacecraft facets.
- Parameters:
numFacets – [-]
-
const uint64_t getNumTotalFacets() const
Getter method for total number of spacecraft facets.
Getter method for the total number of spacecraft facets.
- Returns:
const uint64_t
Public Members
-
std::vector<ReadFunctor<HingedRigidBodyMsgPayload>> articulatedFacetDataInMsgs
Articulated facet angle data input message.
-
std::vector<ReadFunctor<FacetElementMsgPayload>> facetElementInMsgs
Facet geometry data input message (Expressed in facet frames).
-
std::vector<Message<FacetElementBodyMsgPayload>*> facetElementBodyOutMsgs
Facet geometry data output message (Expressed in hub B frame).
-
BSKLogger *bskLogger = nullptr
BSK logging.
Private Members
-
uint64_t numFacets = {}
Total number of spacecraft facets.
-
uint64_t numArticulatedFacets = {}
Number of articulated facets.
-
std::vector<ReadFunctor<HingedRigidBodyMsgPayload>> articulatedFacetRequestInMsgs
Pending list of articulated facet input messages.
-
std::vector<double> facetAreaList
[m^2] List of facet areas
-
std::vector<Eigen::Vector3d> facetR_CopF_FList
[m] List of facet center of pressure locations wrt facet frame origin point F
-
std::vector<Eigen::Vector3d> facetNHat_FList
[-] List of facet normal vectors expressed in facet frame F components
-
std::vector<Eigen::Vector3d> facetRotHat_FList
[-] List of facet rotation axes expressed in facet frame F components
-
std::vector<Eigen::Matrix3d> facetDcm_F0BList
[-] List of initial facet attitudes relative to hub B frame
-
std::vector<Eigen::Vector3d> facetR_FB_BList
[m] List of facet locations relative to hub frame origin point B
-
std::vector<double> facetDiffuseCoeffList
[-] List of facet diffuse reflection optical coefficient list
-
std::vector<double> facetSpecularCoeffList
[-] List of facet specular reflection optical coefficient list
-
std::vector<Eigen::Vector3d> facetR_CopB_BList
[m] List of facet center of pressure locations wrt point B expressed in B frame components
-
FacetedSpacecraftModel() = default