From 68dac5aa6ca9eb4809ae672e72f67828c2133a92 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Tue, 1 Jul 2025 16:59:13 +0300 Subject: [PATCH] ... --- cxx/CMakeLists.txt | 2 +- cxx/mcc_mount.h | 2 +- cxx/mcc_mount_config.h | 68 +++++++++++++++++++++++++++++++++++ cxx/mcc_mount_telemetry.h | 76 +++++++++++++++++++++++++++++++++++++++ cxx/mount_astrom.h | 3 +- 5 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 cxx/mcc_mount_config.h create mode 100644 cxx/mcc_mount_telemetry.h diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt index ec49715..fbdf671 100644 --- a/cxx/CMakeLists.txt +++ b/cxx/CMakeLists.txt @@ -124,7 +124,7 @@ add_library(${CNTR_PROTO_LIB} STATIC ${CNTR_PROTO_LIB_SRC}) set(MCC_LIBRARY_SRC mcc_mount.h mcc_mount_coord.h mcc_mount_events_states.h mcc_finite_state_machine.h - mcc_mount_pec.h mcc_mount_pz.h mcc_traits.h) + mcc_mount_pec.h mcc_mount_pz.h mcc_traits.h mcc_mount_telemetry.h mcc_mount_config.h) set(MCC_LIBRARY mcc) add_library(${MCC_LIBRARY} INTERFACE ${MCC_LIBRARY_SRC}) target_compile_features(${MCC_LIBRARY} INTERFACE cxx_std_23) diff --git a/cxx/mcc_mount.h b/cxx/mcc_mount.h index a39a08a..ef3782d 100644 --- a/cxx/mcc_mount.h +++ b/cxx/mcc_mount.h @@ -4,7 +4,7 @@ /* AN GENERIC MOUNT CLASS IMPLEMENTATION */ -#include +// #include #include #include #include diff --git a/cxx/mcc_mount_config.h b/cxx/mcc_mount_config.h new file mode 100644 index 0000000..358fb14 --- /dev/null +++ b/cxx/mcc_mount_config.h @@ -0,0 +1,68 @@ +#pragma once + +/* MOUNT CONTROL COMPONENTS LIBRARY */ + +#include "mcc_mount_coord.h" +#include "mount_astrom.h" + +namespace mcc +{ + +// meteo parameters (e.g. to compute refraction) +struct MccMountMeteo { + typedef double temp_t; + typedef double humid_t; + typedef double press_t; + + temp_t temperature; // Temperature in C + humid_t humidity; // humidity in % ([0.0, 1.0]) + press_t pressure; // atmospheric presure in hPa=mB +}; + + +// mount site geographical location +struct MccMountSiteInfo { + typedef MccAngle mnt_site_coord_t; + typedef MccAngle mnt_site_elev_t; + + mnt_site_coord_t latitude{"00:00:00.0"_dms}; // + mnt_site_coord_t longitude{0.0}; // positive to the East + mnt_site_elev_t elevation{0.0}; // in meters + + std::string_view name{"ALL-ZERO"}; // just a human-readable name +}; + + + +// mount construction type (only the most common ones) +enum class MccMountType : uint8_t { GERMAN_TYPE, FORK_TYPE, CROSSAXIS_TYPE, ALTAZ_TYPE }; + +template +static constexpr std::string_view MccMountTypeStr = TYPE == MccMountType::GERMAN_TYPE ? "GERMAN" + : TYPE == MccMountType::FORK_TYPE ? "FORK" + : TYPE == MccMountType::CROSSAXIS_TYPE ? "CROSSAXIS" + : TYPE == MccMountType::ALTAZ_TYPE ? "ALTAZ" + : "UNKNOWN"; + +// mount configuration +template +struct MccMountConfig { + static constexpr MccMountType mountType = MOUNT_TYPE; + + virtual ~MccMountConfig() = default; + + astrom::MccLeapSeconds leapSeconds; + astrom::MccIersBulletinA iersBulletinA; + + MccMountSiteInfo siteInfo{.latitude = 0.0, .longitude = 0.0, .elevation = 0.0, .name{"ALL-ZERO"}}; + + MccMountMeteo ambientMeteo{.temperature = 0.0, .humidity = 0.5, .pressure = 1010.0}; + + // template + // auto update(this auto&& self, CompCtorArgTs... comp_ctor_args) + // { + // return std::forward(self).updateImpl(std::forward(comp_ctor_args)...); + // } +}; + +} // namespace mcc diff --git a/cxx/mcc_mount_telemetry.h b/cxx/mcc_mount_telemetry.h new file mode 100644 index 0000000..718a0fa --- /dev/null +++ b/cxx/mcc_mount_telemetry.h @@ -0,0 +1,76 @@ +#pragma once + +/* MOUNT CONTROL COMPONENTS LIBRARY */ + + +/* MOUNT TELEMETRY OBJECT CONCEPT AND DEFAULT IMPLEMENTATION */ + +#include + +namespace mcc +{ + + +namespace traits +{ + +template +concept mcc_mount_telemetry_c = requires(T t) { + typename T::mount_telemetry_data_t; + { t.update() } -> std::same_as; +}; + +} // namespace traits + + +class MccMountTelemetry +{ +public: + // mount current telemetry data: time, position and related quantities + struct mount_telemetry_data_t { + typedef double mnt_coord_t; + typedef double mnt_speed_t; + typedef double time_point_t; + + // time-related + std::chrono::system_clock::time_point utc; + time_point_t mjd; // modified Julian date + time_point_t ut1; + time_point_t tt; + time_point_t siderTime; // sideral time (in radians) + + // apparent target (user-input) current coordinates (in radians) + 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 (non-corrected for PCS) current mount position and moving speed (in radians, radians/s) + // X - HA, Y - DEC for equatorial-type mount; X - AZ, Y - ZD for horizontal-type one + mnt_coord_t mntPosX, mntPosY; + mnt_speed_t mntSpeedX, mntSpeedY; + + // current refraction coefficient (for tagZD) + mnt_coord_t currRefr; + + // PCS (pointing correction system) corrections + // X - HA, Y - DEC for equatorial-type mount; X - AZ, Y - ZD for horizontal-type one + mnt_coord_t pcsX, pcsY; + }; + + mount_telemetry_data_t update() + { + return _data; + } + +protected: + mount_telemetry_data_t _data; +}; + +} // namespace mcc diff --git a/cxx/mount_astrom.h b/cxx/mount_astrom.h index 25cfb97..7af590a 100644 --- a/cxx/mount_astrom.h +++ b/cxx/mount_astrom.h @@ -8,7 +8,8 @@ #include #include -#include "mcc_coord.h" +// #include "mcc_coord.h" +#include "mcc_mount_coord.h" #ifdef VEC_XSIMD #include