C++ Module: dualHingedRigidBodyStateEffector
Executive Summary
Class to represent a solar array of two panels. The first panel is hinged on a single axis to the spacecraft body. The second panel is hinged to the first panel by a parallel axis on the opposite end of the first panel from the spacecraft body.)
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg variable name is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
motorTorqueInMsg |
(Optional) Input message of the two hinge motor torque values. |
|
dualHingedRigidBodyOutMsgs |
vector of output message containing the panel 1 and 2 hinge state angle and angle rate. |
|
dualHingedRigidBodyConfigLogOutMsgs |
vector of output messages containing the panel 1 and 2 inertial position and attitude states. |
Initialization and Reset
mass1 and mass2 must each be finite and non-negative. Their sum must be finite and
strictly positive because the model divides by the combined mass when computing the center
of mass. Either panel may have zero mass if the configured inertias permit nonsingular hinge
dynamics. dcm_H1B must be a finite, orthogonal, right-handed rotation matrix; scaled axes
and reflections are rejected.
These checks run before state registration during spacecraft initialization, including when
the effector is attached without being added to a task. Reset() performs the same checks
without accessing parent states or changing integrated hinge states or motor commands.
Invalid configurations raise BasiliskError. See Initialization and Configuration Validation.
Detailed Module Description
The module PDF Module Description contains further information on this module’s function, as well as testing.
User Guide
This section is to outline the steps needed to setup a Hinged Rigid Body State Effector in python using Basilisk.
Import the dualHingedRigidBodyStateEffector class:
from Basilisk.simulation import dualHingedRigidBodyStateEffector
Create an instantiation of a Dual Hinged Rigid body:
panel1 = dualHingedRigidBodyStateEffector.DualHingedRigidBodyStateEffector()
Define all physical parameters for a Dual Hinged Rigid Body. For example:
IPntS1_S1 = [[100.0, 0.0, 0.0], [0.0, 50.0, 0.0], [0.0, 0.0, 50.0]]
Do this for all of the parameters for a Dual Hinged Rigid Body seen in the public variables in the .h file.
Define the initial conditions of the states:
panel1.theta1Init = 5*numpy.pi/180.0 panel1.theta1DotInit = 0.0 panel1.theta2Init = 5*numpy.pi/180.0 panel1.theta2DotInit = 0.0
(Optional) Define a unique name for each state:
panel1.nameOfTheta1State = "dualHingedRigidBodyTheta1" panel1.nameOfTheta1DotState = "dualHingedRigidBodyThetaDot1" panel1.nameOfTheta2State = "dualHingedRigidBodyTheta2" panel1.nameOfTheta2DotState = "dualHingedRigidBodyThetaDot2"
Define an optional motor torque input message with
panel1.motorTorqueInMsgThe module creates two output messages with the panel angular states. The messages are stored in the vector
dualHingedRigidBodyOutMsgs.The module creates two output messages with each panel inertial position and attitude states. The messages are stored in the vector
dualHingedRigidBodyConfigLogOutMsgs.Add the panel to your spacecraft:
scObject.addStateEffector(panel1)
Add the module to the task list:
unitTestSim.AddModelToTask(unitTaskName, panel1)
Hosting a Dynamic Effector
This effector supports the branching described in Advanced: Effector Module Branching, so a compatible dynamic effector can be carried by one of the panels rather than by the hub:
panel1.addDynamicEffector(childEffector, segment)
Here segment is the one-based panel number, counting outward from the hub, so 1 is the
panel attached to the hub.
This effector then makes its inertial position, velocity, attitude, and angular velocity available in place of the hub’s, and the child reads whichever of the four its model needs. Any geometry given to the child is expressed in that panel’s frame rather than the hub body frame. Both this effector and the child are still added to the task in the usual way.
-
class DualHingedRigidBodyStateEffector : public StateEffector, public SysModel
- #include <dualHingedRigidBodyStateEffector.h>
dual hinged rigid body state effector
Public Functions
-
DualHingedRigidBodyStateEffector()
-
~DualHingedRigidBodyStateEffector()
-
void addDynamicEffector(DynamicEffector *newDynamicEffector, int segment) override
Method for adding attached dynamic effector.
This method attaches a dynamicEffector to one of the two panels
- Parameters:
newDynamicEffector – the dynamic effector to be attached
segment – the panel to attach to, either 1 or 2
-
void registerProperties(DynParamManager &states) override
Method for registering the panel inertial properties.
This method registers the panel inertial properties with the dynamic parameter manager and links them into dependent dynamic effectors
- Parameters:
states – [inout] Dynamic parameter manager used to register states or properties.
-
void registerStates(DynParamManager &statesIn) override
class method
Register the effector dynamics states.
- Parameters:
statesIn – [inout] Dynamic parameter manager used to register states or properties.
-
void linkInStates(DynParamManager &states) override
class method
Link the required dynamics states.
- Parameters:
states – [in] Dynamic parameter manager containing the required states.
-
void updateEffectorMassProps(double integTime) override
class method
Update the effector mass properties.
- Parameters:
integTime – [in] [s] Current integration time.
-
void updateContributions(double integTime, BackSubMatrices &backSubContr, Eigen::MRPd sigma_BN, Eigen::Vector3d omega_BN_B, Eigen::Vector3d g_N) override
Back-sub contributions.
Update the effector Backsubstitution contributions.
- Parameters:
integTime – [in] [s] Current integration time.
backSubContr – [inout] Backsubstitution contributions.
sigma_BN – [in] Hub attitude relative to the inertial frame.
omega_BN_B – [in] [rad/s] Hub angular velocity expressed in body-frame components.
g_N – [in] [m/s^2] Gravitational acceleration expressed in inertial-frame components.
-
void updateEnergyMomContributions(double integTime, Eigen::Vector3d &rotAngMomPntCContr_B, double &rotEnergyContr, Eigen::Vector3d omega_BN_B) override
Energy and momentum calculations.
This method is for calculating the contributions of the DHRB state effector to the energy and momentum of the s/c
- Parameters:
integTime – [in] [s] Current integration time.
rotAngMomPntCContr_B – [inout] [kg*m^2/s] Rotational angular momentum contribution.
rotEnergyContr – [inout] [J] Rotational energy contribution.
omega_BN_B – [in] [rad/s] Hub angular velocity expressed in body-frame components.
-
void computeDerivatives(double integTime, Eigen::Vector3d rDDot_BN_N, Eigen::Vector3d omegaDot_BN_B, Eigen::MRPd sigma_BN) override
Method for each stateEffector to calculate derivatives.
Compute the effector state derivatives.
- Parameters:
integTime – [in] [s] Current integration time.
rDDot_BN_N – [in] [m/s^2] Hub translational acceleration expressed in inertial-frame components.
omegaDot_BN_B – [in] [rad/s^2] Hub angular acceleration expressed in body-frame components.
sigma_BN – [in] Hub attitude relative to the inertial frame.
-
void Reset(uint64_t CurrentSimNanos) override
Validate configuration without changing integrated states or commands.
- Parameters:
CurrentSimNanos – [in] [ns] Current simulation time.
-
void UpdateState(uint64_t CurrentSimNanos) override
This method is used so that the simulation will ask DHRB to update messages.
- Parameters:
CurrentSimNanos – The current simulation time in nanoseconds
-
void writeOutputStateMessages(uint64_t CurrentClock) override
This method takes the computed theta states and outputs them to the m messaging system.
- Parameters:
CurrentClock – The current simulation time (used for time stamping)
Public Members
-
double mass1
[kg] mass of 1st hinged rigid body
-
double mass2
[kg] mass of 2nd hinged rigid body
-
double d1
[m] distance from hinge point H1 to hinged rigid body center of mass S1
-
double d2
[m] distance from hinge point H2 to hinged rigid body center of mass S2
-
double l1
[m] distance from hinge point H1 to hinged point H2
-
double k1
[N-m/rad] torsional spring constant of hinge
-
double k2
[N-m/rad] torsional spring constant of hinge
-
double c1
[N-m-s/rad] rotational damping coefficient of hinge
-
double c2
[N-m-s/rad] rotational damping coefficient of hinge
-
double theta1Init
[rad] Initial hinged rigid body angle for first panel
-
double theta1DotInit
[rad/s] Initial hinged rigid body angle rate for first panel
-
double theta2Init
[rad] Initial hinged rigid body angle for second panel
-
double theta2DotInit
[rad/s] Initial hinged rigid body angle rate for second panel
-
Eigen::Matrix3d IPntS1_S1
[kg-m^2] Inertia of hinged rigid body about point S in S frame components
-
Eigen::Matrix3d IPntS2_S2
[kg-m^2] Inertia of hinged rigid body about point S in S frame components
-
double thetaH2S1
[-] theta offset of H2 frame with respect to S1 frame
-
std::string nameOfTheta1State
[-] Identifier for the theta state data container
-
std::string nameOfTheta1DotState
[-] Identifier for the thetaDot state data container
-
std::string nameOfTheta2State
[-] Identifier for the theta state data container
-
std::string nameOfTheta2DotState
[-] Identifier for the thetaDot state data container
-
std::string nameOfInertialPositionProperty1
identifier for the panel 1 inertial position property
-
std::string nameOfInertialVelocityProperty1
identifier for the panel 1 inertial velocity property
-
std::string nameOfInertialAttitudeProperty1
identifier for the panel 1 inertial attitude property
-
std::string nameOfInertialAngVelocityProperty1
identifier for the panel 1 inertial angular velocity property
-
std::string nameOfInertialPositionProperty2
identifier for the panel 2 inertial position property
-
std::string nameOfInertialVelocityProperty2
identifier for the panel 2 inertial velocity property
-
std::string nameOfInertialAttitudeProperty2
identifier for the panel 2 inertial attitude property
-
std::string nameOfInertialAngVelocityProperty2
identifier for the panel 2 inertial angular velocity property
-
BSKLogger bskLogger
BSK Logging.
-
ReadFunctor<ArrayMotorTorqueMsgPayload> motorTorqueInMsg
(optional) motor torque input message
-
std::vector<Message<HingedRigidBodyMsgPayload>*> dualHingedRigidBodyOutMsgs
state output message vector for all panels
-
std::vector<Message<SCStatesMsgPayload>*> dualHingedRigidBodyConfigLogOutMsgs
panel state config log message vector for all panels
-
std::vector<DynamicEffector*> dynEffectors
Vector of dynamic effectors attached.
-
std::vector<int> dynEffectorSegments
Segment index for each attached dynamic effector.
Private Functions
-
void computePanelInertialStates()
This method computes the panel states relative to the inertial frame
-
void prependSpacecraftNameToStates() override
class method used for multiple spacecraft
-
template<typename Type>
inline void assignStateParamNames(Type effector, int segment) Assign the state engine parameter names
-
void validateConfiguration()
Validate panel masses and the configured hinge-frame DCM.
Validate panel masses and the fixed hinge orientation before state registration.
Private Members
-
Eigen::Vector3d r_H1P_P
[m] vector pointing from primary body frame P origin to Hinge 1 location. If a single spacecraft body is modeled than P is the same as B
-
double u1
[N-m] motor torques on panel 1
-
double u2
[N-m] motor torques on panel 2
-
Eigen::Vector3d r_S1P_P
[-] Vector pointing from body origin to CoM of hinged rigid body in P frame comp
-
Eigen::Vector3d r_S2P_P
[-] Vector pointing from body origin to CoM of hinged rigid body in P frame comp
-
Eigen::Matrix3d IS1PrimePntS1_P
[kg-m^2/s] time body derivative IPntS in primary body frame components
-
Eigen::Matrix3d IS2PrimePntS2_P
[kg-m^2/s] time body derivative IPntS in primary body frame components
-
double theta1
[rad] hinged rigid body angle
-
double theta1Dot
[rad/s] hinged rigid body angle rate
-
double theta2
[rad] hinged rigid body angle
-
double theta2Dot
[rad/s] hinged rigid body angle rate
-
std::vector<Eigen::MatrixXd*> r_HN_N
[m] position vector of hinge point H relative to inertial frame
-
std::vector<Eigen::MatrixXd*> v_HN_N
[m/s] inertial velocity vector of H relative to inertial frame
-
Eigen::MRPd sigma_BN = {0.0, 0.0, 0.0}
Hub/Inertial attitude represented by MRP of body relative to inertial frame.
-
Eigen::Vector3d omega_BN_B = {0.0, 0.0, 0.0}
Hub/Inertial angular velocity vector in B frame components.
-
Eigen::MatrixXd *inertialPositionProperty
[m] r_N inertial position relative to system spice zeroBase/refBase
Private Static Attributes
-
static uint64_t effectorID = 1
[] ID number of this panel
-
DualHingedRigidBodyStateEffector()