...
This commit is contained in:
parent
096040bb1b
commit
a34d258b94
@ -111,7 +111,14 @@ public:
|
|||||||
|
|
||||||
mount_telemetry_data_t mountTelemetry() const
|
mount_telemetry_data_t mountTelemetry() const
|
||||||
{
|
{
|
||||||
return _mountTelemetry.data();
|
mount_telemetry_data_t mnt_data;
|
||||||
|
|
||||||
|
auto err = _mountTelemetry.data(mnt_data);
|
||||||
|
if (err) {
|
||||||
|
// log ....
|
||||||
|
}
|
||||||
|
|
||||||
|
return mnt_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,62 +130,61 @@ public:
|
|||||||
{
|
{
|
||||||
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));
|
||||||
|
|
||||||
// typename ZT::coord_t x, y;
|
pz_funcs_t funcs{.coordPairKind = ZT::zoneCoordPairKind,
|
||||||
|
.name = std::format("{}", zone_ptr->name()),
|
||||||
|
.timeToFunc =
|
||||||
|
[zone_ptr, this]() {
|
||||||
|
auto tmry_data = _mountTelemetry.data();
|
||||||
|
|
||||||
if constexpr (ZT::preferedCoordKind == MccCoordPairKind::COORDS_KIND_AZALT) { // azimuth and altitude
|
return zone_ptr->timeTo(tmry_data.mntRA, tmry_data.mntDEC, tmry_data.utc);
|
||||||
_pzFuncs.emplace_back({.coordPairKind = ZT::preferedCoordKind,
|
},
|
||||||
.inZoneFunc =
|
.timeFromFunc =
|
||||||
[zone_ptr, this]() {
|
[zone_ptr, this]() {
|
||||||
auto tmry_data = _mountTelemetry.data();
|
auto tmry_data = _mountTelemetry.data();
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntAZ, tmry_data.mntALT, tmry_data.utc);
|
return zone_ptr->timeFrom(tmry_data.mntRA, tmry_data.mntDEC, tmry_data.utc);
|
||||||
},
|
}};
|
||||||
.timeToFunc =
|
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->timeTo(tmry_data.mntAZ, tmry_data.mntALT, tmry_data.utc);
|
|
||||||
},
|
|
||||||
.timeFromFunc =
|
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->timeFrom(tmry_data.mntAZ, tmry_data.mntALT, tmry_data.utc);
|
if constexpr (ZT::zoneCoordPairKind == MccCoordPairKind::COORDS_KIND_AZALT) { // azimuth and altitude
|
||||||
}});
|
funcs.inZoneFunc = [zone_ptr, this]() {
|
||||||
|
auto tmry_data = _mountTelemetry.data();
|
||||||
|
|
||||||
} else if constexpr (ZT::preferedCoordKind ==
|
return zone_ptr->inZone(tmry_data.mntAZ, tmry_data.mntALT);
|
||||||
|
};
|
||||||
|
} else if constexpr (ZT::zoneCoordPairKind ==
|
||||||
MccCoordPairKind::COORDS_KIND_AZZD) { // azimuth and zenithal distance
|
MccCoordPairKind::COORDS_KIND_AZZD) { // azimuth and zenithal distance
|
||||||
_pzFuncs.emplace_back(
|
funcs.inZoneFunc = [zone_ptr, this]() {
|
||||||
{.coordPairKind = ZT::preferedCoordKind,
|
auto tmry_data = _mountTelemetry.data();
|
||||||
.inZoneFunc =
|
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->inZone(tmry_data.mntAZ, pi2 - tmry_data.mntALT, tmry_data.utc);
|
return zone_ptr->inZone(tmry_data.mntAZ, pi2 - tmry_data.mntALT);
|
||||||
},
|
};
|
||||||
.timeToFunc =
|
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->timeTo(tmry_data.mntAZ, pi2 - tmry_data.mntALT, tmry_data.utc);
|
} else if constexpr (ZT::zoneCoordPairKind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
||||||
},
|
funcs.inZoneFunc = [zone_ptr, this]() {
|
||||||
.timeFromFunc =
|
auto tmry_data = _mountTelemetry.data();
|
||||||
[zone_ptr, this]() {
|
|
||||||
auto tmry_data = _mountTelemetry.data();
|
|
||||||
|
|
||||||
return zone_ptr->timeFrom(tmry_data.mntAZ, pi2 - tmry_data.mntALT, tmry_data.utc);
|
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();
|
||||||
|
|
||||||
} else if constexpr (ZT::preferedCoordKind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
return zone_ptr->inZone(tmry_data.mntHA, tmry_data.mntDEC);
|
||||||
} else if constexpr (ZT::preferedCoordKind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
};
|
||||||
} else if constexpr (ZT::preferedCoordKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
|
||||||
} else if constexpr (ZT::preferedCoordKind == MccCoordPairKind::COORDS_KIND_XY) {
|
|
||||||
} else {
|
} else {
|
||||||
static_assert(false, "UNKNOWN COORDINATE SYSTEM!!!");
|
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)...);
|
||||||
}
|
}
|
||||||
@ -192,10 +198,6 @@ public:
|
|||||||
_pzFuncs.clear();
|
_pzFuncs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::derived_from<MccAngle> XT, std::derived_from<MccAngle> YT>
|
|
||||||
auto pzInZone(const XT& x, const YT& y, traits::mcc_time_duration_c auto const& utc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mount_config_t _mountConfig;
|
mount_config_t _mountConfig;
|
||||||
@ -209,6 +211,7 @@ protected:
|
|||||||
typedef std::function<pz_duration_t()> pz_timefrom_func_t;
|
typedef std::function<pz_duration_t()> pz_timefrom_func_t;
|
||||||
struct pz_funcs_t {
|
struct pz_funcs_t {
|
||||||
MccCoordPairKind coordPairKind;
|
MccCoordPairKind coordPairKind;
|
||||||
|
std::string name;
|
||||||
pz_inzone_func_t inZoneFunc;
|
pz_inzone_func_t inZoneFunc;
|
||||||
pz_timeto_func_t timeToFunc;
|
pz_timeto_func_t timeToFunc;
|
||||||
pz_timefrom_func_t timeFromFunc;
|
pz_timefrom_func_t timeFromFunc;
|
||||||
@ -216,6 +219,7 @@ protected:
|
|||||||
|
|
||||||
std::vector<pz_funcs_t> _pzFuncs{};
|
std::vector<pz_funcs_t> _pzFuncs{};
|
||||||
|
|
||||||
|
|
||||||
}; // end of MccMount class
|
}; // end of MccMount class
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -70,9 +70,7 @@ public:
|
|||||||
|
|
||||||
AngleT lat = "00:00:00"_dms; // site latitude
|
AngleT lat = "00:00:00"_dms; // site latitude
|
||||||
AngleT lon = "00:00:00"_dms; // site longitude
|
AngleT lon = "00:00:00"_dms; // site longitude
|
||||||
// MccAngle lat = "00:00:00"_dms; // site latitude
|
double elev = 0.0; // site elevation (in meters)
|
||||||
// MccAngle lon = "00:00:00"_dms; // site longitude
|
|
||||||
double elev = 0.0; // site elevation (in meters)
|
|
||||||
|
|
||||||
mcc::astrom::iers::MccLeapSeconds _leapSeconds{};
|
mcc::astrom::iers::MccLeapSeconds _leapSeconds{};
|
||||||
mcc::astrom::iers::MccIersBulletinA _bulletinA{};
|
mcc::astrom::iers::MccIersBulletinA _bulletinA{};
|
||||||
|
|||||||
@ -184,6 +184,14 @@ concept mcc_mount_pec_c = requires(T t, const T t_const) {
|
|||||||
typename T::coord_t;
|
typename T::coord_t;
|
||||||
typename T::pec_data_t;
|
typename T::pec_data_t;
|
||||||
|
|
||||||
|
// the 'T' class must contain static constexpr member of 'MccMountType' type
|
||||||
|
requires requires {
|
||||||
|
requires std::same_as<decltype(T::mountType), const MccMountType>;
|
||||||
|
[]() {
|
||||||
|
static constexpr MccMountType val = T::mountType;
|
||||||
|
}(); // to ensure 'mountType' can be used in compile-time context
|
||||||
|
};
|
||||||
|
|
||||||
// a class that contains at least .dx and .dy public fields
|
// a class that contains at least .dx and .dy public fields
|
||||||
requires requires(typename T::pec_result_t res) {
|
requires requires(typename T::pec_result_t res) {
|
||||||
requires std::same_as<decltype(res.dx), typename T::coord_t>;
|
requires std::same_as<decltype(res.dx), typename T::coord_t>;
|
||||||
@ -202,25 +210,65 @@ 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
|
||||||
|
template <typename T>
|
||||||
|
concept mcc_mount_telemetry_data_c = requires(T telemetry) {
|
||||||
|
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
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_mount_telemetry_c = requires(T t, const T t_const) {
|
concept mcc_mount_telemetry_c = requires(T t, const T t_const) {
|
||||||
typename T::error_t;
|
typename T::error_t;
|
||||||
|
|
||||||
// a class that at least contains celestial (equatorial and horizontal) coordinates
|
// // a class that at least contains celestial (equatorial and horizontal) coordinates
|
||||||
requires requires(typename T::mount_telemetry_data_t telemetry) {
|
// requires requires(typename T::mount_telemetry_data_t telemetry) {
|
||||||
typename T::mount_telemetry_data_t::coord_t;
|
// typename T::mount_telemetry_data_t::coord_t;
|
||||||
requires std::same_as<decltype(telemetry.mntRA), typename T::mount_telemetry_data_t::coord_t>; // apparent RA
|
// requires std::same_as<decltype(telemetry.mntRA), typename T::mount_telemetry_data_t::coord_t>; // apparent
|
||||||
requires std::same_as<decltype(telemetry.mntDEC), typename T::mount_telemetry_data_t::coord_t>; // apparent DEC
|
// RA requires std::same_as<decltype(telemetry.mntDEC), typename T::mount_telemetry_data_t::coord_t>; //
|
||||||
requires std::same_as<decltype(telemetry.mntHA), typename T::mount_telemetry_data_t::coord_t>; // hour angle
|
// apparent DEC requires std::same_as<decltype(telemetry.mntHA), typename T::mount_telemetry_data_t::coord_t>;
|
||||||
requires std::same_as<decltype(telemetry.mntAZ), typename T::mount_telemetry_data_t::coord_t>; // azimuth
|
// // hour angle requires std::same_as<decltype(telemetry.mntAZ), typename T::mount_telemetry_data_t::coord_t>;
|
||||||
requires std::same_as<decltype(telemetry.mntALT), typename T::mount_telemetry_data_t::coord_t>; // altitude
|
// // azimuth requires std::same_as<decltype(telemetry.mntALT), typename T::mount_telemetry_data_t::coord_t>; //
|
||||||
};
|
// altitude
|
||||||
|
// };
|
||||||
|
|
||||||
|
requires mcc_mount_telemetry_data_c<typename T::mount_telemetry_data_t>;
|
||||||
|
|
||||||
{ t_const.errorString(std::declval<typename T::error_t>()) } -> mcc_formattable;
|
{ t_const.errorString(std::declval<typename T::error_t>()) } -> mcc_formattable;
|
||||||
|
|
||||||
{ t.update() } -> std::same_as<typename T::error_t>;
|
{ t.update() } -> std::same_as<typename T::error_t>;
|
||||||
|
|
||||||
{ t.data() } -> std::same_as<typename T::mount_telemetry_data_t>;
|
{ t.data(std::declval<typename T::mount_telemetry_data_t&>()) } -> std::same_as<typename T::error_t>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* SLEW PARAMETERS */
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
concept mcc_slew_params_c = std::movable<T> && requires(T t) {
|
||||||
|
// input coordinates pair type (e.g. IRCS RA,DEC, Az,Alt and so on)
|
||||||
|
requires std::same_as<decltype(t.coordPairKind), MccCoordPairKind>;
|
||||||
|
|
||||||
|
typename T::coord_t;
|
||||||
|
|
||||||
|
// co-longitude (e.g. RA or Az)
|
||||||
|
requires std::same_as<decltype(t.x), typename T::coord_t>;
|
||||||
|
|
||||||
|
// co-latitude (e.g. DEC or ZD)
|
||||||
|
requires std::same_as<decltype(t.y), typename T::coord_t>;
|
||||||
|
|
||||||
|
// stop after slewing
|
||||||
|
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>()) };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -265,6 +313,12 @@ concept mcc_prohibited_zone_c = std::movable<T> && requires(T t, const T t_const
|
|||||||
t.timeFrom(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
t.timeFrom(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||||
std::declval<typename T::time_point_t>())
|
std::declval<typename T::time_point_t>())
|
||||||
} -> mcc_time_duration_c;
|
} -> 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)>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user