...
This commit is contained in:
parent
94fb4c6a48
commit
078e3f38f2
@ -13,9 +13,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
|||||||
# ******* C++ PART OF THE PROJECT *******
|
# ******* C++ PART OF THE PROJECT *******
|
||||||
|
|
||||||
set(EXAMPLES OFF CACHE BOOL "" FORCE)
|
set(EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
# set(CMAKE_BUILD_TYPE "Release")
|
||||||
add_subdirectory(LibSidServo)
|
add_subdirectory(LibSidServo)
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
# set(CMAKE_BUILD_TYPE "Debug")
|
||||||
|
|
||||||
# add_subdirectory(cxx)
|
# add_subdirectory(cxx)
|
||||||
add_subdirectory(mcc)
|
add_subdirectory(mcc)
|
||||||
|
|||||||
@ -203,6 +203,7 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
|
|||||||
|
|
||||||
setStateERFA(std::move(ccte_state));
|
setStateERFA(std::move(ccte_state));
|
||||||
|
|
||||||
|
setTelemetryUpdateTimeout(_mountConfig.movingModelParams().telemetryTimeout);
|
||||||
startInternalTelemetryDataUpdating();
|
startInternalTelemetryDataUpdating();
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
|||||||
@ -114,7 +114,7 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
|
|||||||
|
|
||||||
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
// 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}};
|
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!!!
|
// correctTo is asynchronous function!!!
|
||||||
//
|
//
|
||||||
|
|||||||
@ -643,7 +643,8 @@ public:
|
|||||||
// *result = (coords.X < _maxLimit) && (coords.X > _minLimit);
|
// *result = (coords.X < _maxLimit) && (coords.X > _minLimit);
|
||||||
} else { // mcc_celestial_point_c
|
} else { // mcc_celestial_point_c
|
||||||
if (coords.pair_kind == MccCoordPairKind::COORDS_KIND_XY) { // hardware
|
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
|
} else { // here one needs transform input coordinates to hardware encoder ones
|
||||||
MccCelestialPoint pt;
|
MccCelestialPoint pt;
|
||||||
|
|
||||||
|
|||||||
@ -111,6 +111,8 @@ inline std::error_code make_error_code(MccSimpleSlewingModelErrorCode ec)
|
|||||||
|
|
||||||
class MccSimpleSlewingModel
|
class MccSimpleSlewingModel
|
||||||
{
|
{
|
||||||
|
static constexpr auto DEG90INRADS = std::numbers::pi / 2.0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::error_code error_t;
|
typedef std::error_code error_t;
|
||||||
|
|
||||||
@ -238,6 +240,12 @@ public:
|
|||||||
if constexpr (mccIsEquatorialMount(CONTROLS_T::mountType)) {
|
if constexpr (mccIsEquatorialMount(CONTROLS_T::mountType)) {
|
||||||
cpt.X = tdata.HA + tdata.speedX * min_time_to_pzone_in_secs;
|
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;
|
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)) {
|
} else if constexpr (mccIsAltAzMount(CONTROLS_T::mountType)) {
|
||||||
cpt.X = tdata.AZ + tdata.speedX * min_time_to_pzone_in_secs;
|
cpt.X = tdata.AZ + tdata.speedX * min_time_to_pzone_in_secs;
|
||||||
cpt.Y = tdata.ZD + tdata.speedY * min_time_to_pzone_in_secs;
|
cpt.Y = tdata.ZD + tdata.speedY * min_time_to_pzone_in_secs;
|
||||||
|
|||||||
@ -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)
|
// asynchronuosly periodicaly update telemetry data (internal synchronization)
|
||||||
void startInternalTelemetryDataUpdating()
|
void startInternalTelemetryDataUpdating()
|
||||||
{
|
{
|
||||||
@ -475,7 +487,7 @@ public:
|
|||||||
[this](std::stop_token stop_token) -> error_t {
|
[this](std::stop_token stop_token) -> error_t {
|
||||||
while (!stop_token.stop_requested()) {
|
while (!stop_token.stop_requested()) {
|
||||||
// while (true) {
|
// while (true) {
|
||||||
_lastUpdateError = updateTelemetryData(defaultInternalUpdateTimeout);
|
_lastUpdateError = updateTelemetryData(_currentUpdateTimeout);
|
||||||
if (_lastUpdateError) {
|
if (_lastUpdateError) {
|
||||||
*_internalUpdating = false;
|
*_internalUpdating = false;
|
||||||
return _lastUpdateError;
|
return _lastUpdateError;
|
||||||
@ -568,6 +580,8 @@ public:
|
|||||||
// unblock waiting threads even in the case of timeout!
|
// unblock waiting threads even in the case of timeout!
|
||||||
_updateCondVar->notify_all();
|
_updateCondVar->notify_all();
|
||||||
|
|
||||||
|
// *_isDataUpdated = false;
|
||||||
|
|
||||||
return _lastUpdateError;
|
return _lastUpdateError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,6 +721,8 @@ protected:
|
|||||||
std::future<error_t> _internalUpdatingFuture{};
|
std::future<error_t> _internalUpdatingFuture{};
|
||||||
std::stop_source _internalUpdatingStopSource{};
|
std::stop_source _internalUpdatingStopSource{};
|
||||||
|
|
||||||
|
std::chrono::nanoseconds _currentUpdateTimeout{defaultInternalUpdateTimeout};
|
||||||
|
|
||||||
std ::function<error_t(std::stop_token)> _updateTargetFunc{};
|
std ::function<error_t(std::stop_token)> _updateTargetFunc{};
|
||||||
// std ::function<error_t(bool, std::stop_token)> _updateTargetFunc{};
|
// std ::function<error_t(bool, std::stop_token)> _updateTargetFunc{};
|
||||||
std::function<error_t(std::stop_token)> _updateFunc{};
|
std::function<error_t(std::stop_token)> _updateFunc{};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user