This commit is contained in:
2025-07-31 22:47:26 +03:00
parent 9fbd858086
commit 750d29ceb9
8 changed files with 240 additions and 415 deletions

View File

@@ -205,30 +205,38 @@ concept mcc_mount_hardware_c = !std::copyable<T> && std::movable<T> && requires(
{ t_const.id() } -> mcc_formattable;
// a type that defines at least HW_STATE_STOP, HW_STATE_SLEW, HW_STATE_TRACK
// compile-time constants
// e.g. an implementations can be as follows:
// enum class HW_STATE: int {HW_STATE_STOP, HW_STATE_SLEW, HW_STATE_TRACK}
// a type that defines at least HW_MOVE_SLEWING, HW_MOVE_ADJUSTING, HW_MOVE_TRACKING
// and HW_MOVE_GUIDING compile-time constants. The main purpose of this type is a
// possible tunning of hardware setPos-related commands
//
// struct HW_STATE {
// uint8_t HW_STATE_STOP = 100;
// uint8_t HW_STATE_SLEW = 200;
// uint8_t HW_STATE_TRACK = 300;
// e.g. an implementations can be as follows:
// enum class hw_moving_type_t: int {HW_MOVE_SLEWING, HW_MOVE_ADJUSTING, HW_MOVE_TRACKING, HW_MOVE_GUIDING}
//
// struct hw_moving_type_t {
// uint16_t HW_MOVE_SLEWING = 111;
// uint16_t HW_MOVE_ADJUSTING = 222;
// uint16_t HW_MOVE_TRACKING = 333;
// uint16_t HW_MOVE_GUIDING = 444;
// }
requires requires(typename T::hw_state_t state) {
requires requires(typename T::hw_moving_type_t state) {
[]() {
// hardware is in stop state (no any moving)
static constexpr auto v1 = T::hw_state_t::HW_STATE_STOP;
// hardware was asked for slewing (move to given celestial point)
static constexpr auto v1 = T::hw_moving_type_t::HW_MOVE_SLEWING;
// hardware is in slew state (move to given celestial point)
static constexpr auto v2 = T::hw_state_t::HW_STATE_SLEW;
// hardware was asked for adjusting after slewing ("seeking" given celestial point at the end of slewing
// process)
static constexpr auto v2 = T::hw_moving_type_t::HW_MOVE_ADJUSTING;
// hardware is in track state (track given celestial point)
static constexpr auto v3 = T::hw_state_t::HW_STATE_TRACK;
// hardware was asked for tracking (track given celestial point)
static constexpr auto v3 = T::hw_moving_type_t::HW_MOVE_TRACKING;
// hardware was asked for guiding (small corrections to track given celestial point)
static constexpr auto v4 = T::hw_moving_type_t::HW_MOVE_GUIDING;
}();
};
// a class that contains at least time of measurement, coordinates for x,y axes and its moving rates
requires requires(typename T::axes_pos_t pos) {
requires std::same_as<decltype(pos.time_point), typename T::time_point_t>; // time point
@@ -239,13 +247,17 @@ concept mcc_mount_hardware_c = !std::copyable<T> && std::movable<T> && requires(
requires std::same_as<decltype(pos.xrate), typename T::coord_t>;
requires std::same_as<decltype(pos.yrate), typename T::coord_t>;
requires std::same_as<decltype(pos.state), typename T::hw_state_t>; // hardware state
requires std::same_as<decltype(pos.moving_type), typename T::hw_moving_type_t>; // a 'hint' to hardware
};
// set positions (angles) of mount axes with given speeds
// NOTE: exact interpretation (or even ignoring) of the given moving speeds is subject of a hardware-class
// implementation.
// e.g. it can be maximal speeds at slewing ramp
{ t.setPos(std::declval<typename T::axes_pos_t>()) } -> std::same_as<typename T::error_t>;
{ t.getPos(std::declval<typename T::axes_pos_t&>()) } -> std::same_as<typename T::error_t>;
{ t_const.getState(std::declval<typename T::hw_state_t&>()) } -> std::same_as<typename T::error_t>;
// get current positions and speeds (angles) of mount axes
{ t.getPos(std::declval<typename T::axes_pos_t&>()) } -> std::same_as<typename T::error_t>;
{ t.stop() } -> std::same_as<typename T::error_t>; // stop any moving
{ t.init() } -> std::same_as<typename T::error_t>; // initialize hardware
@@ -292,6 +304,13 @@ concept mcc_mount_telemetry_data_c = requires(T telemetry) {
// time point
requires std::same_as<decltype(telemetry.time_point), typename T::time_point_t>;
// target sky point ICRS and current coordinates
requires std::same_as<decltype(telemetry.tagRA), typename T::coord_t>; // apparent RA
requires std::same_as<decltype(telemetry.tagDEC), typename T::coord_t>; // apparent DEC
requires std::same_as<decltype(telemetry.tagHA), typename T::coord_t>; // hour angle
requires std::same_as<decltype(telemetry.tagAZ), typename T::coord_t>; // azimuth
requires std::same_as<decltype(telemetry.tagALT), typename T::coord_t>; // altitude
// mount current coordinates
requires std::same_as<decltype(telemetry.mntRA), typename T::coord_t>; // apparent RA
requires std::same_as<decltype(telemetry.mntDEC), typename T::coord_t>; // apparent DEC
@@ -303,6 +322,11 @@ concept mcc_mount_telemetry_data_c = requires(T telemetry) {
requires std::same_as<decltype(telemetry.mntPosY), typename T::coord_t>; // hardware encoder Y-axis position
requires std::same_as<decltype(telemetry.mntRateX), typename T::coord_t>; // hardware encoder X-axis rate
requires std::same_as<decltype(telemetry.mntRateY), typename T::coord_t>; // hardware encoder Y-axis rate
// corrections to transform mount hardware coordinates to apparent
// (pointing error corrections)
requires std::same_as<decltype(telemetry.pecX), typename T::coord_t>;
requires std::same_as<decltype(telemetry.pecY), typename T::coord_t>;
};