...
This commit is contained in:
parent
43c6e58d84
commit
68dac5aa6c
@ -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)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
/* AN GENERIC MOUNT CLASS IMPLEMENTATION */
|
||||
|
||||
#include <atomic>
|
||||
// #include <atomic>
|
||||
#include <chrono>
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
|
||||
68
cxx/mcc_mount_config.h
Normal file
68
cxx/mcc_mount_config.h
Normal file
@ -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 <MccMountType TYPE>
|
||||
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 <MccMountType MOUNT_TYPE>
|
||||
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 <typename ComponentT, typename... CompCtorArgTs>
|
||||
// auto update(this auto&& self, CompCtorArgTs... comp_ctor_args)
|
||||
// {
|
||||
// return std::forward<decltype(self)>(self).updateImpl(std::forward<CompCtorArgTs>(comp_ctor_args)...);
|
||||
// }
|
||||
};
|
||||
|
||||
} // namespace mcc
|
||||
76
cxx/mcc_mount_telemetry.h
Normal file
76
cxx/mcc_mount_telemetry.h
Normal file
@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
||||
|
||||
|
||||
/* MOUNT TELEMETRY OBJECT CONCEPT AND DEFAULT IMPLEMENTATION */
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace mcc
|
||||
{
|
||||
|
||||
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
concept mcc_mount_telemetry_c = requires(T t) {
|
||||
typename T::mount_telemetry_data_t;
|
||||
{ t.update() } -> std::same_as<typename T::mount_telemetry_data_t>;
|
||||
};
|
||||
|
||||
} // 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
|
||||
@ -8,7 +8,8 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include "mcc_coord.h"
|
||||
// #include "mcc_coord.h"
|
||||
#include "mcc_mount_coord.h"
|
||||
|
||||
#ifdef VEC_XSIMD
|
||||
#include <xsimd/xsimd.hpp>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user