Module: thrJointCompensation
Executive Summary
The thrJointCompensation module determines the motor torques for an array of hinged joints as required to ensure zero acceleration of the joints during thruster firing.
Note
This module is designed to work for systems with multiple spacecraft with multiple thruster arms, however, each spacecraft must be comprised of six degree-of-freedom rigid hub with attached arms comprised of hinged joints and pure force thrusters only.
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg connection 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 |
|---|---|---|
armConfigInMsg |
static spacecraft configuration input msg |
|
massMatrixInMsg |
system mass matrix input msg |
|
reactionForcesInMsg |
joint reaction forces and torques input msg |
|
jointStatesInMsgs |
vector of joint state input msgs |
|
thrForcesInMsgs |
vector of thruster force input msgs |
|
motorTorquesOutMsgs |
vector of joint motor torque output msgs |
User Guide
This section is to outline the steps needed to set up the thrJointCompensation module in Python using Basilisk.
Import the thrJointCompensation class:
from Basilisk.fswAlgorithms import thrJointCompensation
Create an instance of thrJointCompensation:
module = thrJointCompensation.ThrJointCompensation()
(Optional) set the maximum motor torque values:
uMax = [1e-6] * (numJoints * numArms * numSpacecraft) module.setUMax(uMax)
For each hinged joint in the system, add a hinged joint to the module:
module.addHingedJoint()
For each thruster in the system, add a thruster to the module:
module.addThruster()
Add the module to the task list:
unitTestSim.AddModelToTask(unitTaskName, module)
-
class ThrJointCompensation : public SysModel
- #include <thrJointCompensation.h>
This module determines the motor torques needed to compensate for the disturbance torques caused by the current system configuration and the thrusters when they are firing.
Public Functions
-
ThrJointCompensation() = default
This is the constructor for the module class.
-
~ThrJointCompensation() = default
This is the destructor for the module class.
-
void Reset(uint64_t CurrentSimNanos)
This method is used to reset the module and checks that required input messages are connected.
-
void UpdateState(uint64_t CurrentSimNanos)
This is the main method that gets called every time the module is updated. It computes the motor torques for the full array of hinged joints.
-
void setUMax(std::vector<double>)
setter for
uMaxproperty
-
inline std::vector<double> getUMax() const
getter for
uMaxproperty
-
void addHingedJoint()
method for adding a new hinged joint to the system
-
void addThruster()
method for adding a new thruster to the system
Public Members
-
ReadFunctor<THRArmConfigMsgPayload> armConfigInMsg
static spacecraft configuration input msg
-
ReadFunctor<MJSysMassMatrixMsgPayload> massMatrixInMsg
system mass matrix input msg
-
ReadFunctor<MJJointReactionsMsgPayload> reactionForcesInMsg
joint reaction forces and torques input msg
-
std::vector<ReadFunctor<ScalarJointStateMsgPayload>> jointStatesInMsgs
vector of joint state input msgs
-
std::vector<ReadFunctor<SingleActuatorMsgPayload>> thrForcesInMsgs
vector of thruster force input msgs
-
std::vector<Message<SingleActuatorMsgPayload>*> motorTorquesOutMsgs
vector of joint motor torque output msgs
-
BSKLogger bskLogger
BSK Logging.
Private Members
-
int numHingedJoints = 0
number of hinged joints in the system
-
int numThrusters = 0
number of thrusters in the system
-
std::vector<double> uMax = {}
[Nm] (optional) maximum joint motor torque
-
bool treeInfoInitialized = false
flag indicating if tree info has been initialized
-
int numKinematicTrees = 0
number of kinematic trees in the system
-
std::vector<int> hingeToTree
maps global hinge index to kinematic tree id
-
std::vector<JointPoseCache> jointPoseFlat
vector of flattened joint pose info
-
ArmKinematicsConfig kinCfg
struct holding the information from the static armConfigInMsg
-
struct TreeInfo
struct to hold info about each kinematic tree
-
struct JointPoseCache
struct to hold the pose information for each joint
-
struct ArmKinematicsConfig
Public Members
-
std::vector<int> thrArmIdx
-
std::vector<int> thrArmJointIdx
-
std::vector<int> armTreeIdx
-
std::vector<int> armJointStart
-
std::vector<int> armJointCount
-
std::vector<int> armHingeGlobalIdx
-
std::vector<double> r_CP_P
-
std::vector<double> r_TP_P
-
std::vector<double> shat_P
-
std::vector<double> fhat_P
-
std::vector<double> dcm_C0P
-
std::vector<int> thrArmIdx
-
ThrJointCompensation() = default