Skip to content

Commit

Permalink
feat: working version with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwa2710 committed Oct 29, 2024
1 parent 88e4315 commit fe94f10
Show file tree
Hide file tree
Showing 3 changed files with 710 additions and 30 deletions.
127 changes: 127 additions & 0 deletions include/OpenSpaceToolkit/Astrodynamics/Access/Generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <OpenSpaceToolkit/Core/Type/Real.hpp>

#include <OpenSpaceToolkit/Mathematics/Object/Interval.hpp>
#include <OpenSpaceToolkit/Mathematics/Object/Vector.hpp>

#include <OpenSpaceToolkit/Physics/Coordinate/Spherical/AER.hpp>
#include <OpenSpaceToolkit/Physics/Environment.hpp>
Expand All @@ -34,6 +35,7 @@ using ostk::core::type::Real;
using ostk::core::type::Shared;

using ostk::mathematics::object::Interval;
using ostk::mathematics::object::Matrix3d;

using ostk::physics::coordinate::Position;
using ostk::physics::coordinate::spherical::AER;
Expand All @@ -43,6 +45,7 @@ using ostk::physics::time::Duration;
using ostk::physics::time::Instant;
using ostk::physics::unit::Angle;
using ostk::physics::unit::Length;
using EarthGravitationalModel = ostk::physics::environment::gravitational::Earth;

using ostk::astrodynamics::Access;
using ostk::astrodynamics::Trajectory;
Expand All @@ -51,6 +54,117 @@ using ostk::astrodynamics::trajectory::State;
#define DEFAULT_STEP Duration::Minutes(1.0)
#define DEFAULT_TOLERANCE Duration::Microseconds(1.0)

/// @brief Represents the configuration for a ground target, including azimuth, elevation, and range intervals, as well
/// as position and LLA (Latitude, Longitude, Altitude).
///
/// @details This class provides methods to retrieve the trajectory, position, LLA, and intervals for azimuth,
/// elevation, and range. It also includes a method to get the SEZ (South-East-Zenith) rotation matrix.
struct GroundTargetConfiguration
{
/// @brief Constructor
/// @param anAzimuthInterval An azimuth interval [deg]
/// @param anElevationInterval An elevation interval [deg]
/// @param aRangeInterval A range interval [m]
/// @param aPosition A position
GroundTargetConfiguration(
const Interval<Real>& anAzimuthInterval,
const Interval<Real>& anElevationInterval,
const Interval<Real>& aRangeInterval,
const Position& aPosition
);

/// @brief Constructor
/// @param anAzimuthInterval An azimuth interval [deg]
/// @param anElevationInterval An elevation interval [deg]
/// @param aRangeInterval A range interval [m]
/// @param aLLA An LLA
GroundTargetConfiguration(
const Interval<Real>& anAzimuthInterval,
const Interval<Real>& anElevationInterval,
const Interval<Real>& aRangeInterval,
const LLA& aLLA
);

/// @brief Get the trajectory
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Trajectory trajectory = groundStationConfiguration.getTrajectory();
/// @endcode
///
/// @return The trajectory
Trajectory getTrajectory() const;

/// @brief Get the position
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Position position = groundStationConfiguration.getPosition();
/// @endcode
///
/// @return The position
Position getPosition() const;

/// @brief Get the latitude, longitude, and altitude (LLA)
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// LLA lla = groundStationConfiguration.getLLA();
/// @endcode
///
/// @return The latitude, longitude, and altitude (LLA)
LLA getLLA() const;

/// @brief Get the azimuth interval
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Interval<Real> groundStationConfiguration = generator.getAzimuthInterval();
/// @endcode
///
/// @return The azimuth interval
Interval<Real> getAzimuthInterval() const;

/// @brief Get the elevation interval
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Interval<Real> groundStationConfiguration = generator.getElevationInterval();
/// @endcode
///
/// @return The elevation interval
Interval<Real> getElevationInterval() const;

/// @brief Get the range interval
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Interval<Real> groundStationConfiguration = generator.getRangeInterval();
/// @endcode
///
/// @return The range interval
Interval<Real> getRangeInterval() const;

/// @brief Get the rotation matrix (Matrix3d) from ECEF (Earth-Centered-Earth-Fixed) to SEZ (South-East-Zenith)
/// frame
///
/// @code{.cpp}
/// GroundStationConfiguration groundStationConfiguration = { ... } ;
/// Matrix3d sezRotation = groundStationConfiguration.getR_SEZ_ECEF();
/// @endcode
///
/// @return The SEZ rotation matrix
Matrix3d getR_SEZ_ECEF() const;

private:
Interval<Real> azimuthInterval_;
Interval<Real> elevationInterval_;
Interval<Real> rangeInterval_;

Position position_;
LLA lla_;
};

class Generator
{
public:
Expand Down Expand Up @@ -89,6 +203,12 @@ class Generator
const physics::time::Interval& anInterval, const Trajectory& aFromTrajectory, const Trajectory& aToTrajectory
) const;

Array<Array<Access>> computeAccessesWithGroundTargets(
const physics::time::Interval& anInterval,
const Array<GroundTargetConfiguration>& someGroundTargetConfigurations,
const Trajectory& aToTrajectory
) const;

void setStep(const Duration& aStep);

void setTolerance(const Duration& aTolerance);
Expand Down Expand Up @@ -137,6 +257,13 @@ class Generator
std::function<bool(const Access&)> accessFilter_;
std::function<bool(const State&, const State&)> stateFilter_;

Array<Access> generateAccessesFromIntervals(
const Array<physics::time::Interval>& someIntervals,
const physics::time::Interval& anInterval,
const Trajectory& aFromTrajectory,
const Trajectory& aToTrajectory
) const;

static Access GenerateAccess(
const physics::time::Interval& anAccessInterval,
const physics::time::Interval& aGlobalInterval,
Expand Down
Loading

0 comments on commit fe94f10

Please sign in to comment.