From d663f6b54a392c5339e609e2bddd6d5f6020f82b Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Wed, 9 Jul 2025 00:58:19 +0300 Subject: [PATCH] ... --- cxx/mcc_mount_astro_erfa.h | 26 +++++++++------------ cxx/mcc_mount_concepts.h | 46 ++++++++++++++++---------------------- cxx/mcc_mount_telemetry.h | 25 +++++++++++---------- cxx/tests/astrom_test.cpp | 15 +++++++++++-- 4 files changed, 55 insertions(+), 57 deletions(-) diff --git a/cxx/mcc_mount_astro_erfa.h b/cxx/mcc_mount_astro_erfa.h index 04e7c29..c49f03c 100644 --- a/cxx/mcc_mount_astro_erfa.h +++ b/cxx/mcc_mount_astro_erfa.h @@ -12,7 +12,8 @@ #include "mcc_astrom_iers.h" #include "mcc_mount_coord.h" -#include "mcc_mount_astrom.h" +// #include "mcc_mount_astrom.h" +#include "mcc_mount_concepts.h" namespace mcc::astrom::erfa { @@ -77,12 +78,9 @@ public: }; typedef MccAngle coord_t; - typedef MccAngle prop_motion_t; - typedef double parallax_t; - typedef MccAngle gst_t; + typedef MccAngle sideral_time_t; typedef MccAngle pa_t; - typedef double eo_t; struct refract_result_t { double refa, refb; @@ -158,7 +156,7 @@ public: } - engine_err_t apparentSiderTime(juldate_t juldate, gst_t& gst, bool islocal = false) + engine_err_t apparentSiderTime(juldate_t juldate, sideral_time_t& gst, bool islocal = false) { std::lock_guard lock{_stateMutex}; @@ -211,16 +209,12 @@ public: engine_err_t icrs2obs(coord_t ra, coord_t dec, - prop_motion_t pm_ra, - prop_motion_t pm_dec, - parallax_t parallax, juldate_t juldate, coord_t& ra_app, coord_t& dec_app, coord_t& ha, coord_t& az, - coord_t& alt, - eo_t& eo) + coord_t& alt) { std::lock_guard lock{_stateMutex}; @@ -238,12 +232,12 @@ public: pol_pos->x *= arcsec2rad; pol_pos->y *= arcsec2rad; - double oaz, ozd, oha, odec, ora; + double oaz, ozd, oha, odec, ora, eo; - int ret = eraAtco13(ra, dec, pm_ra, pm_dec, parallax, 0.0, juldate.MJD0, juldate.mjd, dut1->count(), - _currentState.lon, _currentState.lat, _currentState.elev, pol_pos->x, pol_pos->y, - _currentState.meteo.pressure, _currentState.meteo.temperature, _currentState.meteo.humidity, - _currentState.wavelength, &oaz, &ozd, &oha, &odec, &ora, &eo); + int ret = eraAtco13(ra, dec, 0.0, 0.0, 0.0, 0.0, juldate.MJD0, juldate.mjd, dut1->count(), _currentState.lon, + _currentState.lat, _currentState.elev, pol_pos->x, pol_pos->y, _currentState.meteo.pressure, + _currentState.meteo.temperature, _currentState.meteo.humidity, _currentState.wavelength, + &oaz, &ozd, &oha, &odec, &ora, &eo); if (ret == 1) { return ERROR_DUBIOUS_YEAR; diff --git a/cxx/mcc_mount_concepts.h b/cxx/mcc_mount_concepts.h index 50cc5bf..9a9ff64 100644 --- a/cxx/mcc_mount_concepts.h +++ b/cxx/mcc_mount_concepts.h @@ -38,14 +38,11 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) { typename T::engine_state_t; requires std::movable; - typename T::coord_t; - typename T::prop_motion_t; - typename T::parallax_t; - typename T::time_point_t; - typename T::juldate_t; - typename T::gst_t; - typename T::pa_t; - typename T::eo_t; + typename T::coord_t; // type for coordinates representation + typename T::time_point_t; // type to represent UTC time point + typename T::juldate_t; // type to represent Julian date + typename T::sideral_time_t; // type to represent sideral time + typename T::pa_t; // type to represent parallactic angle typename T::refract_result_t; @@ -58,14 +55,12 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) { /* coordinates conversional methods */ - // ICRS RA and DEC to observed place: icrs2obs(ra, dec, pra, pdec, plx, jd, ra_app, dec_app, ha, az, alt, eo) + // ICRS RA and DEC to observed place: icrs2obs(ra, dec, jd, ra_app, dec_app, ha, az, alt) { t.icrs2obs(std::declval(), std::declval(), - std::declval(), std::declval(), - std::declval(), std::declval(), + std::declval(), std::declval(), std::declval(), std::declval(), - std::declval(), std::declval(), - std::declval(), std::declval()) + std::declval(), std::declval()) } -> std::same_as; // compute hour angle and declination from azimuth and altitude: hadec2azalt(ha, dec, az, alt) @@ -80,7 +75,7 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) { std::declval(), std::declval()) } -> std::same_as; - // compute paralactic angle: hadec2pa(ha, dec, pa) + // compute parallactic angle: hadec2pa(ha, dec, pa) { t.hadec2pa(std::declval(), std::declval(), std::declval()) @@ -93,12 +88,11 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) { { t.greg2jul(std::declval(), std::declval()) } -> std::same_as; - // requires mcc_systime_c>; - // requires mcc_output_arg_c, typename T::juldate_t>; // apparent sideral time: apparentSiderTime(jd, gst, islocal) + // if islocal == false then the method must return the Greenwich apparent sideral time, otherwise - local one { - t.apparentSiderTime(std::declval(), std::declval(), + t.apparentSiderTime(std::declval(), std::declval(), std::declval()) } -> std::same_as; @@ -120,14 +114,12 @@ concept mcc_hw_encoder_c = requires(T t, const T t_const) { typename T::coord_t; typename T::speed_t; typename T::accel_t; - // typename T::high_order_deriv_t; requires requires(typename T::state_t st) { - std::same_as; - std::same_as; - std::same_as; - std::same_as; - // std::same_as; + requires std::same_as; + requires std::same_as; + requires std::same_as; + requires std::same_as; }; { t_const.errorString(std::declval()) } -> mcc_formattable; @@ -147,9 +139,9 @@ concept mcc_hw_motor_c = requires(T t, const T t_const) { typename T::accel_t; requires requires(typename T::pos_t st) { - std::same_as; - std::same_as; // means maximal allowed speed - std::same_as; // means a maximal allowed acceleration (jerk) + requires std::same_as; + requires std::same_as; // means maximal allowed speed + requires std::same_as; // means a maximal allowed acceleration (jerk) }; @@ -157,7 +149,7 @@ concept mcc_hw_motor_c = requires(T t, const T t_const) { { t_const.id() } -> mcc_formattable; - { t.rotate(std::declval()) } -> std::same_as; + { t.toPos(std::declval()) } -> std::same_as; { t.stop() } -> std::same_as; }; diff --git a/cxx/mcc_mount_telemetry.h b/cxx/mcc_mount_telemetry.h index 71434b3..c7cc768 100644 --- a/cxx/mcc_mount_telemetry.h +++ b/cxx/mcc_mount_telemetry.h @@ -8,28 +8,29 @@ #include #include -#include "mcc_mount_config.h" +// #include "mcc_mount_config.h" +#include "mcc_mount_concepts.h" namespace mcc { -namespace traits -{ +// namespace traits +// { -template -concept mcc_mount_telemetry_c = requires(T t, const T t_const) { - typename T::error_t; - typename T::mount_telemetry_data_t; +// template +// concept mcc_mount_telemetry_c = requires(T t, const T t_const) { +// typename T::error_t; +// typename T::mount_telemetry_data_t; - { t_const.errorString(std::declval()) } -> mcc_formattable; +// { t_const.errorString(std::declval()) } -> mcc_formattable; - { t.update() } -> std::same_as; +// { t.update() } -> std::same_as; - { t_const.data() } -> std::same_as; -}; +// { t_const.data() } -> std::same_as; +// }; -} // namespace traits +// } // namespace traits class MccMountTelemetry diff --git a/cxx/tests/astrom_test.cpp b/cxx/tests/astrom_test.cpp index c1f8339..865353a 100644 --- a/cxx/tests/astrom_test.cpp +++ b/cxx/tests/astrom_test.cpp @@ -153,6 +153,8 @@ int main(int argc, char* argv[]) state.meteo = {10.0, 0.5, 1010.0}; + std::cout << "LON = " << state.lon.sexagesimal() << "\n"; + std::cout << "LAT = " << state.lat.sexagesimal() << "\n\n"; mcc::astrom::erfa::MccMountAstromEngineERFA erfa(state); mcc::astrom::erfa::MccMountAstromEngineERFA::juldate_t jd{60861.72}; @@ -161,14 +163,23 @@ int main(int argc, char* argv[]) erfa.greg2jul(now, jd); std::cout << "MJD(" << now << ") = " << jd.mjd << "\n"; + mcc::MccAngle gst; + erfa.apparentSiderTime(jd, gst, true); + std::cout << "GST(MJD = " << jd.mjd << ") = " << gst.sexagesimal(true) << "\n\n"; + mcc::MccAngle ra1{"10:00:00", mcc::mcc_hms}, dec1{"68:25:10.43"}, ra_o, dec_o, ha1, az1, alt1; - std::cout << "RA = " << ra1.sexagesimal(true) << ", DEC = " << dec1.sexagesimal() << "\n"; - auto res = erfa.icrs2obs(ra1, dec1, 0, 0, 0, jd, ra_o, dec_o, ha1, az1, alt1, eo); + + auto res = erfa.icrs2obs(ra1, dec1, jd, ra_o, dec_o, ha1, az1, alt1); + std::cout << "ret code (icrs2obs) = " << erfa.errorString(res) << "\n"; std::cout << "alt = " << alt1.sexagesimal() << "\n"; std::cout << "az = " << az1.sexagesimal() << "\n"; + std::cout << "RA_app = " << ra_o.sexagesimal(true) << "\n"; + std::cout << "DEC_app = " << dec_o.sexagesimal() << "\n"; + + return ecode; }