...
This commit is contained in:
@@ -124,7 +124,7 @@ public:
|
||||
|
||||
_data.target.pair_kind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
||||
|
||||
using ccte_t = std::remove_cvref_t<decltype(*ccte)>;
|
||||
// using ccte_t = std::remove_cvref_t<decltype(*ccte)>;
|
||||
using pcm_t = std::remove_cvref_t<decltype(*pcm)>;
|
||||
using hardware_t = std::remove_cvref_t<decltype(*hardware)>;
|
||||
|
||||
@@ -414,7 +414,8 @@ public:
|
||||
|
||||
if (_internalUpdatingFuture.valid()) {
|
||||
// try to exit correctly
|
||||
auto status = _internalUpdatingFuture.wait_for(std::chrono::seconds(1));
|
||||
// auto status = _internalUpdatingFuture.wait_for(std::chrono::seconds(1));
|
||||
_internalUpdatingFuture.wait_for(std::chrono::seconds(1));
|
||||
// _internalUpdatingFuture.get();
|
||||
}
|
||||
};
|
||||
@@ -622,6 +623,31 @@ public:
|
||||
return MccTelemetryErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
error_t targetToMountDist(mcc_angle_c auto* dist)
|
||||
{
|
||||
if (dist == nullptr) {
|
||||
return MccTelemetryErrorCode::ERROR_NULLPTR;
|
||||
}
|
||||
|
||||
std::lock_guard lock{*_updateMutex};
|
||||
|
||||
double dHA = _data.HA - _data.target.HA;
|
||||
double cosDHA = cos(dHA);
|
||||
|
||||
double cosT = cos(_data.target.DEC_APP);
|
||||
double sinT = sin(_data.target.DEC_APP);
|
||||
double cosM = cos(_data.DEC_APP);
|
||||
double sinM = sin(_data.DEC_APP);
|
||||
|
||||
double term1 = cosT * sin(dHA);
|
||||
double term2 = cosM * sinT - sinM * cosT * cosDHA;
|
||||
|
||||
*dist = atan2(sqrt(term1 * term1 + term2 * term2), (sinM * sinT + cosM * cosT * cos(dHA)));
|
||||
|
||||
return MccTelemetryErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<std::atomic_bool> _isDataUpdated;
|
||||
MccTelemetryData _data;
|
||||
|
||||
Reference in New Issue
Block a user