# 1. Hodographic shaping¶

The hodographic shape-based method shapes the velocity of the spacecraft using cylindrical coordinates. Two different implementations of this shaping method exists, one using time as independent variable, and the other using polar angle. The first one has been implemented here. This shaping method relies on the combination of integrable and differentiable base functions to shape the spacecraft velocity. The contribution of each of those base functions is weighted by a coefficient. Three base functions per velocity component at least are required so that their associated coefficients can be chosen to ensure the boundary conditions are fulfilled. The addition of any other base function, and thus of so-called free coefficients, introduces an extra degree of freedom in the problem, making it possible to optimise the shape-based trajectory to minimise the required deltaV.

## 1.1. Setting up a hodographically shaped trajectory¶

A low-thrust trajectory designed by hodographic shaping can be created with the HodographicShaping class, which inherits from the base class ShapeBasedMethodLeg. A settings class for hodographic shaping has also been implemented (HodographicShapingLegSettings, see Setting up a low-thrust trajectory for more details) to construct HodographicShaping objects more easily.

class HodographicShaping

The HodographicShaping class is defined as follows:

HodographicShaping(
const Eigen::Vector6d initialState,
const Eigen::Vector6d finalState,
const double timeOfFlight,
const int numberOfRevolutions,
simulation_setup::NamedBodyMap& bodyMap,
const std::string bodyToPropagate,
const std::string centralBody,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& radialVelocityFunctionComponents,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& normalVelocityFunctionComponents,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& axialVelocityFunctionComponents,
const Eigen::VectorXd freeCoefficientsNormalVelocityFunction,
const Eigen::VectorXd freeCoefficientsAxialVelocityFunction,
std::shared_ptr< numerical_integrators::IntegratorSettings< double > > integratorSettings =
std::shared_ptr< numerical_integrators::IntegratorSettings< > >( ) )


where the inputs are:

• initialState
State of the spacecraft at departure.
• finalState
State of the spacecraft at arrival.
• timeOfFlight
Time of flight required for the shape-based trajectory (boundary condition automatically fulfilled from the way the hodographic shaping is implemented).
• numberOfRevolutions
Required number of revolutions before the spacecraft reaches its final state.
• bodyMap
Map of pointers to Body objects involved in the low-thrust trajectory.
• bodyToPropagate
Name of the spacecraft to be propagated.
• centralBody
Name of the central body of the low-thrust trajectory.
• radialVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, containing the definition of the base functions used to shape the radial velocity of the spacecraft during the low-thrust trajectory.
• normalVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, used to shape the normal velocity of the spacecraft during the low-thrust trajectory.
• axialVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, used to shape the axial velocity of the spacecraft during the low-thrust trajectory.
• freeCoefficientsRadialVelocityFunction
Vector of free coefficients for the radial velocity function (weighting coefficients for the additional base functions (any base function starting from the fourth one, if more than 3 base functions are provided in radialVelocityFunctionComponents)).
• freeCoefficientsNormalVelocityFunction
Vector of free coefficients for the normal velocity function (weighting coefficients for the additional base functions (any base function starting from the fourth one, if more than 3 base functions are provided in normalVelocityFunctionComponents)).
• freeCoefficientsAxialVelocityFunction
Vector of free coefficients for the axial velocity function (weighting coefficients for the additional base functions (any base function starting from the fourth one, if more than 3 base functions are provided in axialVelocityFunctionComponents)).
• integratorSettings
Integrator settings (empty by default), used to propagate the spacecraft mass or thrust profiles, or to numerically propagate the fully perturbed trajectory (as a means to assess the quality of the analytical shaped-based preliminary design).

## 1.2. Hodographic shaping base functions¶

The constructor of the HodographicShaping class requires as inputs one vector of BaseFunctionHodographicShaping objects for each of the three velocity components. All the base functions to hodographically shape a trajectory are derived from the base class BaseFunctionHodographicShaping. The shaping functions for the three velocity components are not fixed in hodographic shaping, but rather are left to be selected by the user (to be chosen among a set of base functions). All these hodographic shaping base functions are defined in the classes presented below.

class BaseFunctionHodographicShaping

This is the base class to derive the base functions used for hodographic shaping. Each class derived from this base class retains the following methods:

• evaluateFunction
Returns the value of the base function for a specific independent variable value.
• evaluateDerivative
Returns the derivative function of the base function at a specific independent variable value.
• evaluateIntegral
Returns the integral function of the base function at the specific independent variable.

The following classes inherit from the base class BaseFunctionHodographicShaping:

class ConstantFunctionHodographicShaping

Class for the constant function. The class is defined as follows and the function always returns the value 1.0:

ConstantFunctionHodographicShaping( )

class SineFunctionHodographicShaping

Class for the sine function. The class is defined as follows:

SineFunctionHodographicShaping( double frequency )


where the input is the frequency of the sine function.

class CosineFunctionHodographicShaping

Class for the cosine function. The class is defined as follows:

CosineFunctionHodographicShaping( double frequency )


where the input is the frequency of the cosine function.

class ExponentialFunctionHodographicShaping

Class for the exponential function. The class is defined as follows:

ExponentialFunctionHodographicShaping( double exponent )


where the input is the multiplying coefficient of the independent variable within the exponential function.

class ScaledExponentialFunctionHodographicShaping

Class for the scaled exponential function. The class is defined as follows:

ScaledExponentialFunctionHodographicShaping( double exponent, double scaleFactor )


where the inputs are the multiplying coefficient of the independent variable within the exponential function, and a scaling factor to be applied in front of the multiplying coefficient.

class ExponentialSineFunctionHodographicShaping

Class for the exponential sine function. The class is defined as follows:

ExponentialSineFunctionHodographicShaping( double exponentExponentialFunction, double frequencySineFunction )


where the inputs are, in order, the exponent coefficient of the exponential function, and the frequency of the sine function. The exponential sine function returns the product of the sine and exponential functions.

class ScaledExponentialSineFunctionHodographicShaping

Class for the scaled exponential sine function. The class is defined as follows:

ScaledExponentialSineFunctionHodographicShaping( double exponentExponentialFunction, double frequencySineFunction, double scaleFactor )


where the inputs are the exponent of the exponential function, the frequency of the sine function, and a scaling factor (to be applied to the exponential function, as implemented in ScaledExponentialFunctionHodographicShaping). This function returns the product of the scaled exponential function with the sine function.

class ExponentialCosineFunctionHodographicShaping

Class for the exponential cosine function. The class is defined as follows:

ExponentialCosineFunctionHodographicShaping( double exponentExponentialFunction, double frequencyCosineFunction )


where the inputs are the exponent of the exponential function, and the frequency of the cosine function. This function returns the product of the cosine and exponential functions.

class ScaledExponentialCosineFunctionHodographicShaping

Class for the scaled exponential cosine function. The class is defined as follows:

ScaledExponentialCosineFunctionHodographicShaping( double exponentExponentialFunction, double frequencyCosineFunction, double scaleFactor )


where the inputs are the exponent of the exponential function, the frequency of the cosine function, and a scaling factor (to be applied to the exponential function, as implemented in ScaledExponentialFunctionHodographicShaping). This function returns the product of the scaled exponential function with the cosine function.

class PowerFunctionHodographicShaping

Class for the power function. The class is defined as follows:

PowerFunctionHodographicShaping( double exponent )


where the input parameter is the exponent of the power function. This function returns the value of the input parameter to the power indicated by the input variable.

class ScaledPowerFunctionHodographicShaping

Class for the scaled power function. The class is defined as follows:

ScaledPowerFunctionHodographicShaping( double exponent, double scaleFactor )


where the inputs are the exponent of the power function, and a scaling factor to be applied in front of this power function. This function returns the product between a scaling factor and the power function, as defined by the class PowerFunctionHodographicShaping.

class PowerSineFunctionHodographicShaping

Class for the power sine function. The class is defined as follows:

PowerSineFunctionHodographicShaping( double exponentPowerFunction, double frequencySineFunction )


where the inputs are the exponent of the power function and the frequency of the sine function. This function returns the product of the sine and the power functions (defined by the classes SineFunctionHodographicShaping and PowerFunctionHodographicShaping, respectively).

class ScaledPowerSineFunctionHodographicShaping

Class for the scaled power sine function. The class is defined as follows:

ScaledPowerSineFunctionHodographicShaping( double exponentPowerFunction, double frequencySineFunction, double scaleFactor )


where the inputs are the exponent of the power function, the frequency of the sine function, and a scaling factor (to be applied to the power function, as implemented in ScaledPowerFunctionHodographicShaping). This function returns the product of the scaled power function (ScaledPowerFunctionHodographicShaping) with the sine function (SineFunctionHodographicShaping).

class PowerCosineFunctionHodographicShaping

Class for the power cosine function. The class is defined as follows:

PowerCosineFunctionHodographicShaping( double exponentPowerFunction, double frequencyCosineFunction )


where the inputs are the exponent of the power function and the frequency of the cosine function. This function returns the product of the cosine and the power functions (CosineFunctionHodographicShaping and PowerFunctionHodographicShaping, respectively).

class ScaledPowerCosineFunctionHodographicShaping

Class for the scaled power cosine function. The class is defined as follows:

ScaledPowerCosineFunctionHodographicShaping( double exponentPowerFunction, double frequencyCosineFunction, double scaleFactor )


where the inputs are the exponent of the power function, the frequency of the cosine function, and a scaling factor (to be applied to the power function, as implemented in ScaledPowerFunctionHodographicShaping). This function returns the product of the cosine function (CosineFunctionHodographicShaping) with the scaled power function (ScaledPowerFunctionHodographicShaping).

## 1.3. Setting up the hodographic base functions¶

To facilitate the creation of the base functions described above, settings classes have been implemented for all of them. A BaseFunctionHodographicShaping object can then be created from the corresponding settings with the function createBaseFunctionHodographicShaping. It takes the type of the base function, as well as a BaseFunctionHodographicShapingSettings object as inputs.

class BaseFunctionHodographicShapingSettings

This is the base class for base function settings for hodographic shaping. Several base function settings classes inherit from this base class:

class TrigonometricFunctionHodographicShapingSettings

Class of settings for cosine and sine base functions. It is defined as follows, taking the frequency of the trigonometric function as input:

TrigonometricFunctionHodographicShapingSettings( const double frequency )

class ExponentialFunctionHodographicShapingSettings

Class of settings for exponential functions (either simply exponential or scaled exponential functions). It is defined as follows (the scaled factor is by default set to 1):

ExponentialFunctionHodographicShapingSettings( const double exponent,
const double scaleFactor )

class ExponentialTimesTrigonometricFunctionHodographicShapingSettings

Class of settings for base functions obtained by multiplying exponential functions with trigonometric ones (This includes the following hodographic shaping base functions: ExponentialSineFunctionHodographicShaping, ExponentialCosineFunctionHodographicShaping, ScaledExponentialSineFunctionHodographicShaping, ScaledExponentialCosineFunctionHodographicShaping). The class is defined as follows (the scaled factor is by default set to 1.0):

ExponentialTimesTrigonometricFunctionHodographicShapingSettings( const double exponent,
const double frequency,
const double scaleFactor )

class PowerFunctionHodographicShapingSettings

Class of settings for power functions (either simply power or scaled power base functions). The class is defined as follows (the scaled factor is by default set to 1.0):

PowerFunctionHodographicShapingSettings( const double exponent,
const double scaleFactor )

class PowerTimesTrigonometricFunctionHodographicShapingSettings

Class of settings for base functions defined by multiplying power functions with trigonometric ones (this includes the following hodographic shaping base functions: PowerSineFunctionHodographicShaping, PowerCosineFunctionHodographicShaping, ScaledPowerSineFunctionHodographicShaping, ScaledPowerCosineFunctionHodographicShaping). This settings class is defined as follows (the scaled factor is by default set to 1.0):

PowerTimesTrigonometricFunctionHodographicShapingSettings( const double exponent,
const double frequency,
const double scaleFactor )


## 1.4. Optimising the hodographically shaped trajectory¶

As explained before, hodographic shaping allows for a flexible number of base functions for each velocity component. Three base functions at least must be provided so that the boundary conditions can be satisfied, but a higher number of base functions can also be used, which turns into the creation of n-9 degrees of freedom (n being the total number of base functions provided, over the three velocity components). The weighting coefficients for these additional base functions are free parameters and can be tuned to minimise the deltaV required by the shaped trajectory. This thus transforms the hodographically shaping problem into an optimisation problem where the best set of free parameters, leading to the minimum deltaV, is to be found.

A pre-defined optimisation problem compatible with the PAGMO library has been implemented to this end.

class HodographicShapingOptimisationProblem

This class sets up the optimisation of the hodographically shaped trajectory, and its constructor is defined as follows:

HodographicShapingOptimisationProblem(
Eigen::Vector6d initialState,
Eigen::Vector6d finalState,
const double timeOfFlight,
const int numberOfRevolutions,
simulation_setup::NamedBodyMap& bodyMap,
const std::string bodyToPropagate,
const std::string centralBody,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& radialVelocityFunctionComponents,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& normalVelocityFunctionComponents,
std::vector< std::shared_ptr< shape_based_methods::BaseFunctionHodographicShaping > >& axialVelocityFunctionComponents,
std::vector< std::vector< double > >& freeCoefficientsBounds )


where the input parameters are:

• initialState
State vector at departure
• finalState
State vector at arrival.
• timeOfFlight
Time-of-flight of the shaped trajectory.
• numberOfRevolutions
Expected number of revolutions of the shaped trajectory.
• bodyMap
Map of pointers to Body objects defining the trajectory environment.
• bodyToPropagate
Name of the spacecraft to be propagated.
• centralBody
Name of the central body of the trajectory.
• radialVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, containing the definition of the base functions used to shape the radial velocity.
• normalVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, containing the definition of the base functions used to shape the normal velocity.
• axialVelocityFunctionComponents
Vector of BaseFunctionHodographicShaping objects, containing the definition of the base functions used to shape the axial velocity.
• freeCoefficientsBounds
Vector containing the lower and upper bounds for the free coefficients of the hodographic shaping method.

The fitness function creates the hodographically shaped trajectory corresponding to the base functions provided as inputs, and to a given set of free parameters. It then returns the deltaV associated with this shaped trajectory.

The get_bounds function simply returns the bounds for the free coefficients to be optimised, which are already provided as inputs of the HodographicShapingOptimisationProblem constructor.