From 2a3e00bba9d986951bc56d3da3e642abc46cd5fa Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Fri, 28 Mar 2025 15:39:25 +0300 Subject: [PATCH] ... --- cxx/mount.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/cxx/mount.h b/cxx/mount.h index f23a287..e5c3777 100644 --- a/cxx/mount.h +++ b/cxx/mount.h @@ -75,11 +75,13 @@ struct MccMountPosition { mnt_coord_t tagRA, tagDEC; mnt_coord_t tagHA; mnt_coord_t tagAZ, tagZD; + mnt_coord_t tagPA; // paralactic angle // encoder-measured current mount coordinates (in radians) mnt_coord_t mntRA, mntDEC; mnt_coord_t mntHA; mnt_coord_t mntAZ, mntZD; + mnt_coord_t mntPA; // encoder-measured current mount moving speed (in radians/s) // X - HA, Y - DEC for equatorial-type mount; X - AZ, Y - ZD for horizontal-type one @@ -94,6 +96,18 @@ struct MccMountPosition { }; +// mount site geographical location +struct MccMountSiteInfo { + typedef double mnt_site_coord_t; + typedef double mnt_site_elev_t; + + mnt_site_coord_t latitude; // in radians + mnt_site_coord_t longitude; // in radians (positive to the East) + mnt_site_elev_t elevation; // in meters + + std::string_view name; +}; + /* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */ @@ -192,12 +206,68 @@ public: } + // geo location setters/getters - void setMeteo(std::derived_from auto const& meteo) + void setGeoLocation(const MccMountSiteInfo& geoloc) + { + _geoLocation.store(geoloc); + } + + void setSiteLatitude(auto const& lat) + { + auto v = utils::parsAngleString(lat); + if (v.has_value()) { + auto st = _geoLocation.load(); + st.latitude = v.value() * utils::deg2radCoeff; // to radians + logInfo("Set current site latitude to {} radians", st.latitude); + _geoLocation.store(st); + } else { + logError("Invalid user latitude value! Do not change the current value!"); + } + } + + void setSiteLongitude(auto const& lon) + { + auto v = utils::parsAngleString(lon); + if (v.has_value()) { + auto st = _geoLocation.load(); + st.longitude = v.value() * utils::deg2radCoeff; // to radians + logInfo("Set current site longitude to {} radians", st.longitude); + _geoLocation.store(st); + } else { + logError("Invalid user longitude value! Do not change the current value!"); + } + } + + void setSiteElevation(MccMountSiteInfo::mnt_site_elev_t elev) + { + auto st = _geoLocation.load(); + st.elevation = elev; + logInfo("Set current site elevation to {} meters", st.elevation); + _geoLocation.store(st); + } + + + MccMountSiteInfo getGeoLocation() const + { + return _geoLocation.load(); + } + + + // current meteo setters/getters + + void setMeteo(const MccMountMeteo& meteo) { _currentMeteo.store(meteo); } + MccMountMeteo getMeteo() const + { + return _currentMeteo.load(); + } + + + // IERS databases updater bool updateIERSDatabase(IersDatabaseType type) { @@ -241,6 +311,7 @@ protected: std::atomic _currentMountOrient; + std::atomic _geoLocation; std::atomic _currentMeteo; };