Skip to content

Commit

Permalink
feat: add argument of latitude options to Orbit::SunSynchronous (#319)
Browse files Browse the repository at this point in the history
* feat: add ascending node and argument of latitude options to Orbit::SunSynchronous

* chore: missed a spot
  • Loading branch information
vishwa2710 authored Jan 16, 2024
1 parent 7032be1 commit 462bd58
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
using ostk::core::types::Shared;

using ostk::physics::environment::object::Celestial;
using ostk::physics::units::Angle;

using ostk::astro::trajectory::Orbit;
using ostk::astro::trajectory::State;
Expand Down Expand Up @@ -266,8 +267,8 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
Args:
epoch (Instant): The epoch.
altitude (double): The altitude.
inclination (double): The inclination.
altitude (Length): The altitude.
inclination (Angle): The inclination.
celestial_object (Celestial): The celestial object.
Returns:
Expand All @@ -287,8 +288,8 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
Args:
epoch (Instant): The epoch.
apoapsis_altitude (double): The apoapsis altitude.
periapsis_altitude (double): The periapsis altitude.
apoapsis_altitude (Length): The apoapsis altitude.
periapsis_altitude (Length): The periapsis altitude.
celestial_object (Celestial): The celestial object.
Returns:
Expand All @@ -307,7 +308,7 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
Args:
epoch (Instant): The epoch.
altitude (double): The altitude.
altitude (Length): The altitude.
celestial_object (Celestial): The celestial object.
Returns:
Expand All @@ -327,7 +328,7 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
Args:
epoch (Instant): The epoch.
inclination (double): The inclination.
inclination (Angle): The inclination.
longitude (double): The longitude.
celestial_object (Celestial): The celestial object.
Expand All @@ -343,14 +344,16 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Trajectory_Orbit(pybind11::module& a
arg("altitude"),
arg("local_time_at_descending_node"),
arg("celestial_object"),
arg("argument_of_latitude") = Angle::Zero(),
R"doc(
Create a sun-synchronous `Orbit` object.
Args:
epoch (Instant): The epoch.
altitude (double): The altitude.
local_time_at_descending_node (double): The local time at descending node.
altitude (Length): The altitude.
local_time_at_descending_node (Time): The local time at descending node.
celestial_object (Celestial): The celestial object.
argument_of_latitude (Angle): The argument of latitude.
Returns:
Orbit: The sun-synchronous `Orbit` object.
Expand Down
8 changes: 8 additions & 0 deletions bindings/python/test/trajectory/test_orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ def test_trajectory_orbit_sun_synchronous(self, earth):
assert orbit is not None
assert isinstance(orbit, Orbit)
assert orbit.is_defined()

assert Orbit.sun_synchronous(
epoch=epoch,
altitude=altitude,
local_time_at_descending_node=local_time_at_descending_node,
celestial_object=earth,
argument_of_latitude=Angle.degrees(50.0),
).is_defined()
4 changes: 3 additions & 1 deletion include/OpenSpaceToolkit/Astrodynamics/Trajectory/Orbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ class Orbit : public Trajectory
/// @param anAltitude An orbit altitude (wrt. equatorial radius)
/// @param aLocalTimeAtDescendingNode A local time at descending node
/// @param aCelestialObjectSPtr A shared pointer to a central celestial body
/// @param anArgumentOfLatitude An argument of latitude
/// @return Sun-synchronous orbit
static Orbit SunSynchronous(
const Instant& anEpoch,
const Length& anAltitude,
const Time& aLocalTimeAtDescendingNode,
const Shared<const Celestial>& aCelestialObjectSPtr
const Shared<const Celestial>& aCelestialObjectSPtr,
const Angle& anArgumentOfLatitude = Angle::Zero()
);

static String StringFromFrameType(const Orbit::FrameType& aFrameType);
Expand Down
31 changes: 17 additions & 14 deletions src/OpenSpaceToolkit/Astrodynamics/Trajectory/Orbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ namespace astro
namespace trajectory
{

using ostk::core::types::Uint8;

using ostk::math::object::Vector3d;

using ostk::physics::time::Scale;
using ostk::physics::units::Derived;
using ostk::physics::units::Mass;
using ostk::physics::units::Length;
using ostk::physics::environment::object::celestial::Sun;
using orbit::models::Kepler;
using orbit::models::kepler::COE;

static const Derived::Unit GravitationalParameterSIUnit =
Derived::Unit::GravitationalParameter(Length::Unit::Meter, ostk::physics::units::Time::Unit::Second);
Expand Down Expand Up @@ -839,21 +848,10 @@ Orbit Orbit::SunSynchronous(
const Instant& anEpoch,
const Length& anAltitude,
const Time& aLocalTimeAtDescendingNode,
const Shared<const Celestial>& aCelestialObjectSPtr
const Shared<const Celestial>& aCelestialObjectSPtr,
const Angle& anArgumentOfLatitude
)
{
using ostk::core::types::Uint8;

using ostk::math::object::Vector3d;

using ostk::physics::time::Scale;
using ostk::physics::units::Derived;
using ostk::physics::units::Mass;
using ostk::physics::environment::object::celestial::Sun;

using orbit::models::Kepler;
using orbit::models::kepler::COE;

if (!anEpoch.isDefined())
{
throw ostk::core::error::runtime::Undefined("Epoch");
Expand All @@ -874,6 +872,11 @@ Orbit Orbit::SunSynchronous(
throw ostk::core::error::runtime::Undefined("Celestial object");
}

if (!anArgumentOfLatitude.isDefined())
{
throw ostk::core::error::runtime::Undefined("Argument of latitude");
}

const auto calculateSunSynchronousInclination = [&aCelestialObjectSPtr](const Length& aSemiMajorAxis) -> Angle
{
/// @ref Capderou M., Handbook of Satellite Orbits: From Kepler to GPS, p.292
Expand Down Expand Up @@ -986,7 +989,7 @@ Orbit Orbit::SunSynchronous(
const Angle inclination = calculateSunSynchronousInclination(semiMajorAxis);
const Angle raan = calculateRaan(calculateLocalTimeAtAscendingNode());
const Angle aop = Angle::Zero();
const Angle trueAnomaly = Angle::Zero();
const Angle trueAnomaly = anArgumentOfLatitude - aop;

const COE coe = {semiMajorAxis, eccentricity, inclination, raan, aop, trueAnomaly};

Expand Down
Loading

0 comments on commit 462bd58

Please sign in to comment.