Tudat/Astrodynamics/TrajectoryDesign/swingbyLegMga1DsmVelocity.cpp
//! Calculate intermediate positions and their corresponding times.
Calculate intermediate positions and their corresponding times.
Calculate intermediate positions and their corresponding times .
void SwingbyLegMga1DsmVelocity::intermediatePoints( const double maximumTimeStep,
                                          std::vector < Eigen::Vector3d >& positionVector,
                                          std::vector < double >& timeVector,
                                          const double startingTime )
{
    if ( std::isnan( velocityAfterDeparture_( 0 ) ) )
    {
        Eigen::Vector3d tempVelocityBeforeArrivalBody;
        double tempDeltaV;
        calculateLeg( tempVelocityBeforeArrivalBody, tempDeltaV );
    }
    Eigen::VectorXd initialState ( 6 );
    initialState.segment( 0, 3 ) = departureBodyPosition_;
    initialState.segment( 3, 3 ) = velocityAfterDeparture_;
    returnTrajectory( initialState, centralBodyGravitationalParameter_, dsmTime_,
                      maximumTimeStep, positionVector, timeVector, startingTime );
    std::vector < Eigen::Vector3d > temporaryPositions;
    std::vector < double > temporaryTimes;
    initialState.segment( 0, 3 ) = dsmLocation_;
    initialState.segment( 3, 3 ) = velocityAfterDsm_;
    returnTrajectory( initialState, centralBodyGravitationalParameter_, timeOfFlight_ - dsmTime_,
                      maximumTimeStep, temporaryPositions, temporaryTimes,
                      startingTime + dsmTime_ );
    positionVector.insert( positionVector.end( ), temporaryPositions.begin( ) + 1,
                           temporaryPositions.end( ) );
    timeVector.insert( timeVector.end( ), temporaryTimes.begin( ) + 1, temporaryTimes.end( ) );
}
void SwingbyLegMga1DsmVelocity :: intermediatePoints ( const double maximumTimeStep , std :: vector < Eigen :: Vector3d > & positionVector , std :: vector < double > & timeVector , const double startingTime ) { if ( std :: isnan ( velocityAfterDeparture_ ( 0 ) ) ) { Eigen :: Vector3d tempVelocityBeforeArrivalBody ; double tempDeltaV ; calculateLeg ( tempVelocityBeforeArrivalBody , tempDeltaV ) ; } Eigen :: VectorXd initialState ( 6 ) ; initialState . segment ( 0 , 3 ) = departureBodyPosition_ ; initialState . segment ( 3 , 3 ) = velocityAfterDeparture_ ; returnTrajectory ( initialState , centralBodyGravitationalParameter_ , dsmTime_ , maximumTimeStep , positionVector , timeVector , startingTime ) ; std :: vector < Eigen :: Vector3d > temporaryPositions ; std :: vector < double > temporaryTimes ; initialState . segment ( 0 , 3 ) = dsmLocation_ ; initialState . segment ( 3 , 3 ) = velocityAfterDsm_ ; returnTrajectory ( initialState , centralBodyGravitationalParameter_ , timeOfFlight_ - dsmTime_ , maximumTimeStep , temporaryPositions , temporaryTimes , startingTime + dsmTime_ ) ; positionVector . insert ( positionVector . end ( ) , temporaryPositions . begin ( ) + 1 , temporaryPositions . end ( ) ) ; timeVector . insert ( timeVector . end ( ) , temporaryTimes . begin ( ) + 1 , temporaryTimes . end ( ) ) ; }
Calculate intermediate positions and their corresponding times.
Calculate intermediate positions and their corresponding times .
// Test if the trajectory has already been calculated. // If the velocity after departure has not been set yet, the trajectory has not been // calculated yet and hence still needs to be calculated, which is done below. // Store the initial state. // Call the trajectory return method to obtain the intermediate points along the first part of // the leg. // Make vectors that can be used to call the trajectory return method for the second part of // the leg. // Store the state at the DSM. // Call the trajectory return method to obtain the intermediate points along the first part of // the leg. // Add the vectors of this part to those of the entire leg.