...
This commit is contained in:
parent
9bfe1c3ad5
commit
25438960e6
@ -156,6 +156,7 @@ if (WITH_TESTS)
|
||||
|
||||
set(ASTROM_TEST_APP astrom_test)
|
||||
add_executable(${ASTROM_TEST_APP} tests/astrom_test.cpp)
|
||||
target_include_directories(${ASTROM_TEST_APP} PRIVATE ${FITPACK_INCLUDE_DIR})
|
||||
target_link_libraries(${ASTROM_TEST_APP} ERFA_LIB)
|
||||
|
||||
set(FITPACK_TEST_APP fitpack_test)
|
||||
|
||||
@ -6,9 +6,11 @@
|
||||
|
||||
|
||||
#include "asibfm700_hardware.h"
|
||||
#include "mcc_fsm_mount.h"
|
||||
#include "mcc_guiding_model.h"
|
||||
#include "mcc_mount_astro_erfa.h"
|
||||
#include "mcc_mount_pec.h"
|
||||
#include "mcc_mount_pz.h"
|
||||
#include "mcc_mount_telemetry.h"
|
||||
#include "mcc_slew_model.h"
|
||||
|
||||
@ -19,7 +21,7 @@ typedef mcc::astrom::erfa::MccMountAstromEngineERFA<mcc::MccAngle> AsibFM700Astr
|
||||
|
||||
typedef mcc::MccMountDefaultPEC<mcc::MccMountType::FORK_TYPE> AsibFM700PointingErrorCorrection;
|
||||
|
||||
typedef mcc::MccMountTelemetryData<AsibFM700AstromEngine, AsibFM700PointingErrorCorrection> AsibFM700TelemetryData;
|
||||
typedef mcc::MccMountTelemetryData<AsibFM700AstromEngine> AsibFM700TelemetryData;
|
||||
|
||||
typedef mcc::MccMountTelemetry<AsibFM700AstromEngine,
|
||||
AsibFM700PointingErrorCorrection,
|
||||
@ -28,19 +30,30 @@ typedef mcc::MccMountTelemetry<AsibFM700AstromEngine,
|
||||
AsibFM700Telemetry;
|
||||
|
||||
|
||||
typedef mcc::MccSimpleSlewModel<> AsibFM700SlewModel;
|
||||
typedef mcc::MccSimpleGuidingModel<> AsibFM700GuidingModel;
|
||||
// typedef mcc::MccSimpleSlewModel<> AsibFM700SlewModel;
|
||||
// typedef mcc::MccSimpleGuidingModel<> AsibFM700GuidingModel;
|
||||
|
||||
|
||||
struct AsibMountControls {
|
||||
AsibMountControls() : telemetry(astrometryEngine, PEC, hardware) {}
|
||||
template <mcc::traits::mcc_logger_c LoggerT>
|
||||
using AsibFM700SlewModel = mcc::MccSimpleSlewModel<LoggerT>;
|
||||
|
||||
template <mcc::traits::mcc_logger_c LoggerT>
|
||||
using AsibFM700GuidingModel = mcc::MccSimpleGuidingModel<LoggerT>;
|
||||
|
||||
|
||||
template <mcc::traits::mcc_logger_c LoggerT>
|
||||
struct AsibFM700MountControls {
|
||||
AsibFM700MountControls(AsibFM700MountControls&&) = default;
|
||||
AsibFM700MountControls& operator=(AsibFM700MountControls&&) = default;
|
||||
|
||||
AsibFM700AstromEngine astrometryEngine;
|
||||
AsibFM700PointingErrorCorrection PEC;
|
||||
AsibFM700Hardware hardware;
|
||||
AsibFM700Telemetry telemetry;
|
||||
AsibFM700SlewModel slewModel;
|
||||
AsibFM700GuidingModel guidingModel;
|
||||
AsibFM700Telemetry telemetry{astrometryEngine, PEC, hardware};
|
||||
AsibFM700SlewModel<LoggerT> slewModel;
|
||||
AsibFM700GuidingModel<LoggerT> guidingModel;
|
||||
|
||||
std::tuple<mcc::MccAltLimitPZ<mcc::MccAltLimitKind::MIN_ALT_LIMIT>> prohibitedZones;
|
||||
};
|
||||
|
||||
// global mount configuration
|
||||
@ -52,4 +65,10 @@ struct AsibFM700Config {
|
||||
AsibFM700Hardware::hardware_config_t hardwareConfig;
|
||||
};
|
||||
|
||||
|
||||
class AsibFM700Mount : public mcc::MccMount<AsibFM700MountControls<mcc::utils::MccSpdlogLogger>>
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
} // namespace asibfm700
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
typedef decltype(mount_controls_t::slewModel) slew_model_t;
|
||||
typedef decltype(mount_controls_t::guidingModel) guiding_model_t;
|
||||
|
||||
typedef typename slew_model_t::slew_params_t slew_params_t;
|
||||
// typedef typename slew_model_t::slew_params_t slew_params_t;
|
||||
|
||||
|
||||
/* constructors and destructor */
|
||||
@ -65,24 +65,18 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual ~MccMount()
|
||||
{
|
||||
logDebug("Delete MccMount class instance: thread = {}", getThreadId());
|
||||
}
|
||||
virtual ~MccMount() { logDebug("Delete MccMount class instance: thread = {}", getThreadId()); }
|
||||
|
||||
|
||||
/* public methods */
|
||||
|
||||
void initMount()
|
||||
{
|
||||
this->logInfo("STATE: {}", this->currentStateID());
|
||||
}
|
||||
void initMount() { this->logInfo("STATE: {}", this->currentStateID()); }
|
||||
|
||||
void stopMount() {}
|
||||
|
||||
void shutdownMount() {}
|
||||
|
||||
void slewMount(slew_params_t params) {}
|
||||
// void slewMount(slew_params_t params) {}
|
||||
|
||||
void startGuiding() {}
|
||||
|
||||
|
||||
@ -58,10 +58,7 @@ namespace mcc::astrom::erfa
|
||||
struct MccMountAstromEngineERFACategory : public std::error_category {
|
||||
MccMountAstromEngineERFACategory() : std::error_category() {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "ADC_GENERIC_DEVICE";
|
||||
}
|
||||
const char* name() const noexcept { return "ADC_GENERIC_DEVICE"; }
|
||||
|
||||
std::string message(int ec) const
|
||||
{
|
||||
@ -178,6 +175,12 @@ public:
|
||||
|
||||
MccMountAstromEngineERFA(engine_state_t state) : _currentState(std::move(state)) {}
|
||||
|
||||
MccMountAstromEngineERFA(MccMountAstromEngineERFA&&) = default;
|
||||
MccMountAstromEngineERFA& operator=(MccMountAstromEngineERFA&&) = default;
|
||||
|
||||
MccMountAstromEngineERFA(const MccMountAstromEngineERFA&) = delete;
|
||||
MccMountAstromEngineERFA& operator=(const MccMountAstromEngineERFA&) = delete;
|
||||
|
||||
virtual ~MccMountAstromEngineERFA() = default;
|
||||
|
||||
void setState(engine_state_t state)
|
||||
@ -251,10 +254,7 @@ public:
|
||||
|
||||
/* time-related methods */
|
||||
|
||||
static time_point_t timePointNow()
|
||||
{
|
||||
return time_point_t::clock::now();
|
||||
}
|
||||
static time_point_t timePointNow() { return time_point_t::clock::now(); }
|
||||
|
||||
// templated generic version
|
||||
template <mcc::traits::mcc_systime_c TpT>
|
||||
@ -554,26 +554,14 @@ public:
|
||||
|
||||
/* helper mathods */
|
||||
|
||||
auto leapSecondsExpireDate() const
|
||||
{
|
||||
return _currentState._leapSeconds.expireDate();
|
||||
}
|
||||
auto leapSecondsExpireDate() const { return _currentState._leapSeconds.expireDate(); }
|
||||
|
||||
auto leapSecondsExpireMJD() const
|
||||
{
|
||||
return _currentState._leapSeconds.expireMJD();
|
||||
}
|
||||
auto leapSecondsExpireMJD() const { return _currentState._leapSeconds.expireMJD(); }
|
||||
|
||||
|
||||
auto bulletinADateRange() const
|
||||
{
|
||||
return _currentState._bulletinA.dateRange();
|
||||
}
|
||||
auto bulletinADateRange() const { return _currentState._bulletinA.dateRange(); }
|
||||
|
||||
auto bulletinADateRangeMJD() const
|
||||
{
|
||||
return _currentState._bulletinA.dateRangeMJD();
|
||||
}
|
||||
auto bulletinADateRangeMJD() const { return _currentState._bulletinA.dateRangeMJD(); }
|
||||
|
||||
protected:
|
||||
engine_state_t _currentState{};
|
||||
|
||||
@ -267,7 +267,7 @@ concept mcc_mount_hardware_c = !std::copyable<T> && std::movable<T> && requires(
|
||||
/* POINTING-ERROR CORRECTION */
|
||||
|
||||
template <typename T>
|
||||
concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
||||
concept mcc_mount_pec_c = requires(T t) {
|
||||
requires mcc_error_c<typename T::error_t>;
|
||||
typename T::coord_t;
|
||||
|
||||
@ -349,8 +349,6 @@ concept mcc_mount_telemetry_c = requires(T t, const T t_const) {
|
||||
|
||||
requires mcc_mount_telemetry_data_c<typename T::mount_telemetry_data_t>;
|
||||
|
||||
{ t_const.errorString(std::declval<typename T::error_t>()) } -> mcc_formattable;
|
||||
|
||||
{ t.update() } -> std::same_as<typename T::error_t>;
|
||||
|
||||
{ t.data(std::declval<typename T::mount_telemetry_data_t&>()) } -> std::same_as<typename T::error_t>;
|
||||
@ -499,7 +497,8 @@ concept mcc_prohibited_zone_c =
|
||||
|
||||
|
||||
template <typename T>
|
||||
concept mcc_mount_controls_c = std::move_constructible<T> && std::movable<T> && requires(T t) {
|
||||
concept mcc_mount_controls_c = requires(T t) {
|
||||
// concept mcc_mount_controls_c = std::move_constructible<T> && std::movable<T> && requires(T t) {
|
||||
requires mcc_astrom_engine_c<decltype(t.astrometryEngine)>;
|
||||
requires mcc_mount_pec_c<decltype(t.PEC)>;
|
||||
requires mcc_mount_hardware_c<decltype(t.hardware)>;
|
||||
@ -536,7 +535,7 @@ concept mcc_mount_c = requires(T t) {
|
||||
// requires mcc_guiding_model_c<typename T::guiding_model_t, typename T::mount_telemetry_t>;
|
||||
requires mcc_guiding_model_c<typename T::guiding_model_t>;
|
||||
|
||||
requires std::same_as<typename T::slew_params_t, typename T::slew_model_t::slew_params_t>;
|
||||
// requires std::same_as<typename T::slew_params_t, typename T::slew_model_t::slew_params_t>;
|
||||
|
||||
// public method
|
||||
{ t.mountTelemetryData() } -> std::same_as<typename T::mount_telemetry_data_t>;
|
||||
|
||||
@ -71,7 +71,7 @@ namespace mcc
|
||||
|
||||
/* DEFAULT TELEMETRY DATA CLASS */
|
||||
|
||||
template <traits::mcc_astrom_engine_c ASTROM_ENGINE_T, traits::mcc_mount_pec_c PEC_T>
|
||||
template <traits::mcc_astrom_engine_c ASTROM_ENGINE_T>
|
||||
struct MccMountTelemetryData {
|
||||
typedef typename ASTROM_ENGINE_T::coord_t coord_t;
|
||||
typedef typename ASTROM_ENGINE_T::time_point_t time_point_t;
|
||||
@ -120,8 +120,7 @@ struct MccMountTelemetryData {
|
||||
template <traits::mcc_astrom_engine_c ASTROM_ENGINE_T,
|
||||
traits::mcc_mount_pec_c PEC_T,
|
||||
traits::mcc_mount_hardware_c HARDWARE_T,
|
||||
std::derived_from<MccMountTelemetryData<ASTROM_ENGINE_T, PEC_T>> DATA_T =
|
||||
MccMountTelemetryData<ASTROM_ENGINE_T, PEC_T>>
|
||||
std::derived_from<MccMountTelemetryData<ASTROM_ENGINE_T>> DATA_T = MccMountTelemetryData<ASTROM_ENGINE_T>>
|
||||
class MccMountTelemetry : public MccMountTelemetryAstromTransform<ASTROM_ENGINE_T, PEC_T>
|
||||
{
|
||||
typedef MccMountTelemetryAstromTransform<ASTROM_ENGINE_T, PEC_T> base_t;
|
||||
|
||||
@ -26,10 +26,7 @@ enum class MccMountTelemetryAstromTransformErrorCode : int {
|
||||
struct MccMountTelemetryAstromTransformCategory : public std::error_category {
|
||||
MccMountTelemetryAstromTransformCategory() : std::error_category() {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "ADC_GENERIC_DEVICE";
|
||||
}
|
||||
const char* name() const noexcept { return "ADC_GENERIC_DEVICE"; }
|
||||
|
||||
std::string message(int ec) const
|
||||
{
|
||||
@ -83,7 +80,7 @@ namespace mcc
|
||||
template <traits::mcc_astrom_engine_c ASTROM_ENGINE_T, traits::mcc_mount_pec_c PEC_T>
|
||||
class MccMountTelemetryAstromTransform
|
||||
{
|
||||
static typename ASTROM_ENGINE_T::coord_t dummyCoord{};
|
||||
inline static typename ASTROM_ENGINE_T::coord_t dummyCoord{};
|
||||
|
||||
public:
|
||||
typedef ASTROM_ENGINE_T astrom_engine_t;
|
||||
|
||||
@ -141,6 +141,11 @@ public:
|
||||
init(mount_controls);
|
||||
}
|
||||
|
||||
MccSimpleSlewModel(MccSimpleSlewModel&&) = default;
|
||||
MccSimpleSlewModel& operator=(MccSimpleSlewModel&&) = default;
|
||||
MccSimpleSlewModel(const MccSimpleSlewModel&) = default;
|
||||
MccSimpleSlewModel& operator=(const MccSimpleSlewModel&) = default;
|
||||
|
||||
virtual ~MccSimpleSlewModel()
|
||||
{
|
||||
logDebug(std::format("Delete 'MccSimpleSlewModel' class instance ({})", (void*)this));
|
||||
@ -163,7 +168,6 @@ public:
|
||||
protected:
|
||||
std::atomic_bool _stopRequested{false};
|
||||
std::function<error_t(const slew_point_t&)> _slewFunc{};
|
||||
std::mutex _updateMutex{};
|
||||
|
||||
void init(auto& mount_controls)
|
||||
{
|
||||
@ -404,6 +408,4 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
static_assert(traits::mcc_slew_model_c<MccSimpleSlewModel<>>, "");
|
||||
|
||||
} // namespace mcc
|
||||
|
||||
@ -1,23 +1,28 @@
|
||||
#include <fstream>
|
||||
// #include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// #include "../mcc_coord.h"
|
||||
#include "../mcc_mount_astro_erfa.h"
|
||||
#include "../mcc_mount_pz.h"
|
||||
#include "../mount_astrom.h"
|
||||
// #include "../mount_astrom.h"
|
||||
#include "../mcc_mount_pec.h"
|
||||
#include "../mcc_mount_telemetry.h"
|
||||
|
||||
// BTA coords from maps.yandex.ru: 43.646711, 41.440732
|
||||
|
||||
struct tel_data_t {
|
||||
typedef mcc::MccAngle coord_t;
|
||||
typedef std::chrono::system_clock::time_point time_point_t;
|
||||
// struct tel_data_t {
|
||||
// typedef mcc::MccAngle coord_t;
|
||||
// typedef std::chrono::system_clock::time_point time_point_t;
|
||||
|
||||
time_point_t time_point;
|
||||
coord_t mntRA, mntDEC, mntHA;
|
||||
coord_t mntAZ, mntALT;
|
||||
coord_t mntPosX, mntPosY;
|
||||
coord_t mntRateX, mntRateY;
|
||||
};
|
||||
// time_point_t time_point;
|
||||
// coord_t tagRA, tagDEC, tagHA;
|
||||
// coord_t tagAZ, tagALT;
|
||||
|
||||
// coord_t mntRA, mntDEC, mntHA;
|
||||
// coord_t mntAZ, mntALT;
|
||||
// coord_t mntPosX, mntPosY;
|
||||
// coord_t mntRateX, mntRateY;
|
||||
// };
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
@ -209,7 +214,13 @@ int main(int argc, char* argv[])
|
||||
mcc::MccMinAltPZ minalt_pz(10.0_degs, state.lat);
|
||||
mcc::MccMaxAltPZ maxalt_pz(85.0_degs, state.lat);
|
||||
|
||||
tel_data_t tdata{std::chrono::system_clock::now(), ra_o, dec_o, ha1, az1, alt1, 0.0, 0.0, 0.0, 0.0};
|
||||
// tel_data_t tdata{std::chrono::system_clock::now(), ra_o, dec_o, ha1, az1, alt1, 0.0, 0.0, 0.0, 0.0};
|
||||
mcc::MccMountTelemetryData<engine_t> tdata{.time_point = engine_t::timePointNow(),
|
||||
.mntRA = ra_o,
|
||||
.mntDEC = dec_o,
|
||||
.mntHA = ha1,
|
||||
.mntAZ = az1,
|
||||
.mntALT = alt1};
|
||||
|
||||
bool ask = minalt_pz.inZone(tdata);
|
||||
std::cout << "in zone? " << std::boolalpha << ask << "\n";
|
||||
@ -244,7 +255,13 @@ int main(int argc, char* argv[])
|
||||
std::cout << "DEC_app = " << dec_o.sexagesimal() << "\n";
|
||||
|
||||
|
||||
tdata = {std::chrono::system_clock::now(), ra_o, dec_o, ha1, az1, alt1, 0.0, 0.0, 0.0, 0.0};
|
||||
// tdata = {std::chrono::system_clock::now(), ra_o, dec_o, ha1, az1, alt1, 0.0, 0.0, 0.0, 0.0};
|
||||
tdata = {.time_point = engine_t::timePointNow(),
|
||||
.mntRA = ra_o,
|
||||
.mntDEC = dec_o,
|
||||
.mntHA = ha1,
|
||||
.mntAZ = az1,
|
||||
.mntALT = alt1};
|
||||
|
||||
jd.mjd += 1.0;
|
||||
res = erfa.icrs2obs(ra1, dec1, jd, ra_o, dec_o, ha1, az1, alt1, eor);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user