Skip to content

Commit

Permalink
refactor!: rename nadir_pointing profile to local_orbital_frame (#484)
Browse files Browse the repository at this point in the history
* refactor!: rename nadir_pointing profile to local_orbital_frame

* feat: apply feedback

* feat: fix tests
  • Loading branch information
vishwa2710 authored Jan 6, 2025
1 parent da2b98f commit ef11d30
Show file tree
Hide file tree
Showing 28 changed files with 46 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,17 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Flight_Profile(pybind11::module& aMo
)

.def_static(
"nadir_pointing",
&Profile::NadirPointing,
"local_orbital_frame_pointing",
&Profile::LocalOrbitalFramePointing,
R"doc(
Create a nadir pointing profile.
Create a profile aligned with the provided local orbital frame type.
Args:
orbit (Orbit): The orbit.
orbital_frame_type (OrbitalFrameType): The type of the orbital frame.
Returns:
Profile: The nadir pointing profile.
Profile: The profile aligned with the local orbital frame.
)doc",
arg("orbit"),
arg("orbital_frame_type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Flight_Profile_Model_Transform(pybin
Create a transform for inertial pointing.
Args:
trajectory (Trajectory): The trajectory to point at.
trajectory (Trajectory): The trajectory of the satellite.
quaternion (Quaternion): The quaternion to rotate the axes by.
Returns:
Expand All @@ -127,17 +127,17 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Flight_Profile_Model_Transform(pybin
)

.def_static(
"nadir_pointing",
&Transform::NadirPointing,
"local_orbital_frame_pointing",
&Transform::LocalOrbitalFramePointing,
R"doc(
Create a transform for nadir pointing.
Create a profile aligned with the provided local orbital frame type.
Args:
orbit (Orbit): The orbit to point at.
orbit (Orbit): The orbit of the satellite.
orbital_frame_type (OrbitalFrameType): The type of the orbital frame.
Returns:
Transform: The transform for nadir pointing.
Transform: The transform for the local orbital frame pointing.
)doc",
arg("orbit"),
arg("orbital_frame_type")
Expand Down
6 changes: 4 additions & 2 deletions bindings/python/test/flight/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,13 @@ def test_inertial_pointing(self):
assert isinstance(profile, Profile)
assert profile.is_defined()

def test_nadir_pointing(
def test_local_orbital_frame_pointing(
self,
orbit: Orbit,
):
profile: Profile = Profile.nadir_pointing(orbit, Orbit.FrameType.VVLH)
profile: Profile = Profile.local_orbital_frame_pointing(
orbit, Orbit.FrameType.VVLH
)

assert profile is not None
assert isinstance(profile, Profile)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/test/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def orbit(environment: Environment) -> Orbit:

@pytest.fixture
def profile(orbit: Orbit) -> Profile:
return Profile.nadir_pointing(
return Profile.local_orbital_frame_pointing(
orbit=orbit,
orbital_frame_type=Orbit.FrameType.VVLH,
)
Expand Down
4 changes: 2 additions & 2 deletions include/OpenSpaceToolkit/Astrodynamics/Flight/Profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ class Profile
/// @return Flight profile
static Profile InertialPointing(const Trajectory& aTrajectory, const Quaternion& aQuaternion);

/// @brief Constructs a flight profile with nadir pointing
/// @brief Constructs a flight profile with local orbital frame pointing
///
/// @param anOrbit An orbit
/// @param anOrbitalFrameType An orbital frame type
/// @return Flight profile
static Profile NadirPointing(
static Profile LocalOrbitalFramePointing(
const trajectory::Orbit& anOrbit, const trajectory::Orbit::FrameType& anOrbitalFrameType
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ class Transform : public virtual Model
/// @return Flight profile
static Transform InertialPointing(const Trajectory& aTrajectory, const Quaternion& aQuaternion);

/// @brief Constructs a flight profile with nadir pointing
/// @brief Constructs a flight profile with local orbital frame pointing
///
/// @param anOrbit An orbit
/// @param anOrbitalFrameType An orbital frame type
/// @return Flight profile
static Transform NadirPointing(
static Transform LocalOrbitalFramePointing(
const trajectory::Orbit& anOrbit, const trajectory::Orbit::FrameType& anOrbitalFrameType
);

Expand Down
6 changes: 4 additions & 2 deletions src/OpenSpaceToolkit/Astrodynamics/Flight/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ Profile Profile::InertialPointing(const Trajectory& aTrajectory, const Quaternio
return {TransformModel::InertialPointing(aTrajectory, aQuaternion)};
}

Profile Profile::NadirPointing(const trajectory::Orbit& anOrbit, const trajectory::Orbit::FrameType& anOrbitalFrameType)
Profile Profile::LocalOrbitalFramePointing(
const trajectory::Orbit& anOrbit, const trajectory::Orbit::FrameType& anOrbitalFrameType
)
{
return {TransformModel::NadirPointing(anOrbit, anOrbitalFrameType)};
return {TransformModel::LocalOrbitalFramePointing(anOrbit, anOrbitalFrameType)};
}

Profile Profile::CustomPointing(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Transform Transform::InertialPointing(const Trajectory& aTrajectory, const Quate
return {dynamicTransformProvider, Frame::GCRF()};
}

Transform Transform::NadirPointing(
Transform Transform::LocalOrbitalFramePointing(
const trajectory::Orbit& anOrbit, const trajectory::Orbit::FrameType& anOrbitalFrameType
)
{
Expand Down
33 changes: 18 additions & 15 deletions test/OpenSpaceToolkit/Astrodynamics/Flight/Profile.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class OpenSpaceToolkit_Astrodynamics_Flight_Profile : public ::testing::Test

this->orbit_ = {keplerianModel, environment.accessCelestialObjectWithName("Earth")};

this->profile_ = Profile::NadirPointing(this->orbit_, Orbit::FrameType::VVLH);
this->profile_ = Profile::LocalOrbitalFramePointing(this->orbit_, Orbit::FrameType::VVLH);
}

Orbit orbit_ = Orbit::Undefined();
Expand Down Expand Up @@ -382,7 +382,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, InertialPointing)
}

// TBI: Should move these tests to the Transform test suite and only test interface here
TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)
TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, LocalOrbitalFramePointing_VVLH)
{
// VVLH #1

Expand Down Expand Up @@ -410,7 +410,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

const Orbit orbit = {keplerianModel, environment.accessCelestialObjectWithName("Earth")};

const Profile profile = Profile::NadirPointing(orbit, Orbit::FrameType::VVLH);
const Profile profile = Profile::LocalOrbitalFramePointing(orbit, Orbit::FrameType::VVLH);

const Real positionTolerance_m = 1e-3;
const Real velocityTolerance_meterPerSec = 1e-6;
Expand All @@ -419,9 +419,10 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

// Reference data setup

const File referenceDataFile =
File::Path(Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/NadirPointing/VVLH/"
"Satellite_1 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv"));
const File referenceDataFile = File::Path(
Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/LocalOrbitalFramePointing/VVLH/"
"Satellite_1 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv")
);

const Table referenceData = Table::Load(referenceDataFile, Table::Format::CSV, true);

Expand Down Expand Up @@ -520,7 +521,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

const Orbit orbit = {keplerianModel, environment.accessCelestialObjectWithName("Earth")};

const Profile profile = Profile::NadirPointing(orbit, Orbit::FrameType::VVLH);
const Profile profile = Profile::LocalOrbitalFramePointing(orbit, Orbit::FrameType::VVLH);

const Real positionTolerance_m = 1e-3;
const Real velocityTolerance_meterPerSec = 1e-6;
Expand All @@ -529,9 +530,10 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

// Reference data setup

const File referenceDataFile =
File::Path(Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/NadirPointing/VVLH/"
"Satellite_2 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv"));
const File referenceDataFile = File::Path(
Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/LocalOrbitalFramePointing/VVLH/"
"Satellite_2 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv")
);

const Table referenceData = Table::Load(referenceDataFile, Table::Format::CSV, true);

Expand Down Expand Up @@ -630,7 +632,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

const Orbit orbit = {keplerianModel, environment.accessCelestialObjectWithName("Earth")};

const Profile profile = Profile::NadirPointing(orbit, Orbit::FrameType::VVLH);
const Profile profile = Profile::LocalOrbitalFramePointing(orbit, Orbit::FrameType::VVLH);

const Real positionTolerance_m = 1e-3;
const Real velocityTolerance_meterPerSec = 1e-6;
Expand All @@ -639,9 +641,10 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, NadirPointing_VVLH)

// Reference data setup

const File referenceDataFile =
File::Path(Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/NadirPointing/VVLH/"
"Satellite_3 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv"));
const File referenceDataFile = File::Path(
Path::Parse("/app/test/OpenSpaceToolkit/Astrodynamics/Flight/Profile/LocalOrbitalFramePointing/VVLH/"
"Satellite_3 t_UTC x_GCRF v_GCRF q_B_GCRF w_B_GCRF_in_GCRF.csv")
);

const Table referenceData = Table::Load(referenceDataFile, Table::Format::CSV, true);

Expand Down Expand Up @@ -988,7 +991,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile, CustomPointing)

// Compare against Orbit VNC frame which has been validated

const Profile expectedProfile = Profile::NadirPointing(orbit, Orbit::FrameType::VNC);
const Profile expectedProfile = Profile::LocalOrbitalFramePointing(orbit, Orbit::FrameType::VNC);

for (const auto instant :
Interval::Closed(epoch, epoch + Duration::Hours(1.0)).generateGrid(Duration::Minutes(5.0)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform : public ::

this->orbit_ = {keplerianModel, environment.accessCelestialObjectWithName("Earth")};

this->transform_ = Transform::NadirPointing(this->orbit_, Orbit::FrameType::VVLH);
this->transform_ = Transform::LocalOrbitalFramePointing(this->orbit_, Orbit::FrameType::VVLH);
}

Orbit orbit_ = Orbit::Undefined();
Expand All @@ -101,7 +101,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform, Construct
);
};

EXPECT_NO_THROW(Transform transform_ (DynamicProvider(dynamicProviderGenerator), Frame::GCRF()));
EXPECT_NO_THROW(Transform transform_(DynamicProvider(dynamicProviderGenerator), Frame::GCRF()));
}

TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform, StreamOperator)
Expand Down Expand Up @@ -209,9 +209,9 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform, InertialP
}
}

TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform, NadirPointing)
TEST_F(OpenSpaceToolkit_Astrodynamics_Flight_Profile_Models_Transform, LocalOrbitalFramePointing)
{
{
EXPECT_TRUE(Transform::NadirPointing(orbit_, Orbit::FrameType::VVLH).isDefined());
EXPECT_TRUE(Transform::LocalOrbitalFramePointing(orbit_, Orbit::FrameType::VVLH).isDefined());
}
}

0 comments on commit ef11d30

Please sign in to comment.