This commit is contained in:
Timur A. Fatkhullin 2025-03-28 15:39:25 +03:00
parent 91477e2d53
commit 2a3e00bba9

View File

@ -75,11 +75,13 @@ struct MccMountPosition {
mnt_coord_t tagRA, tagDEC; mnt_coord_t tagRA, tagDEC;
mnt_coord_t tagHA; mnt_coord_t tagHA;
mnt_coord_t tagAZ, tagZD; mnt_coord_t tagAZ, tagZD;
mnt_coord_t tagPA; // paralactic angle
// encoder-measured current mount coordinates (in radians) // encoder-measured current mount coordinates (in radians)
mnt_coord_t mntRA, mntDEC; mnt_coord_t mntRA, mntDEC;
mnt_coord_t mntHA; mnt_coord_t mntHA;
mnt_coord_t mntAZ, mntZD; mnt_coord_t mntAZ, mntZD;
mnt_coord_t mntPA;
// encoder-measured current mount moving speed (in radians/s) // 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 // 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 */ /* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */
@ -192,12 +206,68 @@ public:
} }
// geo location setters/getters
void setMeteo(std::derived_from<MccMountMeteo> 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); _currentMeteo.store(meteo);
} }
MccMountMeteo getMeteo() const
{
return _currentMeteo.load();
}
// IERS databases updater
bool updateIERSDatabase(IersDatabaseType type) bool updateIERSDatabase(IersDatabaseType type)
{ {
@ -241,6 +311,7 @@ protected:
std::atomic<mount_orient_t> _currentMountOrient; std::atomic<mount_orient_t> _currentMountOrient;
std::atomic<MccMountSiteInfo> _geoLocation;
std::atomic<MccMountMeteo> _currentMeteo; std::atomic<MccMountMeteo> _currentMeteo;
}; };