...
This commit is contained in:
@@ -505,8 +505,14 @@ template <typename T>
|
|||||||
concept mcc_skypoint_c = std::derived_from<T, mcc_skypoint_interface_t> && requires(const T t_const) {
|
concept mcc_skypoint_c = std::derived_from<T, mcc_skypoint_interface_t> && requires(const T t_const) {
|
||||||
{ t_const.epoch() } -> mcc_coord_epoch_c;
|
{ t_const.epoch() } -> mcc_coord_epoch_c;
|
||||||
|
|
||||||
// currently stored coordinates pair
|
// currently stored coordinates pair kind
|
||||||
{ t_const.pairKind() } -> std::same_as<impl::MccCoordPairKind>;
|
{ t_const.pairKind() } -> std::same_as<impl::MccCoordPairKind>;
|
||||||
|
|
||||||
|
// currently stored co-longitude coordinate
|
||||||
|
{ t_const.co_lon() } -> std::convertible_to<double>;
|
||||||
|
|
||||||
|
// currently stored co-latitude coordinate
|
||||||
|
{ t_const.co_lat() } -> std::convertible_to<double>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -423,6 +423,17 @@ public:
|
|||||||
return _epoch;
|
return _epoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double co_lon() const
|
||||||
|
{
|
||||||
|
return _x;
|
||||||
|
}
|
||||||
|
|
||||||
|
double co_lat() const
|
||||||
|
{
|
||||||
|
return _y;
|
||||||
|
}
|
||||||
|
|
||||||
template <mcc_coord_pair_c PT>
|
template <mcc_coord_pair_c PT>
|
||||||
MccGenericSkyPoint& from(const PT& coord_pair)
|
MccGenericSkyPoint& from(const PT& coord_pair)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _filename;
|
std::string _filename;
|
||||||
std::istringstream _st;
|
std::ostringstream _st;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ public:
|
|||||||
template <mcc_hardware_c HARDWARE_T,
|
template <mcc_hardware_c HARDWARE_T,
|
||||||
mcc_telemetry_c TELEMETRY_T,
|
mcc_telemetry_c TELEMETRY_T,
|
||||||
mcc_pzone_container_c PZONE_CONT_T,
|
mcc_pzone_container_c PZONE_CONT_T,
|
||||||
traits::mcc_callable_c CallbackFuncT,
|
typename CallbackFuncT,
|
||||||
mcc_logger_c LOGGER_T = MccNullLogger>
|
mcc_logger_c LOGGER_T = MccNullLogger>
|
||||||
MccSimpleMovementControls(HARDWARE_T* hardware,
|
MccSimpleMovementControls(HARDWARE_T* hardware,
|
||||||
TELEMETRY_T* telemetry,
|
TELEMETRY_T* telemetry,
|
||||||
@@ -376,14 +376,14 @@ public:
|
|||||||
|
|
||||||
static_assert(!std::is_null_pointer_v<decltype(mount_pos)>, "UNKNOWn MOUNT TYPE");
|
static_assert(!std::is_null_pointer_v<decltype(mount_pos)>, "UNKNOWn MOUNT TYPE");
|
||||||
|
|
||||||
mount_pos.setX(tdata.hwState.XY.x() + tdata.pcmCorrection.x + dx);
|
mount_pos.setX((double)tdata.hwState.XY.x() + tdata.pcmCorrection.pcmX + dx);
|
||||||
mount_pos.setY(tdata.hwState.XY.y() + tdata.pcmCorrection.y + dy);
|
mount_pos.setY((double)tdata.hwState.XY.y() + tdata.pcmCorrection.pcmY + dy);
|
||||||
mount_pos.setEpoch(tdata.hwState.XY.epoch());
|
mount_pos.setEpoch(tdata.hwState.XY.epoch());
|
||||||
|
|
||||||
logger->logTrace(std::format(" mount: speedX = {}/s, speedY = {}/s", MccAngleFancyString(speedX),
|
logger->logTrace(std::format(" mount: speedX = {}/s, speedY = {}/s", MccAngleFancyString(speedX),
|
||||||
MccAngleFancyString(speedY)));
|
MccAngleFancyString(speedY)));
|
||||||
|
|
||||||
auto pz_err = pzone_cont->inPZone(mount_pos, &in_zone, &in_zone_vec);
|
auto pz_err = pzone_cont->inPZone(MccSkyPoint(mount_pos), &in_zone, &in_zone_vec);
|
||||||
if (pz_err) {
|
if (pz_err) {
|
||||||
return mcc_deduced_err(pz_err, MccSimpleMovementControlsErrorCode::ERROR_PZONE_CONTAINER_COMP);
|
return mcc_deduced_err(pz_err, MccSimpleMovementControlsErrorCode::ERROR_PZONE_CONTAINER_COMP);
|
||||||
}
|
}
|
||||||
@@ -474,9 +474,11 @@ public:
|
|||||||
logger->logTrace(std::format(" current mount: {} = {}, {} = {}", x_str, coord_pair.x().sexagesimal(true),
|
logger->logTrace(std::format(" current mount: {} = {}, {} = {}", x_str, coord_pair.x().sexagesimal(true),
|
||||||
y_str, coord_pair.y().sexagesimal()));
|
y_str, coord_pair.y().sexagesimal()));
|
||||||
|
|
||||||
_pathFile << tdata.mountPos.epoch().UTC.time_since_epoch().count() << " " << x_tag << " " << y_tag << " "
|
_pathFile << tdata.mountPos.epoch().UTC().time_since_epoch().count() << " " << x_tag << " " << y_tag << " "
|
||||||
<< x_mnt << " " << y_mnt << " " << (x_tag - x_mnt) << " " << (y_tag - y_mnt) << " "
|
<< x_mnt << " " << y_mnt << " " << (x_tag - x_mnt) << " " << (y_tag - y_mnt) << " "
|
||||||
<< (int)tdata.hwState.movementState << "\n";
|
<< (int)tdata.hwState.movementState << "\n";
|
||||||
|
|
||||||
|
return MccSimpleMovementControlsErrorCode::ERROR_OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto cb_sptr =
|
auto cb_sptr =
|
||||||
@@ -597,8 +599,12 @@ public:
|
|||||||
|
|
||||||
(*cb_sptr)(STATUS_T::MOUNT_STATUS_SLEWING);
|
(*cb_sptr)(STATUS_T::MOUNT_STATUS_SLEWING);
|
||||||
|
|
||||||
auto start_point = tdata.hwState.XY.epoch().UTC(); // needed for trajectory file
|
auto start_point = std::chrono::steady_clock::now();
|
||||||
auto last_hw_time = start_point;
|
auto last_hw_time = tdata.hwState.XY.epoch().UTC();
|
||||||
|
|
||||||
|
std::conditional_t<mccIsEquatorialMount(HARDWARE_T::mountType), MccSkyHADEC_OBS,
|
||||||
|
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);
|
||||||
@@ -645,8 +651,8 @@ public:
|
|||||||
|
|
||||||
last_hw_time = tdata.hwState.XY.epoch().UTC();
|
last_hw_time = tdata.hwState.XY.epoch().UTC();
|
||||||
|
|
||||||
auto dist = utils::distanceOnSphere(tdata.targetPos.x(), tdata.targetPos.y(), tdata.mountPos.x(),
|
auto dist = utils::distanceOnSphere(tdata.targetPos.co_lon(), tdata.targetPos.co_lat(),
|
||||||
tdata.mountPos.y());
|
tdata.mountPos.co_lon(), tdata.mountPos.co_lat());
|
||||||
|
|
||||||
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),
|
||||||
@@ -654,7 +660,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// stop slewing and exit from the cycle?
|
// stop slewing and exit from the cycle?
|
||||||
if (dist <= _currentParams.slewToleranceRadius) {
|
if (std::get<2>(dist) <= _currentParams.slewToleranceRadius) {
|
||||||
if (tdata.hwState.movementState == HARDWARE_T::hardware_movement_state_t::HW_MOVE_STOPPED ||
|
if (tdata.hwState.movementState == HARDWARE_T::hardware_movement_state_t::HW_MOVE_STOPPED ||
|
||||||
tdata.hwState.movementState == HARDWARE_T::hardware_movement_state_t::HW_MOVE_GUIDING) {
|
tdata.hwState.movementState == HARDWARE_T::hardware_movement_state_t::HW_MOVE_GUIDING) {
|
||||||
logger->logInfo("target-to-mount distance is lesser than slew acceptable radius - exit!");
|
logger->logInfo("target-to-mount distance is lesser than slew acceptable radius - exit!");
|
||||||
@@ -705,8 +711,8 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dist = utils::distanceOnSphere(tdata.targetPos.x(), tdata.targetPos.y(), tdata.mountPos.x(),
|
auto dist = utils::distanceOnSphere(tdata.targetPos.co_lon(), tdata.targetPos.co_lat(),
|
||||||
tdata.mountPos.y());
|
tdata.mountPos.co_lon(), tdata.mountPos.co_lat());
|
||||||
|
|
||||||
log_pos(tdata);
|
log_pos(tdata);
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ struct MccGenericMountNetworkServerErrorCategory : std::error_category {
|
|||||||
defaut:
|
defaut:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MccGenericMountNetworkServerErrorCategory& get()
|
static const MccGenericMountNetworkServerErrorCategory& get()
|
||||||
|
|||||||
Reference in New Issue
Block a user