Module: inertialCartFeedback

Executive Summary

The inertialCartFeedback module computes an inertial-frame deputy force command for translational tracking of a desired deputy inertial state. This module uses Lyapunov control theory described in chapter 14 of Analytical Mechanics of Space Systems.

The control force \(\mathbf{F}_N\) used in this module is found through Eq. (1):

(1)\[\mathbf{F}_N = -m_d\left(\mathbf{a}_d - \mathbf{a}_d^*\right) - m_d[K]\Delta \mathbf{r} - m_d[P]\Delta \dot{\mathbf{r}} + \mathbf{F}_N^*\]

where

(2)\[\Delta \mathbf{r} = \mathbf{r}_d - \mathbf{r}_d^*, \qquad \Delta \dot{\mathbf{r}} = \dot{\mathbf{r}}_d - \dot{\mathbf{r}}_d^*\]

\(m_d\) is the deputy mass, and a superscript * denotes the desired state.

The gravity-difference term is found using:

(3)\[\mathbf{a}_d = -\mu \frac{\mathbf{r}_d}{\|\mathbf{r}_d\|^3}, \qquad \mathbf{a}_d^* = -\mu \frac{\mathbf{r}_d^*}{\|\mathbf{r}_d^*\|^3}\]

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

deputyTransInMsg

NavTransMsgPayload

Deputy inertial position and velocity input msg

deputyTransDesiredInMsg

NavTransMsgPayload

Desired deputy inertial position and velocity input msg

deputyVehicleConfigInMsg

VehicleConfigMsgPayload

Deputy spacecraft configuration input msg

forceFeedforwardInMsg

CmdForceInertialMsgPayload

(Optional) inertial feed-forward force input msg

forceOutMsg

CmdForceInertialMsgPayload

Inertial force command output msg

User Guide

This section outlines the steps needed to set up the inertialCartFeedback module in Python using Basilisk.

  1. Import the module:

    from Basilisk.fswAlgorithms import inertialCartFeedback
    
  2. Create an instance of InertialCartFeedback:

    module = inertialCartFeedback.InertialCartFeedback()
    
  3. Set gain matrices using row-major flattened 3x3 lists:

    K = [2.0e-5, 0.0, 0.0,
         0.0, 3.0e-5, 0.0,
         0.0, 0.0, 4.0e-5]
    P = [5.0e-2, 0.0, 0.0,
         0.0, 6.0e-2, 0.0,
         0.0, 0.0, 7.0e-2]
    module.setK(K)
    module.setP(P)
    
  4. (Optional) set mu for gravity compensation:

    module.setMu(3.986004418e14)
    
  5. Add the module to a task:

    unitTestSim.AddModelToTask(unitTaskName, module)
    

class InertialCartFeedback : public SysModel
#include <inertialCartFeedback.h>

Inertial Cartesian translational feedback controller for deputy desired-state tracking.

Public Functions

InertialCartFeedback() = default

This is the constructor for the module class.

~InertialCartFeedback() = default

This is the destructor for the module class.

void SelfInit()

Self initialization method for the c-wrapped message.

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 inertial force for the relative motion control.

void setMu(const double value)

setter for mu

inline double getMu() const

getter for mu

void setK(const std::vector<double> &value)

setter for K

inline Eigen::Matrix3d getK() const

getter for K

void setP(const std::vector<double> &value)

setter for P

inline Eigen::Matrix3d getP() const

getter for P

Public Members

ReadFunctor<NavTransMsgPayload> deputyTransInMsg

deputy translational navigation input msg

ReadFunctor<NavTransMsgPayload> deputyTransDesiredInMsg

desired deputy translational navigation input msg

ReadFunctor<VehicleConfigMsgPayload> deputyVehicleConfigInMsg

deputy spacecraft mass/config input msg

ReadFunctor<CmdForceInertialMsgPayload> forceFeedforwardInMsg

(optional) inertial feed-forward thrust for non-natural deputy motion input msg

Message<CmdForceInertialMsgPayload> forceOutMsg

inertial force command output msg

CmdForceInertialMsg_C forceOutMsgC = {}

C-wrapped inertial force output msg.

BSKLogger bskLogger

BSK logging interface.

Private Members

double deputyMass

[kg] deputy system mass

double mu = -1

[m^3/s^2] (optional) gravitational parameter

bool setKFlag = false

flag to check if K has been set

bool setPFlag = false

flag to check if P has been set

Eigen::Matrix3d K

[1/s^2] proportional acceleration gain (mass-scaled in force law)

Eigen::Matrix3d P

[1/s] derivative acceleration gain (mass-scaled in force law)