Tudat/Astrodynamics/TrajectoryDesign/exportTrajectory.cpp
//! Return a vector of positions and times corresponding to a 2D circular trajectory.
Return a vector of positions and times corresponding to a 2D circular trajectory.
Return a vector of positions and times corresponding to a 2D circular trajectory .
void returnCircularTrajectory( double maximumTimeStep,
                               std::vector < Eigen::Vector3d >& positionVector,
                               std::vector < double >& timeVector,
                               double semiMajorAxis,
                               double centralGravitationalParamater,
                               double startingTime )
{
    double meanMotion = std::sqrt( centralGravitationalParamater / std::pow( semiMajorAxis, 3 ) );
    double orbitalPeriod = 2 * mathematical_constants::PI / meanMotion;
    double numberOfSteps = std::ceil( orbitalPeriod / maximumTimeStep );
    double timeStep = orbitalPeriod / numberOfSteps;
    double time = 0;
    timeVector.resize( numberOfSteps + 1 );
    positionVector.resize( numberOfSteps + 1 );
    for ( int counter = 0; counter < numberOfSteps + 1; counter++ )
    {
        timeVector[ counter ] = time + startingTime;
        positionVector[ counter ] << semiMajorAxis * std::cos( time * meanMotion ),
                                     semiMajorAxis * std::sin( time * meanMotion ), 0.0;
        time += timeStep;
    }
}
void returnCircularTrajectory ( double maximumTimeStep , std :: vector < Eigen :: Vector3d > & positionVector , std :: vector < double > & timeVector , double semiMajorAxis , double centralGravitationalParamater , double startingTime ) { double meanMotion = std :: sqrt ( centralGravitationalParamater / std :: pow ( semiMajorAxis , 3 ) ) ; double orbitalPeriod = 2 * mathematical_constants :: PI / meanMotion ; double numberOfSteps = std :: ceil ( orbitalPeriod / maximumTimeStep ) ; double timeStep = orbitalPeriod / numberOfSteps ; double time = 0 ; timeVector . resize ( numberOfSteps + 1 ) ; positionVector . resize ( numberOfSteps + 1 ) ; for ( int counter = 0 ; counter < numberOfSteps + 1 ; counter ++ ) { timeVector [ counter ] = time + startingTime ; positionVector [ counter ] << semiMajorAxis * std :: cos ( time * meanMotion ) , semiMajorAxis * std :: sin ( time * meanMotion ) , 0.0 ; time += timeStep ; } }
Return a vector of positions and times corresponding to a 2D circular trajectory.
Return a vector of positions and times corresponding to a 2D circular trajectory .
// Calculate the mean motion, orbital period and the resulting number of steps required. // Create time variable, for use in the coming loop. // Create a for loop in which the positions are set to the vectors.