C++ Module: hubEffector

This class is an instantiation of the stateEffector abstract class and is for the hub of the s/c. The hub has 4 states: r_BN_N, rDot_BN_N, sigma_BN and omega_BN_B. The hub utilizes the Backsubstitution Method for calculating its derivatives using contributions from C++ Module: stateEffector and C++ Module: dynamicEffector.

Configuration Validation

The owning spacecraft validates the hub before initializing dynamics. mHub must be finite and strictly positive. The center-of-mass offset r_BcB_B and initial position, velocity, MRP attitude, and angular velocity (r_CN_NInit, v_CN_NInit, sigma_BNInit, and omega_BN_BInit) must contain only finite values. Inertia entries must also be finite. Invalid configuration raises BasiliskError before state registration.

These finite-value checks apply to both full spacecraft dynamics and pointMassTranslationalOnly mode. Point-mass mode requires an exactly zero center offset and permits finite zero or singular inertia tensors because rotational dynamics are omitted. The full dynamics mode additionally requires a physically realizable inertia tensor. Initial attitude, angular velocity, and inertia still require finite values in point-mass mode because force transformations or output messages use them, including without attached effectors.


class HubEffector : public StateEffector
#include <hubEffector.h>

spaecraft hub effector class

Public Functions

HubEffector()

Constructor.

This is the constructor, setting variables to default values

~HubEffector()

Destructor.

This is the destructor, nothing to report here

virtual void linkInStates(DynParamManager &statesIn)

Method to give the hub access to states.

This method allows the hub access to gravity and also gets access to the properties in the dyn Manager because uses these values in the computeDerivatives method call

Parameters:

statesIn – [in] Dynamic parameter manager containing the required states.

virtual void registerStates(DynParamManager &states)

Method for the hub to register some states.

This method allows the hub to register its states: r_BN_N, v_BN_N, sigma_BN and omega_BN_B

Parameters:

states – [inout] Dynamic parameter manager used to register states or properties.

void registerTranslationalStates(DynParamManager &states)

Register only translational hub states.

This method allows the hub to register only translational states: r_BN_N and v_BN_N

Parameters:

states – [inout] Dynamic parameter manager used to register states or properties.

void registerAttitudeStates(DynParamManager &states)

Register constant attitude hub states.

This method allows the hub to register fixed attitude states for point-mass dynamics with dynamic effectors

Parameters:

states – [inout] Dynamic parameter manager used to register states or properties.

virtual void updateEffectorMassProps(double integTime)

Method for the hub to update its mass props for the s/c.

This method allows the hub to give its mass properties to the spacecraft

Parameters:

integTime – [in] [s] Current integration time.

virtual void computeDerivatives(double integTime, Eigen::Vector3d rDDot_BN_N, Eigen::Vector3d omegaDot_BN_B, Eigen::MRPd sigma_BN)

Method for the hub to compute it’s derivatives.

This method is for computing the derivatives of the hub: rDDot_BN_N and omegaDot_BN_B, along with the kinematic 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 computeHubOnlyDerivatives(const Eigen::Vector3d &forceExternal_N, const Eigen::Vector3d &forceExternal_B, const Eigen::Vector3d &torquePntB_B)

Compute direct hub derivatives.

This method computes direct derivatives for a fixed-mass hub-only spacecraft whose body frame origin is at the hub center of mass.

Parameters:
  • forceExternal_N – [in] [N] External force expressed in inertial-frame components.

  • forceExternal_B – [in] [N] External force expressed in body-frame components.

  • torquePntB_B – [in] [N*m] External torque about point B in body-frame components.

virtual void updateEnergyMomContributions(double integTime, Eigen::Vector3d &rotAngMomPntCContr_B, double &rotEnergyContr, Eigen::Vector3d omega_BN_B)

Add contributions to energy and momentum.

This method is for computing the energy and momentum contributions from the hub

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.

virtual void modifyStates(double integTime)

Method to switch MRPs.

This method is for switching the MRPs

Parameters:

integTime – [in] [s] Current integration time.

virtual void prependSpacecraftNameToStates()

class method

void matchGravitytoVelocityState(Eigen::Vector3d v_CN_N)

method to set the gravity velocity to base velocity

This method is used to set the gravitational velocity state equal to the base velocity state

Parameters:

v_CN_N – [in] [m/s] Unused center-of-mass velocity retained for interface compatibility.

void validateConfiguration(bool pointMassTranslationalOnly = false)

Validate finite hub configuration before initializing dynamics.

Validate the configured hub properties before the owning spacecraft initializes dynamics.

Note

Both modes require positive finite mass and finite initial states and inertia entries.

Parameters:

pointMassTranslationalOnly – Whether to require a zero center offset and skip inertia realizability checks.

Public Members

double mHub

[kg] mass of the hub

uint64_t MRPSwitchCount

Count on times we’ve shadowed.

std::string nameOfHubPosition

Identifier for hub position states.

std::string nameOfHubVelocity

Identifier for hub velocity states.

std::string nameOfHubSigma

Identifier for hub sigmaBN states.

std::string nameOfHubOmega

Identifier for hub omegaBN_B states.

std::string nameOfHubGravVelocity

Identified for hub gravitational DV state.

std::string nameOfBcGravVelocity

Identified for point Bc gravitational DV state.

Eigen::Vector3d r_BcB_B

[m] vector from point B to CoM of hub in B frame components

Eigen::Matrix3d IHubPntBc_B

[kg m^2] Inertia of hub about point Bc in B frame components

BackSubMatrices hubBackSubMatrices

class method

Eigen::Vector3d r_CN_NInit

[m] Initial position of the spacecraft wrt to base

Eigen::Vector3d v_CN_NInit

[m/s Initial velocity of the spacecraft wrt base

Eigen::Vector3d sigma_BNInit

Initial attitude of the spacecraft wrt base.

Eigen::Vector3d omega_BN_BInit

[r/s] Initial attitude rate of the spacecraf wrt base

BSKLogger bskLogger

BSK Logging.

Private Members

Eigen::Vector3d r_BcP_P

[m] vector from point B to CoM of hub in B frame components

Eigen::Matrix3d IHubPntBc_P

[kg m^2] Inertia of hub about point Bc in B frame components

Eigen::MatrixXd *g_N

[m/s^2] Gravitational acceleration in N frame components

StateData *posState

[-] State data container for hub position

StateData *velocityState

[-] State data container for hub velocity

StateData *sigmaState

[-] State data container for hub sigma_BN

StateData *omegaState

[-] State data container for hub omegaBN_B

StateData *gravVelocityState

[-] State data container for hub gravitational velocity

StateData *gravVelocityBcState

[-] State data container for point Bc gravitational velocity