...
This commit is contained in:
parent
2c7d563994
commit
54d6c25171
@ -571,10 +571,21 @@ static constexpr bool mccIsObsCoordPairKind =
|
|||||||
(PK == MccCoordPairKind::COORDS_KIND_RADEC_OBS || PK == MccCoordPairKind::COORDS_KIND_HADEC_OBS ||
|
(PK == MccCoordPairKind::COORDS_KIND_RADEC_OBS || PK == MccCoordPairKind::COORDS_KIND_HADEC_OBS ||
|
||||||
PK == MccCoordPairKind::COORDS_KIND_AZZD || PK == MccCoordPairKind::COORDS_KIND_AZALT);
|
PK == MccCoordPairKind::COORDS_KIND_AZZD || PK == MccCoordPairKind::COORDS_KIND_AZALT);
|
||||||
|
|
||||||
|
static constexpr bool mcc_is_obs_coordpair(MccCoordPairKind kind)
|
||||||
|
{
|
||||||
|
return kind == MccCoordPairKind::COORDS_KIND_RADEC_OBS || kind == MccCoordPairKind::COORDS_KIND_HADEC_OBS ||
|
||||||
|
kind == MccCoordPairKind::COORDS_KIND_AZZD || kind == MccCoordPairKind::COORDS_KIND_AZALT;
|
||||||
|
};
|
||||||
|
|
||||||
template <MccCoordPairKind PK>
|
template <MccCoordPairKind PK>
|
||||||
static constexpr bool mccIsAppCoordPairKind =
|
static constexpr bool mccIsAppCoordPairKind =
|
||||||
(PK == MccCoordPairKind::COORDS_KIND_RADEC_APP || PK == MccCoordPairKind::COORDS_KIND_HADEC_APP);
|
(PK == MccCoordPairKind::COORDS_KIND_RADEC_APP || PK == MccCoordPairKind::COORDS_KIND_HADEC_APP);
|
||||||
|
|
||||||
|
static constexpr bool mcc_is_app_coordpair(MccCoordPairKind kind)
|
||||||
|
{
|
||||||
|
return kind == MccCoordPairKind::COORDS_KIND_RADEC_APP || kind == MccCoordPairKind::COORDS_KIND_HADEC_APP;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static constexpr std::string_view MCC_COORDPAIR_KIND_RADEC_ICRS_STR = "RADEC-IRCS";
|
static constexpr std::string_view MCC_COORDPAIR_KIND_RADEC_ICRS_STR = "RADEC-IRCS";
|
||||||
static constexpr std::string_view MCC_COORDPAIR_KIND_RADEC_APP_STR = "RADEC-APP";
|
static constexpr std::string_view MCC_COORDPAIR_KIND_RADEC_APP_STR = "RADEC-APP";
|
||||||
|
|||||||
@ -597,11 +597,17 @@ public:
|
|||||||
} else { // from apparent (2025-12-18: according to addition of RA/DEC_OCRS to mcc_eqt_hrz_coord_c)
|
} else { // from apparent (2025-12-18: according to addition of RA/DEC_OCRS to mcc_eqt_hrz_coord_c)
|
||||||
cpt.pair_kind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
cpt.pair_kind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
||||||
ret = transformCoordinates(from_pt, &cpt); // to ICRS
|
ret = transformCoordinates(from_pt, &cpt); // to ICRS
|
||||||
if (!ret) {
|
if (ret) {
|
||||||
ret = transformCoordinates(cpt, to_pt);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
to_pt->RA_ICRS = cpt.X;
|
||||||
|
to_pt->DEC_ICRS = cpt.Y;
|
||||||
|
// if (!ret) {
|
||||||
|
// ret = transformCoordinates(cpt, to_pt); // from ICRS to observed
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from apparent: copy corresponded coordinates and compute other ones (ignore to_pt->pair_kind)
|
// from apparent: copy corresponded coordinates and compute other ones (ignore to_pt->pair_kind)
|
||||||
|
|||||||
@ -331,6 +331,10 @@ protected:
|
|||||||
template <mcc_coord_pair_c PT>
|
template <mcc_coord_pair_c PT>
|
||||||
auto toHelper(PT& cpair)
|
auto toHelper(PT& cpair)
|
||||||
{
|
{
|
||||||
|
if (this == &cpair) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr double half_pi = std::numbers::pi / 2.0;
|
static constexpr double half_pi = std::numbers::pi / 2.0;
|
||||||
|
|
||||||
// HA, DEC to AZ, ALT (AZ from the South through the West)
|
// HA, DEC to AZ, ALT (AZ from the South through the West)
|
||||||
@ -387,34 +391,35 @@ protected:
|
|||||||
static_assert(PT::pairKind == MccCoordPairKind::COORDS_KIND_GENERIC, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
static_assert(PT::pairKind == MccCoordPairKind::COORDS_KIND_GENERIC, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
||||||
static_assert(PT::pairKind == MccCoordPairKind::COORDS_KIND_UNKNOWN, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
static_assert(PT::pairKind == MccCoordPairKind::COORDS_KIND_UNKNOWN, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
||||||
|
|
||||||
|
// from ICRS to ICRS - just copy and exit
|
||||||
if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS &&
|
if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS &&
|
||||||
PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
cpair = PT(PT::x_t(_x), PT::y_t(_y), _epoch);
|
cpair = PT(PT::x_t(_x), PT::y_t(_y), _epoch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// just copy coordinates and exit
|
||||||
if (_pairKind == PT::pairKind && utils::isEqual(_epoch.MJD(), cpair.MJD())) {
|
if (_pairKind == PT::pairKind && utils::isEqual(_epoch.MJD(), cpair.MJD())) {
|
||||||
cpair = PT(PT::x_t(_x), PT::y_t(_y), _epoch);
|
cpair = PT(PT::x_t(_x), PT::y_t(_y), _epoch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if epochs is not the same then
|
||||||
|
// 1) convert stored coordinates to ICRS ones
|
||||||
|
// 2) convert from the computed ICRS coordinates to required ones
|
||||||
MccCoordPairKind pkind = _pairKind;
|
MccCoordPairKind pkind = _pairKind;
|
||||||
if (!utils::isEqual(_epoch.MJD(), cpair.MJD())) { // convert stored pair to ICRS one (ra_icrs, dec_icrs)
|
if (!utils::isEqual(_epoch.MJD(), cpair.MJD())) { // convert stored pair to ICRS one (ra_icrs, dec_icrs)
|
||||||
if (_pairKind != MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
if (_pairKind != MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
pkind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
pkind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
||||||
// convert here!!!
|
|
||||||
if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
// cct_engine.appToICRS(app_type, app_x, app_y, ra_icrs, dec_icrs)
|
||||||
|
// cct_engine.obsToICRS(obs_type, obs_x, obs_y, ra_icrs, dec_icrs)
|
||||||
|
|
||||||
|
if (mcc_is_obs_coordpair(_pairKind)) {
|
||||||
|
// cct_engine.obsToICRS(...)
|
||||||
|
} else if (mcc_is_app_coordpair(_pairKind)) {
|
||||||
// cct_engine.appToICRS(...)
|
// cct_engine.appToICRS(...)
|
||||||
} else if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_OBS) {
|
|
||||||
// cct_engine.obsToICRS(...)
|
|
||||||
} else if (_pairKind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
|
||||||
// cct_engine.appToICRS(...)
|
|
||||||
} else if (_pairKind == MccCoordPairKind::COORDS_KIND_HADEC_OBS) {
|
|
||||||
// cct_engine.obsToICRS(...)
|
|
||||||
} else if (_pairKind == MccCoordPairKind::COORDS_KIND_AZZD) {
|
|
||||||
// cct_engine.obsToICRS(...)
|
|
||||||
} else if (_pairKind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
|
||||||
// cct_engine.obsToICRS(...)
|
|
||||||
} else { // unsupported transformation!!!
|
} else { // unsupported transformation!!!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -424,14 +429,18 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// here, from APP or OBS to ICRS
|
// here, from APP or OBS to ICRS and exit
|
||||||
if (pkind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS &&
|
if (pkind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS &&
|
||||||
PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
cpair = PT(PT::x_t(ra_icrs), PT::y_t(dec_icrs), MccCelestialCoordEpoch{});
|
cpair = PT(PT::x_t(ra_icrs), PT::y_t(dec_icrs), MccCelestialCoordEpoch{});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// here, the input coordinates and stored one are at the same epoch
|
||||||
if (pkind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
if (pkind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
|
// cct_engine.icrsToObs(ra_icrs, dec_icrs, jd, ra_obs, dec_obs, ha, az, zd)
|
||||||
|
// cct_engine.icrsToApp(ra_icrs, dec_icrs, jd, ra_app, dec_app, ha)
|
||||||
|
|
||||||
if constexpr (mccIsObsCoordPairKind<PT::pairKind>) {
|
if constexpr (mccIsObsCoordPairKind<PT::pairKind>) {
|
||||||
// cct_engine.icrsToObs(...)
|
// cct_engine.icrsToObs(...)
|
||||||
} else if constexpr (mccIsAppCoordPairKind<PT::pairKind>) {
|
} else if constexpr (mccIsAppCoordPairKind<PT::pairKind>) {
|
||||||
@ -538,6 +547,38 @@ protected:
|
|||||||
} else { // unsupported transformation!!!
|
} else { // unsupported transformation!!!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pkind == MccCoordPairKind::COORDS_KIND_RADEC_APP || pkind == MccCoordPairKind::COORDS_KIND_RADEC_OBS) {
|
||||||
|
ra = _x;
|
||||||
|
dec = _y;
|
||||||
|
} else if (pkind == MccCoordPairKind::COORDS_KIND_HADEC_APP ||
|
||||||
|
pkind == MccCoordPairKind::COORDS_KIND_HADEC_OBS) {
|
||||||
|
ha = _x;
|
||||||
|
dec = _y;
|
||||||
|
} else if (pkind == MccCoordPairKind::COORDS_KIND_AZZD) {
|
||||||
|
az = _x;
|
||||||
|
zd = _y;
|
||||||
|
} else if (pkind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||||
|
az = _x;
|
||||||
|
alt = _y;
|
||||||
|
} else { // unsupported transformation!!!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto comp_func = [&, this](this auto& self, MccCoordPairKind cp_kind) {
|
||||||
|
if (cp_kind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||||
|
if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
||||||
|
} else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_OBS) {
|
||||||
|
} else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
||||||
|
} else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_HADEC_OBS) {
|
||||||
|
} else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||||
|
} else { // unsupported transformation!!!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (cp_kind == MccCoordPairKind::COORDS_KIND_AZZD) {
|
||||||
|
alt = half_pi - _y;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -613,6 +613,8 @@ concept mcc_telemetry_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializa
|
|||||||
requires mcc_angle_c<decltype(t.EO)>;
|
requires mcc_angle_c<decltype(t.EO)>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// minimal library-wide telemetry data
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_tlm_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializable<T> && requires(T t) {
|
concept mcc_tlm_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializable<T> && requires(T t) {
|
||||||
// user entered target coordinates
|
// user entered target coordinates
|
||||||
|
|||||||
@ -184,7 +184,7 @@ public:
|
|||||||
decltype([](typename MountT::mount_status_t) {})>
|
decltype([](typename MountT::mount_status_t) {})>
|
||||||
MccSimpleMovingControls(
|
MccSimpleMovingControls(
|
||||||
MountT* mount,
|
MountT* mount,
|
||||||
CallbackFuncT&& mode_switch_calback = [](typename MountT::mount_status_t) {})
|
CallbackFuncT&& mode_switch_callback = [](typename MountT::mount_status_t) {})
|
||||||
: _stopMoving(new std::atomic_bool), _currentParamsMutex(new std::mutex), _lastError(new std::atomic<error_t>)
|
: _stopMoving(new std::atomic_bool), _currentParamsMutex(new std::mutex), _lastError(new std::atomic<error_t>)
|
||||||
{
|
{
|
||||||
auto send_to_hardware = [mount](typename MountT::hardware_state_t const& hw_state) {
|
auto send_to_hardware = [mount](typename MountT::hardware_state_t const& hw_state) {
|
||||||
@ -309,7 +309,7 @@ public:
|
|||||||
*_lastError = MccSimpleMovingControlsErrorCode::ERROR_OK;
|
*_lastError = MccSimpleMovingControlsErrorCode::ERROR_OK;
|
||||||
|
|
||||||
using cb_func_t = std::function<void(typename MountT::mount_status_t)>;
|
using cb_func_t = std::function<void(typename MountT::mount_status_t)>;
|
||||||
auto cb_sptr = std::shared_ptr<cb_func_t>(new cb_func_t(std::forward<CallbackFuncT>(mode_switch_calback)));
|
auto cb_sptr = std::shared_ptr<cb_func_t>(new cb_func_t(std::forward<CallbackFuncT>(mode_switch_callback)));
|
||||||
|
|
||||||
|
|
||||||
/* stop moving function */
|
/* stop moving function */
|
||||||
|
|||||||
@ -176,6 +176,8 @@ int main()
|
|||||||
// std::cout << "DEC_ICRS = " << mcc::MccAngle(cp.Y).sexagesimal() << "\n\n";
|
// std::cout << "DEC_ICRS = " << mcc::MccAngle(cp.Y).sexagesimal() << "\n\n";
|
||||||
|
|
||||||
std::cout << "time point = " << eqhrz.time_point << "\n";
|
std::cout << "time point = " << eqhrz.time_point << "\n";
|
||||||
|
std::cout << "RA_ICRS = " << mcc::MccAngle(eqhrz.RA_ICRS).sexagesimal(true) << "\n";
|
||||||
|
std::cout << "DEC_ICRS = " << mcc::MccAngle(eqhrz.DEC_ICRS).sexagesimal() << "\n";
|
||||||
std::cout << "RA_APP = " << mcc::MccAngle(eqhrz.RA_APP).sexagesimal(true) << "\n";
|
std::cout << "RA_APP = " << mcc::MccAngle(eqhrz.RA_APP).sexagesimal(true) << "\n";
|
||||||
std::cout << "DEC_APP = " << mcc::MccAngle(eqhrz.DEC_APP).sexagesimal() << "\n";
|
std::cout << "DEC_APP = " << mcc::MccAngle(eqhrz.DEC_APP).sexagesimal() << "\n";
|
||||||
std::cout << "HA = " << mcc::MccAngle(eqhrz.HA).sexagesimal(true) << "\n";
|
std::cout << "HA = " << mcc::MccAngle(eqhrz.HA).sexagesimal(true) << "\n";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user