...
This commit is contained in:
@@ -662,6 +662,14 @@ concept mcc_hardware_c = requires(T t) {
|
|||||||
// static const variable with name of hardware
|
// static const variable with name of hardware
|
||||||
requires std::formattable<decltype(T::hardwareName), char> && std::is_const_v<decltype(T::hardwareName)>;
|
requires std::formattable<decltype(T::hardwareName), char> && std::is_const_v<decltype(T::hardwareName)>;
|
||||||
|
|
||||||
|
|
||||||
|
// the 'T' class must contain static constexpr member of 'MccMountType' type
|
||||||
|
requires std::same_as<decltype(T::mountType), const MccMountType>;
|
||||||
|
[]() {
|
||||||
|
[[maybe_unused]] static constexpr MccMountType val = T::mountType;
|
||||||
|
}(); // to ensure 'mountType' can be used in compile-time context
|
||||||
|
|
||||||
|
|
||||||
// a type that defines at least HW_MOVE_ERROR, HW_MOVE_STOPPING, HW_MOVE_STOPPED, HW_MOVE_SLEWING,
|
// a type that defines at least HW_MOVE_ERROR, HW_MOVE_STOPPING, HW_MOVE_STOPPED, HW_MOVE_SLEWING,
|
||||||
// HW_MOVE_ADJUSTING, HW_MOVE_TRACKING and HW_MOVE_GUIDING compile-time constants. The main purpose of this type is
|
// HW_MOVE_ADJUSTING, HW_MOVE_TRACKING and HW_MOVE_GUIDING compile-time constants. The main purpose of this type is
|
||||||
// a possible tunning of hardware hardwareSetState-related commands and detect the stop and error states from
|
// a possible tunning of hardware hardwareSetState-related commands and detect the stop and error states from
|
||||||
|
|||||||
@@ -344,14 +344,24 @@ struct MccSkyAZALT : MccCoordPair<MccAngleAZ, MccAngleALT> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// utility type definition: deduce a coordinate pair kind according to mount type
|
||||||
using MccGenXY = MccCoordPair<MccAngleX, MccAngleY>;
|
// mcc_deduced_coord_pair_t = MccSkyHADEC_OBS for equathorial mounts,
|
||||||
|
// mcc_deduced_coord_pair_t = MccSkyAZZD for altazimuthal ones and
|
||||||
using MccGeoLONLAT = MccCoordPair<MccAngleLON, MccAngleLAT>;
|
// mcc_deduced_coord_pair_t = std::nullptr_t otherwise
|
||||||
|
template <MccMountType MOUNT_TYPE>
|
||||||
|
using mcc_deduced_coord_pair_t =
|
||||||
|
std::conditional_t<mccIsEquatorialMount(MOUNT_TYPE),
|
||||||
|
MccSkyHADEC_OBS,
|
||||||
|
std::conditional_t<mccIsAltAzMount(MOUNT_TYPE), MccSkyAZZD, std::nullptr_t>>;
|
||||||
|
|
||||||
|
|
||||||
static MccSkyHADEC_APP hadec = MccGenXY{};
|
// using MccGenXY = MccCoordPair<MccAngleX, MccAngleY>;
|
||||||
static MccSkyAZALT azalt{MccSkyAZZD{1.0, 1.1}};
|
|
||||||
|
// using MccGeoLONLAT = MccCoordPair<MccAngleLON, MccAngleLAT>;
|
||||||
|
|
||||||
|
|
||||||
|
// static MccSkyHADEC_APP hadec = MccGenXY{};
|
||||||
|
// static MccSkyAZALT azalt{MccSkyAZZD{1.0, 1.1}};
|
||||||
|
|
||||||
|
|
||||||
/* MCC-LIBRARY DEFAULT GENERIC SKY POINT CLASS IMPLEMENTATION */
|
/* MCC-LIBRARY DEFAULT GENERIC SKY POINT CLASS IMPLEMENTATION */
|
||||||
|
|||||||
@@ -602,9 +602,7 @@ public:
|
|||||||
auto start_point = std::chrono::steady_clock::now();
|
auto start_point = std::chrono::steady_clock::now();
|
||||||
auto last_hw_time = tdata.hwState.XY.epoch().UTC();
|
auto last_hw_time = tdata.hwState.XY.epoch().UTC();
|
||||||
|
|
||||||
std::conditional_t<mccIsEquatorialMount(HARDWARE_T::mountType), MccSkyHADEC_OBS,
|
mcc_deduced_coord_pair_t<HARDWARE_T::mountType> tag_cp, mnt_cp;
|
||||||
std::conditional_t<mccIsAltAzMount(HARDWARE_T::mountType), MccSkyAZZD, std::nullptr_t>>
|
|
||||||
tag_cp, mnt_cp;
|
|
||||||
|
|
||||||
while (!*_stopMoving) {
|
while (!*_stopMoving) {
|
||||||
t_err = telemetry->telemetryData(&tdata);
|
t_err = telemetry->telemetryData(&tdata);
|
||||||
@@ -651,8 +649,16 @@ public:
|
|||||||
|
|
||||||
last_hw_time = tdata.hwState.XY.epoch().UTC();
|
last_hw_time = tdata.hwState.XY.epoch().UTC();
|
||||||
|
|
||||||
auto dist = utils::distanceOnSphere(tdata.targetPos.co_lon(), tdata.targetPos.co_lat(),
|
auto ccte_err = tdata.targetPos.to(tag_cp);
|
||||||
tdata.mountPos.co_lon(), tdata.mountPos.co_lat());
|
if (ccte_err) {
|
||||||
|
*_lastError = mcc_deduced_err(ccte_err, MccSimpleMovementControlsErrorCode::ERROR_CCTE_COMP);
|
||||||
|
}
|
||||||
|
ccte_err = tdata.mountPos.to(mnt_cp);
|
||||||
|
if (ccte_err) {
|
||||||
|
*_lastError = mcc_deduced_err(ccte_err, MccSimpleMovementControlsErrorCode::ERROR_CCTE_COMP);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto dist = utils::distanceOnSphere(tag_cp.x(), tag_cp.y(), mnt_cp.x(), mnt_cp.y());
|
||||||
|
|
||||||
logger->logTrace(std::format(" target-to-mount distance: {} (dx = {}, dy = {})",
|
logger->logTrace(std::format(" target-to-mount distance: {} (dx = {}, dy = {})",
|
||||||
MccAngleFancyString(std::get<2>(dist)), std::get<0>(dist),
|
MccAngleFancyString(std::get<2>(dist)), std::get<0>(dist),
|
||||||
@@ -711,8 +717,18 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dist = utils::distanceOnSphere(tdata.targetPos.co_lon(), tdata.targetPos.co_lat(),
|
auto ccte_err = tdata.targetPos.to(tag_cp);
|
||||||
tdata.mountPos.co_lon(), tdata.mountPos.co_lat());
|
if (ccte_err) {
|
||||||
|
*_lastError = mcc_deduced_err(ccte_err, MccSimpleMovementControlsErrorCode::ERROR_CCTE_COMP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ccte_err = tdata.mountPos.to(mnt_cp);
|
||||||
|
if (ccte_err) {
|
||||||
|
*_lastError = mcc_deduced_err(ccte_err, MccSimpleMovementControlsErrorCode::ERROR_CCTE_COMP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto dist = utils::distanceOnSphere(tag_cp.x(), tag_cp.y(), mnt_cp.x(), mnt_cp.y());
|
||||||
|
|
||||||
log_pos(tdata);
|
log_pos(tdata);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user