Tudat/Astrodynamics/TrajectoryDesign/swingbyLegMga1DsmVelocity.cpp
//! Calculate the leg and update the Delta V and the velocity before the next body.
Calculate the leg and update the Delta V and the velocity before the next body.
Calculate the leg and update the Delta V and the velocity before the next body .
void SwingbyLegMga1DsmVelocity::calculateLeg( Eigen::Vector3d& velocityBeforeArrivalBody,
                                              double& deltaV )
{
    dsmTime_ = dsmTimeOfFlightFraction_ * timeOfFlight_;
    velocityAfterDeparture_ = mission_segments::gravityAssist( swingbyBodyGravitationalParameter_,
                                                               departureBodyVelocity_,
                                                               ( *velocityBeforeDepartureBodyPtr_ ),
                                                               rotationAngle_, pericenterRadius_,
                                                               swingbyDeltaV_ );
    Eigen::Vector6d cartesianElements ( 6 ), keplerianElements ( 6 );
    cartesianElements.segment( 0, 3 ) = departureBodyPosition_;
    cartesianElements.segment( 3, 3 ) = velocityAfterDeparture_;
    keplerianElements = orbital_element_conversions::convertCartesianToKeplerianElements(
                cartesianElements, centralBodyGravitationalParameter_ );
    keplerianElements = orbital_element_conversions::propagateKeplerOrbit( keplerianElements,
                dsmTime_, centralBodyGravitationalParameter_ );
    cartesianElements = orbital_element_conversions::convertKeplerianToCartesianElements(
                keplerianElements, centralBodyGravitationalParameter_ );
    dsmLocation_ = cartesianElements.segment( 0, 3 );
    velocityBeforeDsm_ = cartesianElements.segment( 3, 3 );
    mission_segments::solveLambertProblemIzzo( dsmLocation_, arrivalBodyPosition_, timeOfFlight_ -
                                               dsmTime_, centralBodyGravitationalParameter_,
                                               velocityAfterDsm_, velocityBeforeArrivalBody );
    deltaVDsm_ = ( velocityAfterDsm_ - velocityBeforeDsm_ ).norm( );
    deltaV_ = swingbyDeltaV_ + deltaVDsm_;
    deltaV = deltaV_;
}
void SwingbyLegMga1DsmVelocity :: calculateLeg ( Eigen :: Vector3d & velocityBeforeArrivalBody , double & deltaV ) { dsmTime_ = dsmTimeOfFlightFraction_ * timeOfFlight_ ; velocityAfterDeparture_ = mission_segments :: gravityAssist ( swingbyBodyGravitationalParameter_ , departureBodyVelocity_ , ( * velocityBeforeDepartureBodyPtr_ ) , rotationAngle_ , pericenterRadius_ , swingbyDeltaV_ ) ; Eigen :: Vector6d cartesianElements ( 6 ) , keplerianElements ( 6 ) ; cartesianElements . segment ( 0 , 3 ) = departureBodyPosition_ ; cartesianElements . segment ( 3 , 3 ) = velocityAfterDeparture_ ; keplerianElements = orbital_element_conversions :: convertCartesianToKeplerianElements ( cartesianElements , centralBodyGravitationalParameter_ ) ; keplerianElements = orbital_element_conversions :: propagateKeplerOrbit ( keplerianElements , dsmTime_ , centralBodyGravitationalParameter_ ) ; cartesianElements = orbital_element_conversions :: convertKeplerianToCartesianElements ( keplerianElements , centralBodyGravitationalParameter_ ) ; dsmLocation_ = cartesianElements . segment ( 0 , 3 ) ; velocityBeforeDsm_ = cartesianElements . segment ( 3 , 3 ) ; mission_segments :: solveLambertProblemIzzo ( dsmLocation_ , arrivalBodyPosition_ , timeOfFlight_ - dsmTime_ , centralBodyGravitationalParameter_ , velocityAfterDsm_ , velocityBeforeArrivalBody ) ; deltaVDsm_ = ( velocityAfterDsm_ - velocityBeforeDsm_ ) . norm ( ) ; deltaV_ = swingbyDeltaV_ + deltaVDsm_ ; deltaV = deltaV_ ; }
Calculate the leg and update the Delta V and the velocity before the next body.
Calculate the leg and update the Delta V and the velocity before the next body .
// Calculate the DSM time of application from the time of flight fraction. // Prepare the gravity assist propagator module. // Transfer the initial position and velocity into a vectorXd object with Cartesian // coordinates. // Convert the cartesian elements into keplerian elements. // Propagate the keplerian elements until the moment of application of the DSM. // Convert the keplerian elements back into Cartesian elements. // Set the corresponding position and velocity vectors. // Calculate the velocities after the DSM and before the arrival body. // Calculate the deltaV needed for the DSM. // Calculate the total deltaV needed. // Return the deltaV