Module: MJSystemCoM

Executive Summary

The MJSystemCoM module extracts the total system CoM position and velocity from a Mujoco scene with a single spacecraft.

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

comStatesOutMsg

SCStatesMsgPayload

spacecraft CoM states C++ output msg

comStatesOutMsgC

SCStatesMsgPayload

spacecraft CoM states C output msg

User Guide

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

  1. Import the MJSystemCoM class:

    from Basilisk.simulation import MJSystemCoM
    
  2. Enable extra EOM call when building the Mujoco scene:

    scene.extraEoMCall = True
    
  3. Create an instance of MJSystemCoM:

    module = MJSystemCoM.MJSystemCoM()
    
  4. Set the scene the module is attached to:

    module.scene = scene
    
  5. The MJSystemCoM output message is comStatesOutMsg.

  6. Add the module to the Mujoco scene dynamics task:

    scene.AddModelToDynamicsTask(module)
    

class MJSystemCoM : public SysModel
#include <MJSystemCoM.h>

This is a C++ module to extract the system CoM position and velocity from Mujoco.

Public Functions

MJSystemCoM()

This is the constructor for the module class. It sets default variable values and initializes the various parts of the model

~MJSystemCoM() = default
void SelfInit()

Initialize C-wrapped output messages

void Reset(uint64_t CurrentSimNanos)

This method is used to reset the module and checks that required input messages are connect.

void UpdateState(uint64_t CurrentSimNanos)

This extracts the total spacecraft CoM position and velocity

Public Members

MJScene *scene = {nullptr}

pointer to the MuJoCo scene

Message<SCStatesMsgPayload> comStatesOutMsg

spacecraft CoM states C++ output msg

SCStatesMsg_C comStatesOutMsgC = {}

spacecraft CoM states C output msg

BSKLogger bskLogger

BSK Logging.