This commit is contained in:
Timur A. Fatkhullin 2025-11-14 12:23:39 +03:00
parent 94fb4c6a48
commit 078e3f38f2
6 changed files with 31 additions and 5 deletions

View File

@ -13,9 +13,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# ******* C++ PART OF THE PROJECT *******
set(EXAMPLES OFF CACHE BOOL "" FORCE)
set(CMAKE_BUILD_TYPE "Release")
# set(CMAKE_BUILD_TYPE "Release")
add_subdirectory(LibSidServo)
set(CMAKE_BUILD_TYPE "Debug")
# set(CMAKE_BUILD_TYPE "Debug")
# add_subdirectory(cxx)
add_subdirectory(mcc)

View File

@ -203,6 +203,7 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
setStateERFA(std::move(ccte_state));
setTelemetryUpdateTimeout(_mountConfig.movingModelParams().telemetryTimeout);
startInternalTelemetryDataUpdating();
std::this_thread::sleep_for(std::chrono::milliseconds(100));

View File

@ -114,7 +114,7 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
coordval_pair_t cvalpair{.X{.val = state.Y, .t = tp}, .Y{.val = state.X, .t = tp}};
coordpair_t cpair{.X = state.Y, .Y = state.X};
coordpair_t cpair{.X = state.Y, .Y = state.X + mcc::MccAngle(10.0_arcsecs)};
// correctTo is asynchronous function!!!
//

View File

@ -643,7 +643,8 @@ public:
// *result = (coords.X < _maxLimit) && (coords.X > _minLimit);
} else { // mcc_celestial_point_c
if (coords.pair_kind == MccCoordPairKind::COORDS_KIND_XY) { // hardware
*result = (coords.X < _maxLimit) && (coords.X > _minLimit);
// *result = (coords.X < _maxLimit) && (coords.X > _minLimit);
*result = (coords.X > _maxLimit) || (coords.X < _minLimit);
} else { // here one needs transform input coordinates to hardware encoder ones
MccCelestialPoint pt;

View File

@ -111,6 +111,8 @@ inline std::error_code make_error_code(MccSimpleSlewingModelErrorCode ec)
class MccSimpleSlewingModel
{
static constexpr auto DEG90INRADS = std::numbers::pi / 2.0;
public:
typedef std::error_code error_t;
@ -238,6 +240,12 @@ public:
if constexpr (mccIsEquatorialMount(CONTROLS_T::mountType)) {
cpt.X = tdata.HA + tdata.speedX * min_time_to_pzone_in_secs;
cpt.Y = tdata.DEC_APP + tdata.speedY * min_time_to_pzone_in_secs;
if (cpt.Y > DEG90INRADS) {
cpt.Y = DEG90INRADS;
}
if (cpt.Y < -DEG90INRADS) {
cpt.Y = -DEG90INRADS;
}
} else if constexpr (mccIsAltAzMount(CONTROLS_T::mountType)) {
cpt.X = tdata.AZ + tdata.speedX * min_time_to_pzone_in_secs;
cpt.Y = tdata.ZD + tdata.speedY * min_time_to_pzone_in_secs;

View File

@ -461,6 +461,18 @@ public:
}
}
void setTelemetryUpdateTimeout(traits::mcc_time_duration_c auto const& timeout)
{
if (timeout.count() > 0) {
_currentUpdateTimeout = std::chrono::duration_cast<decltype(_currentUpdateTimeout)>(timeout);
}
}
auto getTelemetryUpdateTimeout() const
{
return _currentUpdateTimeout;
}
// asynchronuosly periodicaly update telemetry data (internal synchronization)
void startInternalTelemetryDataUpdating()
{
@ -475,7 +487,7 @@ public:
[this](std::stop_token stop_token) -> error_t {
while (!stop_token.stop_requested()) {
// while (true) {
_lastUpdateError = updateTelemetryData(defaultInternalUpdateTimeout);
_lastUpdateError = updateTelemetryData(_currentUpdateTimeout);
if (_lastUpdateError) {
*_internalUpdating = false;
return _lastUpdateError;
@ -568,6 +580,8 @@ public:
// unblock waiting threads even in the case of timeout!
_updateCondVar->notify_all();
// *_isDataUpdated = false;
return _lastUpdateError;
}
@ -707,6 +721,8 @@ protected:
std::future<error_t> _internalUpdatingFuture{};
std::stop_source _internalUpdatingStopSource{};
std::chrono::nanoseconds _currentUpdateTimeout{defaultInternalUpdateTimeout};
std ::function<error_t(std::stop_token)> _updateTargetFunc{};
// std ::function<error_t(bool, std::stop_token)> _updateTargetFunc{};
std::function<error_t(std::stop_token)> _updateFunc{};