...
This commit is contained in:
@@ -279,7 +279,18 @@ protected:
|
||||
struct MccGenericFsmMountSlewEvent : MccGenericFsmMountBaseEvent {
|
||||
static constexpr std::string_view ID{"GENERIC-MOUNT-SLEW-EVENT"};
|
||||
|
||||
MccGenericFsmMountSlewEvent(MccGenericFsmMount* mount) : MccGenericFsmMountBaseEvent(mount) {}
|
||||
MccGenericFsmMountSlewEvent(MccGenericFsmMount* mount, bool slew_and_stop)
|
||||
: MccGenericFsmMountBaseEvent(mount), _slewAndStop(slew_and_stop)
|
||||
{
|
||||
}
|
||||
|
||||
bool eventData() const noexcept
|
||||
{
|
||||
return _slewAndStop;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool _slewAndStop{};
|
||||
};
|
||||
|
||||
struct MccGenericFsmMountTrackEvent : MccGenericFsmMountBaseEvent {
|
||||
@@ -473,9 +484,8 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
MccGenericFsmMount::slewing_params_t params;
|
||||
mount_ptr->getSlewingParams(¶ms);
|
||||
if (params.slewAndStop) { // after slewing switch to IDLE state
|
||||
bool slew_and_stop = event.eventData();
|
||||
if (slew_and_stop) { // after slewing switch to IDLE state
|
||||
mount_ptr->dispatchEvent(MccGenericFsmMountIdleEvent{mount_ptr});
|
||||
} else { // after slewing switch to tracking state
|
||||
mount_ptr->dispatchEvent(MccGenericFsmMountTrackEvent{mount_ptr});
|
||||
@@ -674,10 +684,10 @@ public:
|
||||
return _lastError;
|
||||
}
|
||||
|
||||
auto slewToTarget()
|
||||
auto slewToTarget(bool slew_and_stop = false)
|
||||
{
|
||||
try {
|
||||
this->dispatchEvent(MccGenericFsmMountSlewEvent{this});
|
||||
this->dispatchEvent(MccGenericFsmMountSlewEvent{this, slew_and_stop});
|
||||
} catch (std::system_error const& exc) {
|
||||
if (exc.code().category() == fsm::MccFiniteStateMachineCategory::get()) {
|
||||
_lastError = MccGenericFsmMountErrorCode::ERROR_INVALID_OPERATION;
|
||||
|
||||
@@ -836,14 +836,20 @@ concept mcc_slewing_model_c = requires(T t) {
|
||||
// requires mcc_error_c<typename T::error_t>;
|
||||
|
||||
// a class of slewing process parameters
|
||||
requires requires(typename T::slewing_params_t pars) {
|
||||
// slew mount to target and stop
|
||||
requires std::convertible_to<decltype(pars.slewAndStop), bool>;
|
||||
};
|
||||
typename T::slewing_params_t;
|
||||
// requires requires(typename T::slewing_params_t pars) {
|
||||
// // slew mount to target and stop
|
||||
// requires std::convertible_to<decltype(pars.slewAndStop), bool>;
|
||||
// };
|
||||
|
||||
// { t.slewToTarget() } -> std::same_as<typename T::error_t>;
|
||||
// { t.stopSlewing() } -> std::same_as<typename T::error_t>;
|
||||
{ t.slewToTarget() } -> mcc_error_c;
|
||||
|
||||
// the method signature:
|
||||
// slewToTarget(bool slew_and_stop)
|
||||
// slew_and_stop == true, slew mount and stop
|
||||
// slew_and_stop == false, slew mount and track
|
||||
{ t.slewToTarget(std::declval<bool>()) } -> mcc_error_c;
|
||||
{ t.stopSlewing() } -> mcc_error_c;
|
||||
|
||||
{ t.setSlewingParams(std::declval<typename T::slewing_params_t>()) } -> mcc_error_c;
|
||||
@@ -912,7 +918,7 @@ template <typename T>
|
||||
concept mcc_generic_mount_c = mcc_telemetry_c<T> && mcc_pzone_container_c<T> && requires(T t) {
|
||||
// requires mcc_error_c<typename T::error_t>;
|
||||
|
||||
// slew mount to target (target coordinates were defined in telemetry data)
|
||||
// slew mount to target (it is assumed that the target coordinates are determined in the telemetry data)
|
||||
{ t.slewToTarget() };
|
||||
// { t.slewToTarget() } -> std::same_as<typename T::error_t>;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace mcc
|
||||
{
|
||||
|
||||
|
||||
enum MccAltLimitPZErrorCode : int { ERROR_OK, ERROR_NULLPTR, ERROR_COORD_TRANSFROM, ERROR_PCM_COMP };
|
||||
enum class MccAltLimitPZErrorCode : int { ERROR_OK, ERROR_NULLPTR, ERROR_COORD_TRANSFROM, ERROR_PCM_COMP };
|
||||
|
||||
} // namespace mcc
|
||||
|
||||
@@ -621,7 +621,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
consteval std::string_view name()
|
||||
consteval std::string_view name() const
|
||||
{
|
||||
return axisKind == MccCoordKind::COORDS_KIND_AZ ? "AZ_AXIS-LIMITSWITCH_ZONE"
|
||||
: axisKind == MccCoordKind::COORDS_KIND_HA ? "HA_AXIS-LIMITSWITCH_ZONE"
|
||||
@@ -750,6 +750,17 @@ public:
|
||||
requires((mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>) &&
|
||||
(mcc_eqt_hrz_coord_c<ResultT> || mcc_celestial_point_c<ResultT>))
|
||||
{
|
||||
if (point == nullptr) {
|
||||
return MccAltLimitPZErrorCode::ERROR_NULLPTR;
|
||||
}
|
||||
|
||||
point->X = _minLimit;
|
||||
// if constexpr (mcc_eqt_hrz_coord_c<ResultT>) {
|
||||
// point->X = _minLimit;
|
||||
// } else { // mcc_celestial_point_c
|
||||
// point->X = _minLimit;
|
||||
// }
|
||||
|
||||
return MccAltLimitPZErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
||||
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
*_stopSlewing = true;
|
||||
|
||||
_slewingFunc = [controls, this]() -> error_t {
|
||||
_slewingFunc = [controls, this](bool slew_and_stop) -> error_t {
|
||||
// first, check target coordinates
|
||||
typename CONTROLS_T::error_t t_err;
|
||||
MccTelemetryData tdata;
|
||||
@@ -278,7 +278,8 @@ public:
|
||||
{
|
||||
std::lock_guard lock{*_currentParamsMutex};
|
||||
|
||||
if (adjust_mode && !_currentParams.slewAndStop) {
|
||||
// if (adjust_mode && !_currentParams.slewAndStop) {
|
||||
if (adjust_mode && !slew_and_stop) {
|
||||
// do not allow mount speed fall below sideral
|
||||
if constexpr (mccIsEquatorialMount(CONTROLS_T::mountType)) {
|
||||
// turn on sideral rate only if the current position point catches up with the target
|
||||
@@ -359,7 +360,7 @@ public:
|
||||
|
||||
virtual ~MccSimpleSlewingModel() = default;
|
||||
|
||||
error_t slewToTarget()
|
||||
error_t slewToTarget(bool slew_and_stop = false)
|
||||
{
|
||||
if (!(*_stopSlewing)) {
|
||||
return MccSimpleSlewingModelErrorCode::ERROR_ALREADY_SLEW;
|
||||
@@ -367,7 +368,7 @@ public:
|
||||
|
||||
*_stopSlewing = false;
|
||||
|
||||
return _slewingFunc();
|
||||
return _slewingFunc(slew_and_stop);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,7 +402,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
std::function<error_t()> _slewingFunc{};
|
||||
std::function<error_t(bool)> _slewingFunc{};
|
||||
std::unique_ptr<std::atomic_bool> _stopSlewing;
|
||||
|
||||
slewing_params_t _currentParams{};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace mcc
|
||||
{
|
||||
|
||||
enum MccTelemetryErrorCode : int {
|
||||
enum class MccTelemetryErrorCode : int {
|
||||
ERROR_OK,
|
||||
ERROR_NULLPTR,
|
||||
ERROR_COORD_TRANSFORM,
|
||||
|
||||
Reference in New Issue
Block a user