Module: lambertSurfaceRelativeVelocity

Executive Summary

This module computes the required inertial spacecraft velocity \({}^N\mathbf{v}_{B/N}\) to satisfy the desired relative velocity to the surface \({}^S\mathbf{v}_{rel,des}\) at position \({}^N\mathbf{r}_{B/N}\) and (maneuver) time \(t\). The module takes into account the rotation and orientation of the celestial body, provided by the EphemerisMsgPayload. The spacecraft position \({}^N\mathbf{r}_{B/N}\) is provided by the second position vector \({}^N\mathbf{r}_{2}\) in LambertProblemMsgPayload, as this module is designed to be used at the end of a Lambert problem transfer arc. The surface frame S, in which the desired relative velocity vector is expressed in, is an East-North-Up frame (third unit vector is in the radial direction, first unit vector is perpendicular to the angular velocity vector of the celestial body and the radial direction, and the second unit vector completes the right-handed coordinate frame). Note that the frame is not fully defined when the angular velocity vector of the celestial body \(\mathbf{\omega}_{P/N}\) is zero. In this case, the frame S is defined using the inertial z vector \([0, 0, 1]\) instead of \(\mathbf{\omega}_{P/N}\). The computed required inertial spacecraft velocity and maneuver time are written to the DesiredVelocityMsgPayload output message.

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

lambertProblemInMsg

LambertProblemMsgPayload

lambert problem setup input message

ephemerisInMsg

EphemerisMsgPayload

ephemeris input message

desiredVelocityOutMsg

DesiredVelocityMsgPayload

Desired velocity output message

Algorithm

The required inertial spacecraft velocity is computed by:

(1)\[\mathbf{v}_{B/N} = \mathbf{\omega}_{P/N} \times \mathbf{r}_{B/N} + \mathbf{v}_{rel,des}\]

where \(\mathbf{\omega}_{P/N}\) is the angular velocity of the planet fixed frame P w.r.t. the inertial frame N.

User Guide

The module is first initialized as follows:

module = lambertSurfaceRelativeVelocity.LambertSurfaceRelativeVelocity()
module.ModelTag = "lambertSurfaceRelativeVelocity"
module.setVRelativeDesired_S(np.array([0., 0., 10.]))  # in surface frame (East-North-Up)
module.setTime(1000.)
unitTestSim.AddModelToTask(unitTaskName, module)

The input messages are then connected:

module.lambertProblemInMsg.subscribeTo(lambertProblemInMsg)
module.ephemerisInMsg.subscribeTo(ephemerisInMsg)

class LambertSurfaceRelativeVelocity : public SysModel
#include <lambertSurfaceRelativeVelocity.h>

This module computes the inertial velocity corresponding to a given position and relative velocity to the celestial body surface.

Public Functions

LambertSurfaceRelativeVelocity()

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

~LambertSurfaceRelativeVelocity()

Module Destructor

void Reset(uint64_t currentSimNanos) override

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

Parameters:

currentSimNanos – current simulation time in nano-seconds

Returns:

void

void UpdateState(uint64_t currentSimNanos) override

This is the main method that gets called every time the module is updated. It computes the solution of Lambert’s problem.

Parameters:

currentSimNanos – current simulation time in nano-seconds

Returns:

void

void setVRelativeDesired_S(const Eigen::Vector3d value)

setter for vRelativeDesired_S

inline Eigen::Vector3d getVRelativeDesired_S() const

getter for vRelativeDesired_S

void setTime(const double value)

setter for time

inline double getTime() const

getter for time

Public Members

ReadFunctor<LambertProblemMsgPayload> lambertProblemInMsg

lambert problem input message

ReadFunctor<EphemerisMsgPayload> ephemerisInMsg

ephemeris input message

Message<DesiredVelocityMsgPayload> desiredVelocityOutMsg

desired inertial velocity output message

BSKLogger bskLogger

BSK Logging.

Private Functions

void readMessages()

This method reads the input messages each call of updateState.

Returns:

void

void writeMessages(uint64_t currentSimNanos)

This method writes the output messages each call of updateState

Parameters:

currentSimNanos – current simulation time in nano-seconds

Returns:

void

Private Members

Eigen::Vector3d vRelativeDesired_S

[m/s] desired relative velocity, in surface frame S (East-North-Up)

double time = {}

[s] time for the desired velocity of the spacecraft

Eigen::Vector3d r_BN_N

[m] position of spacecraft, expressed in inertial frame N

Eigen::Vector3d v_BN_N

[m/s] velocity of spacecraft, expressed in inertial frame N

Eigen::Matrix3d dcm_PN

DCM of the orbital body fixed frame relative to inertial.

Eigen::Vector3d omega_PN_N

[r/s] angular velocity of the orbital body relative to inertial