From 7eded94ac1a17c18e21210a7fce31592c6a0b576 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Mon, 7 Jul 2025 17:47:54 +0300 Subject: [PATCH] ... --- cxx/mcc_mount_astro_erfa.h | 2 +- cxx/mcc_mount_astrom.h | 2 +- cxx/mcc_mount_hardware.h | 113 +++++++++++++++++++++++++++++++++++++ cxx/mcc_traits.h | 13 +++++ 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 cxx/mcc_mount_hardware.h diff --git a/cxx/mcc_mount_astro_erfa.h b/cxx/mcc_mount_astro_erfa.h index 16702fa..cd43376 100644 --- a/cxx/mcc_mount_astro_erfa.h +++ b/cxx/mcc_mount_astro_erfa.h @@ -95,7 +95,7 @@ public: virtual ~MccMountAstromEngineERFA() = default; - void updateState(engine_state_t state) + void setState(engine_state_t state) { std::lock_guard lock{_stateMutex}; diff --git a/cxx/mcc_mount_astrom.h b/cxx/mcc_mount_astrom.h index db14a50..610aa18 100644 --- a/cxx/mcc_mount_astrom.h +++ b/cxx/mcc_mount_astrom.h @@ -32,7 +32,7 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) { typename T::refract_result_t; - { t.updateState(std::declval()) }; + { t.setState(std::declval()) }; { t_const.getState() } -> std::same_as; diff --git a/cxx/mcc_mount_hardware.h b/cxx/mcc_mount_hardware.h new file mode 100644 index 0000000..91f398f --- /dev/null +++ b/cxx/mcc_mount_hardware.h @@ -0,0 +1,113 @@ +#pragma once + +/* MOUNT CONTROL COMPONENTS LIBRARY */ + +/* MOUNT HARDWARE CONCEPTS */ + + +#include +#include "mcc_traits.h" + +namespace mcc +{ + +namespace traits +{ + +// encoder basic concept (e.g. mount axis encoder or motor shaft one) +template +concept mcc_hw_encoder_c = requires(T t, const T t_const) { + typename T::error_t; + + typename T::time_point_t; + typename T::coord_t; + typename T::speed_t; + typename T::accel_t; + // typename T::high_order_deriv_t; + + requires requires(typename T::state_t st) { + std::same_as; + std::same_as; + std::same_as; + std::same_as; + // std::same_as; + }; + + { t_const.id() } -> mcc_formattable; + + { t.getState(std::declval()) } -> std::same_as; +}; + + +template +concept mcc_hw_motor_c = requires(T t, const T t_const) { + typename T::coord_t; + typename T::speed_t; + typename T::accel_t; + + requires requires(typename T::pos_t st) { + std::same_as; + std::same_as; // means maximal allowed speed + std::same_as; // means a maximal allowed acceleration (jerk) + }; + + + { t_const.id() } -> mcc_formattable; + + { t.rotate(std::declval()) } -> std::same_as; + + { t.stop() } -> std::same_as; +}; + + + +namespace details +{ +template +concept mcc_tuple_enc_ref_c = mcc_tuple_c && requires(T t) { + []