Tudat/Astrodynamics/BasicAstrodynamics/UnitTests/unitTestOrbitalElementConversions.cpp
//! Test bug-fix to orbital element conversions for arguments of periapsis close to zero, pi or two pi.
//! Thanks to Andreas Kleinschneider for finding the bug.
Test bug-fix to orbital element conversions for arguments of periapsis close to zero, pi or two pi.
Thanks to Andreas Kleinschneider for finding the bug.
Test bug - fix to orbital element conversions for arguments of periapsis close to zero pi or two pi . Thanks to Andreas Kleinschneider for finding the bug .
BOOST_AUTO_TEST_CASE( test_ArgumentOfPeriapsisBugfix )
{
    Eigen::Vector6d centralBodyCartesianState;
    centralBodyCartesianState << -521142852074.35858154296875, 595141535550.8497314453125, 8056093690.3882598876953125,
            3904.21508802941389149054884911, -18262.3110776023386279121041298, 103.914916159730324807242141105;
    Eigen::Vector6d orbitingBodyCartesianState;
    orbitingBodyCartesianState << -520894562964.4881591796875, 595481881288.00537109375, 8071968111.222164154052734375,
            -10065.8995464500585512723773718, -7984.05278915743656398262828588, 261.213167975313467650266829878;
    Eigen::Vector6d relativeCartesianState = orbitingBodyCartesianState - centralBodyCartesianState;
    double gravitationalParameterOfCentralBody = 126686534921800800;
    double gravitationalParameterOfOrbitingBody = 5959916033410.404296875;
    Eigen::Vector6d keplerianState =
            orbital_element_conversions::convertCartesianToKeplerianElements(
                relativeCartesianState, gravitationalParameterOfCentralBody + gravitationalParameterOfOrbitingBody );
    BOOST_CHECK_EQUAL( ( keplerianState( orbital_element_conversions::argumentOfPeriapsisIndex ) ==
                         keplerianState( orbital_element_conversions::argumentOfPeriapsisIndex ) ), true );
}
BOOST_AUTO_TEST_CASE ( test_ArgumentOfPeriapsisBugfix ) { Eigen :: Vector6d centralBodyCartesianState ; centralBodyCartesianState << -521142852074.35858154296875 , 595141535550.8497314453125 , 8056093690.3882598876953125 , 3904.21508802941389149054884911 , -18262.3110776023386279121041298 , 103.914916159730324807242141105 ; Eigen :: Vector6d orbitingBodyCartesianState ; orbitingBodyCartesianState << -520894562964.4881591796875 , 595481881288.00537109375 , 8071968111.222164154052734375 , -10065.8995464500585512723773718 , -7984.05278915743656398262828588 , 261.213167975313467650266829878 ; Eigen :: Vector6d relativeCartesianState = orbitingBodyCartesianState - centralBodyCartesianState ; double gravitationalParameterOfCentralBody = 126686534921800800 ; double gravitationalParameterOfOrbitingBody = 5959916033410.404296875 ; Eigen :: Vector6d keplerianState = orbital_element_conversions :: convertCartesianToKeplerianElements ( relativeCartesianState , gravitationalParameterOfCentralBody + gravitationalParameterOfOrbitingBody ) ; BOOST_CHECK_EQUAL ( ( keplerianState ( orbital_element_conversions :: argumentOfPeriapsisIndex ) == keplerianState ( orbital_element_conversions :: argumentOfPeriapsisIndex ) ) , true ) ; }
Test bug-fix to orbital element conversions for arguments of periapsis close to zero, pi or two pi.
Test bug - fix to orbital element conversions for arguments of periapsis close to zero pi or two pi .
// Define previously offending states and gravitational parameters. // Convert to Keplerian state // Check whether argument of periapsis is defined.