114 lines
2.7 KiB
C++
114 lines
2.7 KiB
C++
#pragma once
|
|
|
|
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
|
|
|
|
|
/* MCC LIBRARY DEFAULT IMPLEMENTATION OF SOME CLASSES */
|
|
|
|
// #include <compare>
|
|
|
|
#include "mcc_generics.h"
|
|
|
|
namespace mcc
|
|
{
|
|
|
|
|
|
/* DEFAULT TIME POINT CLASS */
|
|
|
|
typedef std::chrono::system_clock::time_point MccTimePoint;
|
|
|
|
|
|
/* DEFAULT JULIAN DAY CLASS */
|
|
|
|
struct MccJulianDay {
|
|
static constexpr double MJD0 = 2400000.5;
|
|
double mjd{51544.5}; // J2000.0
|
|
|
|
constexpr operator double() const
|
|
{
|
|
return MccJulianDay::MJD0 + mjd;
|
|
}
|
|
|
|
constexpr auto operator<=>(const MccJulianDay&) const = default;
|
|
|
|
constexpr auto operator<=>(double v) const
|
|
{
|
|
return v <=> (MccJulianDay::MJD0 + mjd);
|
|
};
|
|
};
|
|
|
|
|
|
/* DEFAULT CELESTIAL POINT CLASS */
|
|
|
|
|
|
template <mcc_angle_c CoordT>
|
|
struct MccGenericCelestialPoint {
|
|
typedef CoordT coord_t;
|
|
|
|
MccCoordPairKind pair_kind{MccCoordPairKind::COORDS_KIND_RADEC_ICRS};
|
|
|
|
MccTimePoint time_point{std::chrono::sys_days(std::chrono::year_month_day{std::chrono::January / 1 / 2000}) +
|
|
std::chrono::hours(12)}; // J2000.0
|
|
|
|
coord_t X{}, Y{};
|
|
};
|
|
|
|
|
|
typedef MccGenericCelestialPoint<double> MccCelestialPoint;
|
|
|
|
|
|
template <mcc_angle_c CoordT>
|
|
struct MccGenericEqtHrzCoords : MccGenericCelestialPoint<CoordT> {
|
|
using typename MccGenericCelestialPoint<CoordT>::coord_t;
|
|
|
|
using MccGenericCelestialPoint<CoordT>::time_point;
|
|
|
|
coord_t RA_APP{}, DEC_APP{}, HA{}, AZ{}, ZD{}, ALT{};
|
|
};
|
|
|
|
typedef MccGenericEqtHrzCoords<MccCelestialPoint::coord_t> MccEqtHrzCoords;
|
|
|
|
|
|
template <mcc_angle_c CoordT>
|
|
struct MccGenericPointingTarget : MccGenericEqtHrzCoords<CoordT> {
|
|
using typename MccGenericEqtHrzCoords<CoordT>::coord_t;
|
|
|
|
coord_t RA_ICRS{}, DEC_ICRS{};
|
|
};
|
|
|
|
|
|
typedef MccGenericPointingTarget<MccCelestialPoint::coord_t> MccPointingTarget;
|
|
|
|
|
|
/* DEFAULT TELEMETRY DATA CLASS */
|
|
|
|
template <mcc_angle_c CoordT>
|
|
struct MccGenericTelemetryData : MccGenericEqtHrzCoords<CoordT> {
|
|
using typename MccGenericEqtHrzCoords<CoordT>::coord_t;
|
|
|
|
MccJulianDay JD;
|
|
coord_t LST; // local apparent sideral time
|
|
|
|
MccGenericPointingTarget<coord_t> target{};
|
|
|
|
coord_t speedX, speedY;
|
|
|
|
coord_t pcmX, pcmY;
|
|
|
|
coord_t refCorr;
|
|
};
|
|
|
|
|
|
typedef MccGenericTelemetryData<MccCelestialPoint::coord_t> MccTelemetryData;
|
|
|
|
|
|
|
|
/* JUST CHECK FOR CONCEPT CONSISTENCY */
|
|
|
|
static_assert(mcc_julday_c<MccJulianDay>, "");
|
|
static_assert(mcc_celestial_point_c<MccCelestialPoint>, "");
|
|
static_assert(mcc_telemetry_data_c<MccTelemetryData>, "");
|
|
|
|
|
|
} // namespace mcc
|