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.

Module I/O Messages

Msg Variable Name

Msg Type

Description

armConfigInMsg

THRArmConfigMsgPayload

static spacecraft configuration input msg

massMatrixInMsg

MJSysMassMatrixMsgPayload

system mass matrix input msg

reactionForcesInMsg

MJJointReactionsMsgPayload

joint reaction forces and torques input msg

jointStatesInMsgs

ScalarJointStateMsgPayload

vector of joint state input msgs

thrForcesInMsgs

SingleActuatorMsgPayload

vector of thruster force input msgs

motorTorquesOutMsgs

SingleActuatorMsgPayload

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.

  1. Import the thrJointCompensation class:

    from Basilisk.fswAlgorithms import thrJointCompensation
    
  2. Create an instance of thrJointCompensation:

    module = thrJointCompensation.ThrJointCompensation()
    
  3. (Optional) set the maximum motor torque values:

    uMax = [1e-6] * (numJoints * numArms * numSpacecraft)
    module.setUMax(uMax)
    
  4. For each hinged joint in the system, add a hinged joint to the module:

    module.addHingedJoint()
    
  5. For each thruster in the system, add a thruster to the module:

    module.addThruster()
    
  6. 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 uMax property

inline std::vector<double> getUMax() const

getter for uMax property

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::unordered_map<int, TreeInfo> treeMap

map from kinematic tree index to tree info

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

Public Members

int freeJointIdx = -1
std::vector<int> hingeJointIdxs
std::vector<int> hingeGlobalIdxs
struct JointPoseCache

struct to hold the pose information for each joint

Public Members

Eigen::Matrix3d dcm_CB
Eigen::Vector3d r_CB_B
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