...
This commit is contained in:
parent
a34d258b94
commit
2dbb23dc46
120
cxx/mcc_mount.h
120
cxx/mcc_mount.h
@ -24,44 +24,34 @@ namespace mcc
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// template <traits::mcc_mount_config_c MOUNT_CONFIG, traits::mcc_mount_telemetry_c MOUNT_TELEMETRY>
|
||||||
// mount configuration
|
template <traits::mcc_mount_config_c MOUNT_CONFIG>
|
||||||
template <MccMountType MOUNT_TYPE>
|
|
||||||
struct MccMountConfig {
|
|
||||||
static constexpr MccMountType mountType = MOUNT_TYPE;
|
|
||||||
|
|
||||||
virtual ~MccMountConfig() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
namespace traits
|
|
||||||
{
|
|
||||||
|
|
||||||
// given mount configuration class must be a descendant of MccMountConfig
|
|
||||||
template <typename T>
|
|
||||||
concept mcc_mountconfig_c = requires(T t) { []<MccMountType MOUNT_TYPE>(MccMountConfig<MOUNT_TYPE>*) {}(&t); };
|
|
||||||
|
|
||||||
} // namespace traits
|
|
||||||
|
|
||||||
|
|
||||||
template <traits::mcc_mountconfig_c MOUNT_CONFIG, traits::mcc_mount_telemetry_c MOUNT_TELEMETRY>
|
|
||||||
class MccMount : public fsm::MccFiniteStateMachine, public utils::MccSpdlogLogger
|
class MccMount : public fsm::MccFiniteStateMachine, public utils::MccSpdlogLogger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr auto mountType = MOUNT_CONFIG::mountType;
|
static constexpr auto mountType = MOUNT_CONFIG::mountType;
|
||||||
|
|
||||||
typedef MOUNT_CONFIG mount_config_t;
|
typedef MOUNT_CONFIG mount_config_t;
|
||||||
typedef MOUNT_TELEMETRY mount_telemetry_t;
|
// typedef MOUNT_TELEMETRY mount_telemetry_t;
|
||||||
|
typedef decltype(mount_config_t::telemetry) mount_telemetry_t;
|
||||||
typedef typename mount_telemetry_t::mount_telemetry_data_t mount_telemetry_data_t;
|
typedef typename mount_telemetry_t::mount_telemetry_data_t mount_telemetry_data_t;
|
||||||
|
|
||||||
struct slew_param_t {
|
typedef decltype(mount_config_t::astrometryEngine) astrom_engine_t;
|
||||||
MccCoordPairKind kind; // input coordinates type
|
typedef decltype(mount_config_t::PEC) pec_t;
|
||||||
|
typedef decltype(mount_config_t::hardware) hardware_t;
|
||||||
|
typedef decltype(mount_config_t::slewModel) slew_model_t;
|
||||||
|
typedef decltype(mount_config_t::guidingModel) guiding_model_t;
|
||||||
|
|
||||||
MccAngle x; // co-longitude (e.g. RA or Az)
|
typedef typename slew_model_t::slew_params_t slew_params_t;
|
||||||
MccAngle y; // co-latitude (e.g. DEC or ZD)
|
|
||||||
|
|
||||||
bool stop; // stop after slewing
|
// struct slew_params_t {
|
||||||
};
|
// MccCoordPairKind kind; // input coordinates type
|
||||||
|
|
||||||
|
// typename mount_telemetry_data_t::coord_t x; // co-longitude (e.g. RA or Az)
|
||||||
|
// typename mount_telemetry_data_t::coord_t y; // co-latitude (e.g. DEC or ZD)
|
||||||
|
|
||||||
|
// bool stop; // stop after slewing
|
||||||
|
// };
|
||||||
|
|
||||||
/* constructors and destructor */
|
/* constructors and destructor */
|
||||||
|
|
||||||
@ -98,7 +88,7 @@ public:
|
|||||||
|
|
||||||
void shutdownMount() {}
|
void shutdownMount() {}
|
||||||
|
|
||||||
void slewMount(slew_param_t params) {}
|
void slewMount(slew_params_t params) {}
|
||||||
|
|
||||||
void startGuiding() {}
|
void startGuiding() {}
|
||||||
|
|
||||||
@ -109,7 +99,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mount_telemetry_data_t mountTelemetry() const
|
mount_telemetry_data_t mountTelemetryData() const
|
||||||
{
|
{
|
||||||
mount_telemetry_data_t mnt_data;
|
mount_telemetry_data_t mnt_data;
|
||||||
|
|
||||||
@ -125,65 +115,24 @@ public:
|
|||||||
/* prohibited zone related public methods */
|
/* prohibited zone related public methods */
|
||||||
|
|
||||||
// add zones to mount control system
|
// add zones to mount control system
|
||||||
template <traits::mcc_prohibited_zone_c ZT, traits::mcc_prohibited_zone_c... ZTs>
|
template <traits::mcc_prohibited_zone_c<mount_telemetry_data_t> ZT,
|
||||||
|
traits::mcc_prohibited_zone_c<mount_telemetry_data_t>... ZTs>
|
||||||
size_t pzAddZone(ZT zone, ZTs... zones)
|
size_t pzAddZone(ZT zone, ZTs... zones)
|
||||||
{
|
{
|
||||||
static constexpr auto pi2 = std::numbers::pi / 2.0;
|
static constexpr auto pi2 = std::numbers::pi / 2.0;
|
||||||
|
|
||||||
using tl_coord_t = typename mount_telemetry_data_t::coord_t;
|
|
||||||
using pz_coord_t = typename ZT::coord_t;
|
|
||||||
static_assert(std::convertible_to<tl_coord_t, pz_coord_t>,
|
|
||||||
"TELEMETRY DATA AND PROHIBITED ZONE COORDINATES TYPES ARE NOT COMPATIBLE!");
|
|
||||||
|
|
||||||
auto zone_ptr = std::make_shared<ZT>(std::move(zone));
|
auto zone_ptr = std::make_shared<ZT>(std::move(zone));
|
||||||
|
|
||||||
pz_funcs_t funcs{.coordPairKind = ZT::zoneCoordPairKind,
|
_pzFuncs.emplace_back(
|
||||||
.name = std::format("{}", zone_ptr->name()),
|
{.coordPairKind = ZT::zoneCoordPairKind,
|
||||||
.timeToFunc =
|
.name = std::format("{}", zone_ptr->name()),
|
||||||
[zone_ptr, this]() {
|
.inZoneFunc = [zone_ptr,
|
||||||
auto tmry_data = _mountTelemetry.data();
|
this](const mount_telemetry_data_t& tmry_data) { return zone_ptr->inZone(tmry_data); },
|
||||||
|
.timeToFunc = [zone_ptr,
|
||||||
|
this](const mount_telemetry_data_t& tmry_data) { return zone_ptr->timeTo(tmry_data); },
|
||||||
|
.timeFromFunc =
|
||||||
|
[zone_ptr, this](const mount_telemetry_data_t& tmry_data) { return zone_ptr->timeFrom(tmry_data); }});
|
||||||
|
|
||||||
return zone_ptr->timeTo(tmry_data.mntRA, tmry_data.mntDEC, tmry_data.utc);
|
|
||||||
},
|
|
||||||
.timeFromFunc =
|
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->timeFrom(tmry_data.mntRA, tmry_data.mntDEC, tmry_data.utc);
|
|
||||||
}};
|
|
||||||
|
|
||||||
|
|
||||||
if constexpr (ZT::zoneCoordPairKind == MccCoordPairKind::COORDS_KIND_AZALT) { // azimuth and altitude
|
|
||||||
funcs.inZoneFunc = [zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntAZ, tmry_data.mntALT);
|
|
||||||
};
|
|
||||||
} else if constexpr (ZT::zoneCoordPairKind ==
|
|
||||||
MccCoordPairKind::COORDS_KIND_AZZD) { // azimuth and zenithal distance
|
|
||||||
funcs.inZoneFunc = [zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntAZ, pi2 - tmry_data.mntALT);
|
|
||||||
};
|
|
||||||
|
|
||||||
} else if constexpr (ZT::zoneCoordPairKind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
|
||||||
funcs.inZoneFunc = [zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntRA, tmry_data.mntDEC);
|
|
||||||
};
|
|
||||||
} else if constexpr (ZT::zoneCoordPairKind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
|
||||||
funcs.inZoneFunc = [zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntHA, tmry_data.mntDEC);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
static_assert(false, "UNKNOWN COORDINATE SYSTEM!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
_pzFuncs.emplace_back(funcs);
|
|
||||||
|
|
||||||
if constexpr (sizeof...(ZTs)) {
|
if constexpr (sizeof...(ZTs)) {
|
||||||
pzAddZone(std::move(zones)...);
|
pzAddZone(std::move(zones)...);
|
||||||
@ -195,6 +144,7 @@ public:
|
|||||||
// delete all zones from mount control system
|
// delete all zones from mount control system
|
||||||
void pzClearZone()
|
void pzClearZone()
|
||||||
{
|
{
|
||||||
|
// stop mount here?!!
|
||||||
_pzFuncs.clear();
|
_pzFuncs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,9 +156,9 @@ protected:
|
|||||||
// a type to which the result of calling prohibited zone class methods 'timeTo' and 'timeFrom' will be converted
|
// a type to which the result of calling prohibited zone class methods 'timeTo' and 'timeFrom' will be converted
|
||||||
typedef std::chrono::duration<double> pz_duration_t; // seconds as floating-point number
|
typedef std::chrono::duration<double> pz_duration_t; // seconds as floating-point number
|
||||||
|
|
||||||
typedef std::function<bool()> pz_inzone_func_t;
|
typedef std::function<bool(const mount_telemetry_data_t&)> pz_inzone_func_t;
|
||||||
typedef std::function<pz_duration_t()> pz_timeto_func_t;
|
typedef std::function<pz_duration_t(const mount_telemetry_data_t&)> pz_timeto_func_t;
|
||||||
typedef std::function<pz_duration_t()> pz_timefrom_func_t;
|
typedef std::function<pz_duration_t(const mount_telemetry_data_t&)> pz_timefrom_func_t;
|
||||||
struct pz_funcs_t {
|
struct pz_funcs_t {
|
||||||
MccCoordPairKind coordPairKind;
|
MccCoordPairKind coordPairKind;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|||||||
@ -75,6 +75,7 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) {
|
|||||||
typename T::time_point_t; // type to represent UTC time point
|
typename T::time_point_t; // type to represent UTC time point
|
||||||
typename T::juldate_t; // type to represent Julian date
|
typename T::juldate_t; // type to represent Julian date
|
||||||
typename T::sideral_time_t; // type to represent sideral time
|
typename T::sideral_time_t; // type to represent sideral time
|
||||||
|
typename T::eo_t; // equation of origins
|
||||||
typename T::pa_t; // type to represent parallactic angle
|
typename T::pa_t; // type to represent parallactic angle
|
||||||
|
|
||||||
typename T::refract_result_t;
|
typename T::refract_result_t;
|
||||||
@ -153,18 +154,13 @@ concept mcc_astrom_engine_c = requires(T t, const T t_const) {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_mount_hardware_c = requires(T t, const T t_const) {
|
concept mcc_mount_hardware_c = requires(T t, const T t_const) {
|
||||||
requires mcc_error_c<typename T::error_t>;
|
requires mcc_error_c<typename T::error_t>;
|
||||||
typename T::config_t;
|
|
||||||
|
|
||||||
typename T::time_point_t;
|
typename T::time_point_t;
|
||||||
typename T::coord_t;
|
typename T::coord_t;
|
||||||
|
|
||||||
{ t_const.id() } -> mcc_formattable;
|
{ t_const.id() } -> mcc_formattable;
|
||||||
|
|
||||||
// hardware configuration
|
// a class that contains at least time of measurement and coordinates for x,y axes
|
||||||
{ t.setConfig(std::declval<typename T::config_t>()) } -> std::same_as<typename T::error_t>;
|
|
||||||
{ t.getConfig(std::declval<typename T::config_t&>()) } -> std::same_as<typename T::error_t>;
|
|
||||||
|
|
||||||
// at least contains time of measurement and coordinates for x,y axes
|
|
||||||
requires requires(typename T::axes_pos_t pos) {
|
requires requires(typename T::axes_pos_t pos) {
|
||||||
requires std::same_as<decltype(pos.time_point), typename T::time_point_t>;
|
requires std::same_as<decltype(pos.time_point), typename T::time_point_t>;
|
||||||
requires std::same_as<decltype(pos.x), typename T::coord_t>;
|
requires std::same_as<decltype(pos.x), typename T::coord_t>;
|
||||||
@ -173,6 +169,7 @@ concept mcc_mount_hardware_c = requires(T t, const T t_const) {
|
|||||||
|
|
||||||
{ t.setPos(std::declval<typename T::axes_pos_t>()) } -> std::same_as<typename T::error_t>;
|
{ 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.getPos(std::declval<typename T::axes_pos_t&>()) } -> std::same_as<typename T::error_t>;
|
||||||
|
{ t.stop() } -> std::same_as<typename T::error_t>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +179,6 @@ template <typename T>
|
|||||||
concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
||||||
requires mcc_error_c<typename T::error_t>;
|
requires mcc_error_c<typename T::error_t>;
|
||||||
typename T::coord_t;
|
typename T::coord_t;
|
||||||
typename T::pec_data_t;
|
|
||||||
|
|
||||||
// the 'T' class must contain static constexpr member of 'MccMountType' type
|
// the 'T' class must contain static constexpr member of 'MccMountType' type
|
||||||
requires requires {
|
requires requires {
|
||||||
@ -198,9 +194,6 @@ concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
|||||||
requires std::same_as<decltype(res.dy), typename T::coord_t>;
|
requires std::same_as<decltype(res.dy), typename T::coord_t>;
|
||||||
};
|
};
|
||||||
|
|
||||||
{ t.setData(std::declval<typename T::pec_data_t>()) } -> std::same_as<typename T::error_t>;
|
|
||||||
{ t_const.getData(std::declval<typename T::pec_data_t&>()) } -> std::same_as<typename T::error_t>;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
t.compute(std::declval<const typename T::coord_t&>(), std::declval<const typename T::coord_t&>(),
|
t.compute(std::declval<const typename T::coord_t&>(), std::declval<const typename T::coord_t&>(),
|
||||||
std::declval<typename T::pec_result_t>())
|
std::declval<typename T::pec_result_t>())
|
||||||
@ -210,15 +203,26 @@ concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
|||||||
|
|
||||||
/* MOUNT STATE TELEMETRY */
|
/* MOUNT STATE TELEMETRY */
|
||||||
|
|
||||||
// a class that contains at least celestial (equatorial and horizontal) coordinates
|
// a class that contains at least celestial (equatorial and horizontal) and harware coordinates
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_mount_telemetry_data_c = requires(T telemetry) {
|
concept mcc_mount_telemetry_data_c = requires(T telemetry) {
|
||||||
typename T::coord_t;
|
typename T::coord_t;
|
||||||
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
|
// target current coordinates
|
||||||
requires std::same_as<decltype(telemetry.mntHA), typename T::coord_t>; // hour angle
|
requires std::same_as<decltype(telemetry.tagRA), typename T::coord_t>; // apparent RA
|
||||||
requires std::same_as<decltype(telemetry.mntAZ), typename T::coord_t>; // azimuth
|
requires std::same_as<decltype(telemetry.tagDEC), typename T::coord_t>; // apparent DEC
|
||||||
requires std::same_as<decltype(telemetry.mntALT), typename T::coord_t>; // altitude
|
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
|
||||||
|
requires std::same_as<decltype(telemetry.mntHA), typename T::coord_t>; // hour angle
|
||||||
|
requires std::same_as<decltype(telemetry.mntAZ), typename T::coord_t>; // azimuth
|
||||||
|
requires std::same_as<decltype(telemetry.mntALT), typename T::coord_t>; // altitude
|
||||||
|
requires std::same_as<decltype(telemetry.mntPosX), typename T::coord_t>; // hardware encoder X-axis position
|
||||||
|
requires std::same_as<decltype(telemetry.mntPosY), typename T::coord_t>; // hardware encoder Y-axis position
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -265,70 +269,103 @@ concept mcc_slew_params_c = std::movable<T> && requires(T t) {
|
|||||||
|
|
||||||
// stop after slewing
|
// stop after slewing
|
||||||
requires std::convertible_to<decltype(t.stop), bool>;
|
requires std::convertible_to<decltype(t.stop), bool>;
|
||||||
|
|
||||||
requires requires(typename T::slew_model_t t) {
|
|
||||||
{ t.slew(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>()) };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* GENERIC SLEW AND GUIDING MODEL */
|
||||||
|
|
||||||
|
template <typename T, typename TelemetryT>
|
||||||
|
concept mcc_slew_model_c = mcc_mount_telemetry_c<TelemetryT> && requires(T t) {
|
||||||
|
typename T::error_t;
|
||||||
|
requires mcc_slew_params_c<typename T::slew_params_t>;
|
||||||
|
|
||||||
|
{
|
||||||
|
t.slew(std::declval<typename T::slew_params_t>(), std::declval<TelemetryT&>())
|
||||||
|
} -> std::same_as<typename T::error_t>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename TelemetryT>
|
||||||
|
concept mcc_guiding_model_c = mcc_mount_telemetry_c<TelemetryT> && requires(T t) {
|
||||||
|
typename T::error_t;
|
||||||
|
|
||||||
|
{ t.guiding(std::declval<TelemetryT&>()) } -> std::same_as<typename T::error_t>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* MOUNT PROHIBITED ZONE */
|
/* MOUNT PROHIBITED ZONE */
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename TelemetryDataT>
|
||||||
concept mcc_prohibited_zone_c = std::movable<T> && requires(T t, const T t_const) {
|
concept mcc_prohibited_zone_c =
|
||||||
typename T::coord_t;
|
mcc_mount_telemetry_data_c<TelemetryDataT> && std::movable<T> && requires(T t, const T t_const) {
|
||||||
typename T::time_point_t;
|
typename T::coord_t;
|
||||||
|
typename T::time_point_t;
|
||||||
|
|
||||||
// the type 'T' must define a static constexpr member of type MccCoordPairKind
|
// the type 'T' must define a static constexpr member of type MccCoordPairKind
|
||||||
// to declarate type of coordinate pair used to describe the zone.
|
// to declarate type of coordinate pair used to describe the zone.
|
||||||
// This coordinate pair must be used as input in the 'inZone' class method.
|
// This coordinate pair must be used as input in the 'inZone' class method.
|
||||||
requires requires {
|
requires requires {
|
||||||
requires std::same_as<decltype(T::zoneCoordPairKind), const MccCoordPairKind>;
|
requires std::same_as<decltype(T::zoneCoordPairKind), const MccCoordPairKind>;
|
||||||
[]() {
|
[]() {
|
||||||
constexpr MccCoordPairKind val = T::zoneCoordPairKind;
|
constexpr MccCoordPairKind val = T::zoneCoordPairKind;
|
||||||
}(); // to ensure that 'zoneCoordPairKind' can be used at compile-time context
|
}(); // to ensure that 'zoneCoordPairKind' can be used at compile-time context
|
||||||
|
};
|
||||||
|
|
||||||
|
// return a name of the zone
|
||||||
|
{ t_const.name() } -> mcc_formattable;
|
||||||
|
|
||||||
|
|
||||||
|
// check if given coordinates are into the zone.
|
||||||
|
// input coordinates interpretation is in according to 'zoneCoordPairKind' static constexpr member
|
||||||
|
{
|
||||||
|
t.inZone(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>())
|
||||||
|
} -> std::convertible_to<bool>;
|
||||||
|
|
||||||
|
|
||||||
|
// for given coordinates and time the method computes a time to reach the zone.
|
||||||
|
// implementation of the method must assume that input coordinates are apparent RA and DEC at given time point,
|
||||||
|
// while the time point is one from which computation should be performed (e.g. current time moment)
|
||||||
|
{
|
||||||
|
t.timeTo(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||||
|
std::declval<typename T::time_point_t>())
|
||||||
|
} -> mcc_time_duration_c;
|
||||||
|
|
||||||
|
|
||||||
|
// for given coordinates and time the method computes a time to exit from the zone
|
||||||
|
{
|
||||||
|
t.timeFrom(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||||
|
std::declval<typename T::time_point_t>())
|
||||||
|
} -> mcc_time_duration_c;
|
||||||
|
|
||||||
|
// requires for the methods above with the first argument of type
|
||||||
|
// 'const mcc_mount_telemetry_data_c&' (const lvalue reference)
|
||||||
|
|
||||||
|
{ t.inZone(std::declval<const TelemetryDataT&>()) } -> std::convertible_to<bool>;
|
||||||
|
{ t.timeTo(std::declval<const TelemetryDataT&>()) } -> mcc_time_duration_c;
|
||||||
|
{ t.timeFrom(std::declval<const TelemetryDataT&>()) } -> mcc_time_duration_c;
|
||||||
};
|
};
|
||||||
|
|
||||||
// return a name of the zone
|
|
||||||
{ t_const.name() } -> mcc_formattable;
|
|
||||||
|
|
||||||
|
|
||||||
// check if given coordinates are into the zone.
|
|
||||||
// input coordinates interpretation is in according to 'zoneCoordPairKind' static constexpr member
|
|
||||||
{ t.inZone(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>()) } -> std::convertible_to<bool>;
|
|
||||||
|
|
||||||
|
|
||||||
// for given coordinates and time the method computes a time to reach the zone.
|
|
||||||
// implementation of the method must assume that input coordinates are apparent RA and DEC at given time point,
|
|
||||||
// while the time point is one from which computation should be performed (e.g. current time moment)
|
|
||||||
{
|
|
||||||
t.timeTo(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
|
||||||
std::declval<typename T::time_point_t>())
|
|
||||||
} -> mcc_time_duration_c;
|
|
||||||
|
|
||||||
|
|
||||||
// for given coordinates and time the method computes a time to exit from the zone
|
|
||||||
{
|
|
||||||
t.timeFrom(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
|
||||||
std::declval<typename T::time_point_t>())
|
|
||||||
} -> mcc_time_duration_c;
|
|
||||||
|
|
||||||
// requires for the methods above with the first argument of type 'const
|
|
||||||
// mcc_mount_telemetry_c::mcc_mount_telemetry_data_t&' (const lvalue reference)
|
|
||||||
//
|
|
||||||
// something like this:
|
|
||||||
requires mcc_mount_telemetry_data_c<mcc_func_arg1_t<decltype(T::inZone)>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* MOUNT GENERIC CONFIGURATION */
|
/* MOUNT GENERIC CONFIGURATION */
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_mount_config_c = requires(T t) {
|
concept mcc_mount_config_c = requires(T t) {
|
||||||
{ t.astromEngine() } -> mcc_astrom_engine_c;
|
// { t.astromEngine() } -> mcc_astrom_engine_c;
|
||||||
{ t.pec() } -> mcc_mount_pec_c;
|
// { t.pec() } -> mcc_mount_pec_c;
|
||||||
{ t.hardware() } -> mcc_mount_hardware_c;
|
// { t.hardware() } -> mcc_mount_hardware_c;
|
||||||
|
|
||||||
|
requires mcc_astrom_engine_c<decltype(t.astrometryEngine)>;
|
||||||
|
requires mcc_mount_pec_c<decltype(t.PEC)>;
|
||||||
|
requires mcc_mount_hardware_c<decltype(t.hardware)>;
|
||||||
|
requires mcc_mount_telemetry_c<decltype(t.telemetry)>;
|
||||||
|
|
||||||
|
requires mcc_slew_model_c<decltype(t.slewModel), decltype(t.telemetry)>;
|
||||||
|
requires mcc_guiding_model_c<decltype(t.guidingModel), decltype(t.telemetry)>;
|
||||||
|
|
||||||
|
// a std::tuple of prohibited zones
|
||||||
|
[]<mcc_prohibited_zone_c<typename decltype(t.telemetry)::mount_telemetry_data_t>... Ts>(std::tuple<Ts...>) {
|
||||||
|
}(t.prohibitedZones);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ struct MccMountEventSlew : public MccMountEventBase<MountT> {
|
|||||||
|
|
||||||
static constexpr std::string_view ID = "MCC-MOUNT-SLEW-EVENT";
|
static constexpr std::string_view ID = "MCC-MOUNT-SLEW-EVENT";
|
||||||
|
|
||||||
using event_data_t = typename MountT::slew_param_t;
|
using event_data_t = typename MountT::slew_params_t;
|
||||||
|
|
||||||
event_data_t eventData() const
|
event_data_t eventData() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/* MOUNT TELEMETRY OBJECT CONCEPT AND POSSIBLE IMPLEMENTATION */
|
/* MOUNT TELEMETRY OBJECT POSSIBLE IMPLEMENTATION */
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@ -189,11 +189,13 @@ public:
|
|||||||
return TEL_ERROR_OK;
|
return TEL_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_telemetry_data_t data()
|
error_t data(mount_telemetry_data_t& data)
|
||||||
{
|
{
|
||||||
std::lock_guard lock{_updateMutex};
|
std::lock_guard lock{_updateMutex};
|
||||||
|
|
||||||
return std::move(_data);
|
data = std::move(_data);
|
||||||
|
|
||||||
|
return TEL_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user