Module: hingedJointArrayMotor

Executive Summary

The hingedJointArrayMotor module determines the motor torques for an array of hinged joints based on commanded angles and the current system configuration.

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. Additionally, the math assumes the reaction torques experienced by the hub due to the hinged joint motion are cancelled.

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

desJointStatesInMsg

JointArrayStateMsgPayload

Desired joint states input msg

jointStatesInMsg

ScalarJointStateMsgPayload

Vector of joint state input msgs

jointStateDotsInMsg

ScalarJointStateMsgPayload

Vector of joint state derivative input msgs

motorTorquesOutMsg

SingleActuatorMsgPayload

Vector of joint motor torque output msgs

User Guide

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

  1. Import the hingedJointArrayMotor class:

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

    module = hingedJointArrayMotor.HingedJointArrayMotor()
    
  3. Set the control gains:

    Ktheta = 10.0 * np.eye(numJoints * numSpacecraft)
    Ptheta = 2.0 * np.sqrt(10.0) * np.eye(numJoints * numSpacecraft)
    module.setKtheta(Ktheta.flatten().tolist())
    module.setPtheta(Ptheta.flatten().tolist())
    
  4. (Optional) set the maximum motor torque values:

    uMax = [0.03] * (numJoints * numSpacecraft)
    module.setUMax(uMax)
    
  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 HingedJointArrayMotor : public SysModel
#include <hingedJointArrayMotor.h>

This module determines the motor torques for an array of hinged joints based on commanded angles and the current system status.

Public Functions

HingedJointArrayMotor() = default

This is the constructor for the module class.

~HingedJointArrayMotor() = 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 setKtheta(std::vector<double>)

setter for Ktheta property

inline Eigen::MatrixXd getKtheta() const

getter for Ktheta property

void setPtheta(std::vector<double>)

setter for Ptheta property

inline Eigen::MatrixXd getPtheta() const

getter for Ptheta property

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

Public Members

ReadFunctor<MJSysMassMatrixMsgPayload> massMatrixInMsg

system mass matrix input msg

ReadFunctor<MJJointReactionsMsgPayload> reactionForcesInMsg

joint reaction forces and torques input msg

ReadFunctor<JointArrayStateMsgPayload> desJointStatesInMsg

desired joint states input msg

std::vector<ReadFunctor<ScalarJointStateMsgPayload>> jointStatesInMsgs

vector of joint state input msgs

std::vector<ReadFunctor<ScalarJointStateMsgPayload>> jointStateDotsInMsgs

vector of joint state derivative 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

Eigen::MatrixXd Ktheta = Eigen::MatrixXd{}

[1/s^2] proportional gain for hinged joints

Eigen::MatrixXd Ptheta = Eigen::MatrixXd{}

[1/s] proportional gain for hinged joints

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

map from kinematic tree index to tree info

struct TreeInfo

Public Members

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