Module: lambertPlanner
Executive Summary
Lambert’s problem aims at finding an orbit given two position vectors \(\mathbf{r}_{1}\) and \(\mathbf{r}_{2}\) and the time if flight \(t_{flight}\) between these two locations. That is, given the two position vectors \(\mathbf{r}_{1}\) and \(\mathbf{r}_{2}\) and the time of flight \(t_{flight}\), one finds the two velocity vectors \(\mathbf{v}_{1}\) and \(\mathbf{v}_{2}\) at the corresponding locations such that a spacecraft travels from \(\mathbf{r}_{1}\) to \(\mathbf{r}_{2}\) at the given time of flight.
This module assumes that \(\mathbf{r}_{2}\) is equal to a targeted location \({}^N\mathbf{r}_{T/N}\), and that the spacecraft should arrive at the targeted location at specified time \(t_{final}\). To get to the targeted location, a maneuver should be performed at specified time \(t_{maneuver}\), where the maneuver time must be in the future. The location of the maneuver is assumed to not be known, so a 4th order Runge-Kutta (RK4) is used to propagate the current state (obtained from the NavTransMsgPayload navigation input message) to obtain the estimated position at maneuver time, corresponding to \(\mathbf{r}_{1}\). In other words, this module takes a targeted location \({}^N\mathbf{r}_{T/N}\), final time \(t_{final}\), maneuver time \(t_{maneuver}\) and the spacecraft navigation message NavTransMsgPayload to compute the input parameters \(\mathbf{r}_{1}\), \(\mathbf{r}_{2}\) and time if flight \(t_{flight} = t_{final} - t_{maneuver}\) that are required to solve Lambert’s problem. This module writes these parameters to the LambertProblemMsgPayload message that is used as an input to the Module: lambertSolver module, which subsequently solves Lambert’s problem.
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.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
navTransInMsg |
translational navigation input message |
|
lambertProblemOutMsg |
lambert problem setup output message |
Module Assumptions and Limitations
The equations of motion used inside the module to propagate the state assume simple two body point mass gravity, and the motion is propagated using a 4th order Runge-Kutta (RK4). Additionally, this module assumes that \(t_{final} > t_{maneuver} \ge t\), with final time \(t_{final}\), maneuver time \(t_{maneuver}\) and current time \(t\).
Algorithm
Equations of motion (two body point mass gravity) with gravitational parameter \(\mu\) and spacecraft position vector \(\mathbf{r}\):
User Guide
The module is first initialized as follows:
module = lambertPlanner.LambertPlanner()
module.ModelTag = "lambertPlanner"
module.setR_TN_N(np.array([0., 8000. * 1000,0.]))
module.setFinalTime(2000.)
module.setManeuverTime(1000.)
module.setMu(3.986004418e14)
module.setNumRevolutions(0) # module defaults this value to 0 if not specified
module.useSolverIzzoMethod() # module uses Izzo by default if not specified
unitTestSim.AddModelToTask(unitTaskName, module)
The navigation translation message is then connected:
module.navTransInMsg.subscribeTo(navTransInMsg)
-
class LambertPlanner : public SysModel
- #include <lambertPlanner.h>
This module creates the LambertProblemMsg to be used for the LambertSolver module.
Public Functions
-
LambertPlanner()
This is the constructor for the module class. It sets default variable values and initializes the various parts of the model
-
~LambertPlanner()
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.
- Parameters:
currentSimNanos – current simulation time in nano-seconds
- Returns:
void
-
void useSolverIzzoMethod()
This method sets the lambert solver algorithm that should be used to the method by Izzo.
- Returns:
void
-
void useSolverGoodingMethod()
This method sets the lambert solver algorithm that should be used to the method by Gooding.
- Returns:
void
-
void setR_TN_N(const Eigen::Vector3d value)
setter for
r_TN_N
-
inline Eigen::Vector3d getR_TN_N() const
getter for
r_TN_N
-
void setFinalTime(const double value)
setter for
finalTime
-
inline double getFinalTime() const
getter for
finalTime
-
void setManeuverTime(const double value)
setter for
maneuverTime
-
inline double getManeuverTime() const
getter for
maneuverTime
-
void setMu(const double value)
setter for
mu
-
inline double getMu() const
getter for
mu
-
void setNumRevolutions(const int value)
setter for
numRevolutions
-
inline int getNumRevolutions() const
getter for
numRevolutions
Public Members
translational navigation input message
-
Message<LambertProblemMsgPayload> lambertProblemOutMsg
lambert problem output message
-
BSKLogger bskLogger
BSK Logging.
Private Functions
-
void readMessages()
This method reads the input messages each call of updateState. It also checks if the message contents are valid for this module.
- 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
-
std::pair<std::vector<double>, std::vector<Eigen::VectorXd>> propagate(const std::function<Eigen::VectorXd(double, Eigen::VectorXd)> &EOM, std::array<double, 2> interval, const Eigen::VectorXd &X0, double dt)
This method integrates the provided equations of motion using Runge-Kutta 4 (RK4) and returns the time steps and state vectors at each time step.
- Parameters:
EOM – equations of motion function to be propagated
interval – integration interval
X0 – initial state
dt – time step
- Returns:
std::pair<std::vector<double>, std::vector<Eigen::VectorXd>>
-
Eigen::VectorXd RK4(const std::function<Eigen::VectorXd(double, Eigen::VectorXd)> &ODEfunction, const Eigen::VectorXd &X0, double t0, double dt)
This method provides the 4th order Runge-Kutta (RK4)
- Parameters:
ODEfunction – function handle that includes the equations of motion
X0 – initial state
t0 – initial time
dt – time step
- Returns:
Eigen::VectorXd
Private Members
-
Eigen::Vector3d r_TN_N
[m] targeted position vector with respect to celestial body at finalTime, in N frame
-
double finalTime = {}
[s] time at which target position should be reached
-
double maneuverTime = {}
[s] time at which maneuver should be executed
-
double mu = {}
[m^3 s^-2] gravitational parameter
-
int numRevolutions = 0
[-] number of revolutions to be completed (completed orbits)
-
SolverMethod solverMethod
lambert solver algorithm (GOODING or IZZO)
-
double time = {}
[s] Current vehicle time-tag associated with measurements
-
Eigen::Vector3d r_N
[m] Current inertial spacecraft position vector in inertial frame N components
-
Eigen::Vector3d v_N
[m/s] Current inertial velocity of the spacecraft in inertial frame N components
-
Eigen::Vector3d rm_N
[m] Expected inertial spacecraft position vector at maneuver time tm in inertial frame N
-
LambertPlanner()