Module: jointMotionCompensator

Executive Summary

The jointMotionCompensator module determines the hub torques required to negate the effect of hinged joint motor torques on the spacecraft hub motion.

Note

This module is designed to work for systems with multiple spacecraft, however, each spacecraft must be comprised of six degree-of-freedom rigid hub with attached hinged joints 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

massMatrixInMsg

MJSysMassMatrixMsgPayload

system mass matrix input msg

reactionForcesInMsg

MJJointReactionsMsgPayload

joint reaction forces and torques input msg

jointTorqueInMsgs

SingleActuatorMsgPayload

vector of joint motor torque input msgs

hubTorqueOutMsgs

SingleActuatorMsgPayload

vector of hub torque output msgs

User Guide

This section is to outline the steps needed to setup the jointMotionCompensator module in Python using Basilisk.

  1. Import the jointMotionCompensator class:

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

    module = jointMotionCompensator.JointMotionCompensator()
    
  3. (Optional) Set the maximum hub torque values:

    uMax = [0.03] * (3 * numSpacecraft)
    module.setUMax(uMax)
    
  4. For each spacecraft in the system, add a spacecraft to the module:

    module.addSpacecraft()
    
  5. For each hinged joint in the system, add a hinged joint to the module:

    module.addHingedJoint()
    
  6. Add the module to the task list:

    unitTestSim.AddModelToTask(unitTaskName, module)
    

class JointMotionCompensator : public SysModel
#include <jointMotionCompensator.h>

This module determines the hub torques required to negate the reaction torques induced by moving joints on a spacecraft.

Public Functions

JointMotionCompensator() = default

This is the constructor for the module class.

~JointMotionCompensator() = 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 hub torques needed to negate the reaction torques induced by moving joints.

void setUMax(std::vector<double>)

setter for uMax property

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

getter for uMax property

void addSpacecraft()

method for adding a new spacecraft to the system

void addHingedJoint()

method for adding a new hinged joint to the system

Public Members

ReadFunctor<MJSysMassMatrixMsgPayload> massMatrixInMsg

system mass matrix input msg

ReadFunctor<MJJointReactionsMsgPayload> reactionForcesInMsg

joint reaction forces and torques input msg

std::vector<ReadFunctor<SingleActuatorMsgPayload>> jointTorqueInMsgs

vector of joint motor torque input msgs

std::vector<Message<SingleActuatorMsgPayload>*> hubTorqueOutMsgs

vector of hub torque output msgs

BSKLogger bskLogger

BSK Logging.

Private Members

std::vector<double> uMax = {}

[Nm] (optional) maximum hub motor torque

int numSpacecraft = 0

[-] number of spacecraft in the system

int numHingedJoints = 0

[-] number of hinged joints in the system

bool treeInfoInitialized = false

[-] flag indicating if the treeInfo struct has been initialized

std::unordered_map<int, TreeInfo> treeMap

map holding tree info for each kinematic tree

struct TreeInfo

Public Members

int freeJointIdx = -1

[-] free joint index

std::vector<int> hingeJointIdxs

[-] per-tree hinged joint indices

std::vector<int> hingeGlobalIdxs

[-] global indices of hinged joints