This commit is contained in:
Timur A. Fatkhullin 2025-11-18 22:36:08 +03:00
parent 273f239abb
commit c6b47d8ad6
4 changed files with 32 additions and 39 deletions

View File

@ -334,7 +334,9 @@ public:
*st = eraGst06a(ERFA_DJM0, ut1, ERFA_DJM0, tt);
if (islocal) {
*st += _currentState.lon;
// *st += _currentState.lon;
// *st = MccAngle(*st + _currentState.lon).normalize<MccAngle::NORM_KIND_0_360>();
*st = eraAnp(*st + _currentState.lon);
}

View File

@ -484,6 +484,8 @@ struct MccGenericTelemetryData : MccGenericEqtHrzCoords<CoordT> {
coord_t pcmX, pcmY;
coord_t refCorr;
coord_t EO;
};

View File

@ -355,6 +355,20 @@ struct mcc_CCTE_interface_t {
return std::forward<SelfT>(self).timepointToAppSideral(std::move(jd), st, islocal);
}
// EQUATION OF THE ORIGINS (ERA-GST)
template <std::derived_from<mcc_CCTE_interface_t> SelfT>
RetT equationOrigins(this SelfT&& self, mcc_time_point_c auto const& tp, mcc_angle_c auto* eo)
{
return std::forward<SelfT>(self).equationOrigins(std::move(tp), eo);
}
template <std::derived_from<mcc_CCTE_interface_t> SelfT>
RetT equationOrigins(this SelfT&& self, mcc_julday_c auto const& jd, mcc_angle_c auto* eo)
{
return std::forward<SelfT>(self).equationOrigins(std::move(jd), eo);
}
// NOTE: ASSUMING THE AZINUTH IS COUNTED FROM THE SOUTH THROUGH THE WEST!!!
template <std::derived_from<mcc_CCTE_interface_t> SelfT>
RetT transformCoordinates(this SelfT&& self, mcc_celestial_point_c auto from_pt, mcc_celestial_point_c auto* to_pt)
@ -626,6 +640,9 @@ concept mcc_telemetry_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializa
// atmospheric refraction correction for current zenithal distance
requires mcc_angle_c<decltype(t.refCorr)>; // for current .ZD
// equation of the origins (ERA-GST)
requires mcc_angle_c<decltype(t.EO)>;
};

View File

@ -281,6 +281,7 @@ public:
ccte_err = controls->juldayToAppSideral(_data.JD, &_data.LST, true);
if (!ccte_err) {
ccte_err = controls->equationOrigins(_data.JD, &eo);
_data.EO = eo;
}
}
@ -311,7 +312,8 @@ public:
if constexpr (mccIsEquatorialMount(pcm_t::mountType)) {
_data.RA_APP =
MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
MccAngle((double)_data.LST - (double)_data.HA - eo).normalize<MccAngle::NORM_KIND_0_360>();
// MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
_data.X = _data.HA;
_data.Y = _data.DEC_APP;
@ -338,7 +340,8 @@ public:
_data.HA = pt.X;
_data.DEC_APP = pt.Y;
_data.RA_APP =
MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
MccAngle((double)_data.LST - (double)_data.HA - eo).normalize<MccAngle::NORM_KIND_0_360>();
// MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
}
} else {
@ -388,35 +391,6 @@ public:
return MccTelemetryErrorCode::ERROR_OK;
};
// arm internal update loop
// _internalUpdatingStopSource = std::stop_source{};
// _internalUpdatingLoopFuture = std::async(
// std::launch::async,
// [this](std::stop_token stoken) {
// while (!(*_internalUpdatingLoopStop)) {
// {
// std::unique_lock ulock(*_internalUpdatingLoopMutex);
// _internalUpdatingLoopCondVar->wait(ulock, [this]() -> bool { return *_dataUpdatingRequested;
// });
// }
// {
// std::lock_guard lock_update(*_updateMutex);
// *_isDataUpdated = false;
// _lastUpdateError = _updateFunc(stoken);
// }
// *_isDataUpdated = true;
// // unlock all waiting threads
// _updateCondVar->notify_all();
// }
// },
// _internalUpdatingStopSource.get_token());
}
@ -429,8 +403,6 @@ public:
virtual ~MccTelemetry()
{
*_internalUpdatingLoopStop = true;
stopInternalTelemetryDataUpdating();
if (_internalUpdatingFuture.valid()) {
@ -747,11 +719,11 @@ protected:
std::unique_ptr<std::mutex> _updateMutex;
std::unique_ptr<std::condition_variable> _updateCondVar;
std::future<void> _internalUpdatingLoopFuture{};
std::unique_ptr<std::mutex> _internalUpdatingLoopMutex{new std::mutex()};
std::unique_ptr<std::condition_variable> _internalUpdatingLoopCondVar{new std::condition_variable()};
std::unique_ptr<std::atomic_bool> _internalUpdatingLoopStop{new std::atomic_bool{false}};
std::unique_ptr<std::atomic_bool> _dataUpdatingRequested{new std::atomic_bool{false}};
// std::future<void> _internalUpdatingLoopFuture{};
// std::unique_ptr<std::mutex> _internalUpdatingLoopMutex{new std::mutex()};
// std::unique_ptr<std::condition_variable> _internalUpdatingLoopCondVar{new std::condition_variable()};
// std::unique_ptr<std::atomic_bool> _internalUpdatingLoopStop{new std::atomic_bool{false}};
// std::unique_ptr<std::atomic_bool> _dataUpdatingRequested{new std::atomic_bool{false}};
error_t _lastUpdateError{MccTelemetryErrorCode::ERROR_OK};
};