ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
LambertTargetTask.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17Simple PID header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef GNC_GUIDANCE_LAMBERT_TARGET_TASK_H
23#define GNC_GUIDANCE_LAMBERT_TARGET_TASK_H
24
25#include "core/macros.h"
26#include "architecture/Tasks.h"
27#include "six_dof_dynamics/Frame.hpp"
28#include "utils/frameutils.hpp"
29
30namespace clockwerk {
31 /**
32 * @brief Lambert impulsive targeting task
33 *
34 * This task implements a lambert targeter which, given a "target" and "chaser"
35 * state at the current time and a time to intercept calculates the delta v
36 * required of the chaser to intercept the target. The task uses two key steps
37 * internally: first, it propgates the target state forward to the intercept
38 * time using a keplerian two body dynamics propagator. Next, it solves for the
39 * delta V required of the chaser to achieve that position at the exact same
40 * time using an iterative lambert solver which implements Battin's method.
41 *
42 * The solver only runs when trigger is true. Otherwise, it remains idle. All
43 * outputs will reflect the solution calculated on a previous trigger (i.e. will
44 * not be wiped clean, even when trigger is false.)
45 *
46 * Key assumptions:
47 * - The target and chaser are both under the influence of two body dynamics
48 * with the same central body
49 * - The solver is impulsive and does not account for thrust/timing effects
50 * - The desired intercept solution is elliptical, not hyperbolic
51 *
52 * Author: Alex Reynolds <alex.reynolds@attx.tech>
53 */
54 class LambertTargetTask : public clockwerk::Task {
55 public:
56 // Model params
57 // NAME TYPE DEFAULT VALUE
59 /** The minimum dv below which the lambert targeter will round dv to 0. Effectively deadband. */
60 SIGNAL(minimum_delta_v, double, 0.0)
61 /** The graviational parameter of the central body */
62 SIGNAL(mu, double, 3.986004418e+14)
63 /** The minimum tolerance to which the lambert solver will iteratively solve */
64 SIGNAL(lambert_solver_tolerance,double, 1e-12)
65 /** The maximum iterations within the lambert solver before exit */
68
69 // Model inputs
70 // NAME TYPE DEFAULT VALUE
72 /** Flag to trigger the lambert targeter to run and target. Should be true (1) to
73 * trigger, false (0) for idle. */
74 SIGNAL(trigger, int, false)
75 /** The time delta, relative to current time, at which the targeter will target
76 * intercept of the target. Delta V will be generated to intercept at this time. */
77 SIGNAL(time_to_intercept, double, 0.0)
78 /** The current position of the target relative to a planet inertial frame */
80 /** The current velocity of the target relative to a planet inertial frame */
82 /** The current position of the chaser spacecraft relative to a planet inertial frame */
84 /** The current velocity of the chaser spacecraft relative to a planet inertial frame */
87
88 // Model outputs
89 // NAME TYPE DEFAULT VALUE
91 /** The instantaneous delta v necessary to achieve chaser intercept with target after time seconds */
93 /** The position, in planet inertial coordinates, at which intercept will occur */
95 /** The difference in velocity between the target and chaser at the intercept point as (target - chaser)*/
98
99 // Model-specific implementations of startup and derivative
100 LambertTargetTask() : clockwerk::Task() {}
101 LambertTargetTask(clockwerk::Task &pnt, int schedule_slot=0, const std::string &m_name="lambert_target_task")
102 : clockwerk::Task(pnt, schedule_slot, m_name) {}
103 LambertTargetTask(clockwerk::Executive &e, int schedule_slot=0, const std::string &m_name="lambert_target_task")
104 : clockwerk::Task(e, schedule_slot, m_name) {}
105 virtual ~LambertTargetTask() {}
106 protected:
107 int execute();
108
109 // The position and velocity of our target and chaser at the future time, when propagated
110 CartesianVector3D _pos_tgt_intercept;
111 CartesianVector3D _vel_tgt_intercept;
112 CartesianVector3D _vel_chaser_intercept;
113
114 // The v1 and v2 values returned by our lambert solver -- chaser velocity at initial and final position
115 CartesianVector3D _vel_chaser_initial;
116 CartesianVector3D _vel_chaser_final;
117
118 // Our delta V vector
119 CartesianVector3D _delta_v;
120
121 // We don't really care about these, but semimajor axis and semi latus rectum of intercept orbit
122 double _a;
123 double _p;
124 };
125
126}
127
128#endif
Central control mechanism to run simulations and software.
Definition Executive.h:43
Lambert impulsive targeting task.
Definition LambertTargetTask.h:54
int execute()
Function to execute the task. All math and calculations should be here.
Definition LambertTargetTask.cpp:22
This is the base implementation of the task class.
Definition Tasks.h:68
Task()
Default constructor for the task object for simplicity. Note: Masks some functionality and should not...
Definition Tasks.cpp:21
Task(Task &pnt, int slot, const std::string &m_name="Unnamed")
Task-based constructor for the task. Auto-assigns executive.
Definition Tasks.cpp:47
Task(Executive &executive, int slot, const std::string &m_name="Unnamed")
Executive-based constructor for the task.
Definition Tasks.cpp:62
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition macros.h:87
#define START_PARAMS
Definition macros.h:96
#define CartesianVector3D
Definition macros.h:54
#define END_OUTPUTS
Definition macros.h:90
#define END_PARAMS
Definition macros.h:98
#define START_OUTPUTS
Definition macros.h:88
#define END_INPUTS
Definition macros.h:94
#define START_INPUTS
Definition macros.h:92
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > target_pos_inertial
Definition LambertTargetTask.h:79
clockwerk::DataIO< int > trigger
Definition LambertTargetTask.h:74
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > target_vel_inertial
Definition LambertTargetTask.h:81
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > chaser_vel_inertial
Definition LambertTargetTask.h:85
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > chaser_pos_inertial
Definition LambertTargetTask.h:83
clockwerk::DataIO< double > time_to_intercept
Definition LambertTargetTask.h:77
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_intercept_inertial
Definition LambertTargetTask.h:94
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > dv_intercept
Definition LambertTargetTask.h:96
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > delta_v
Definition LambertTargetTask.h:92
clockwerk::DataIO< double > lambert_solver_tolerance
Definition LambertTargetTask.h:64
clockwerk::DataIO< double > minimum_delta_v
Definition LambertTargetTask.h:60
clockwerk::DataIO< int > lambert_solver_max_iter
Definition LambertTargetTask.h:66
clockwerk::DataIO< double > mu
Definition LambertTargetTask.h:62