...
This commit is contained in:
parent
7948321cce
commit
bc12777f18
@ -590,7 +590,18 @@ public:
|
|||||||
|
|
||||||
// the main scenario: from ICRS to apparent
|
// the main scenario: from ICRS to apparent
|
||||||
if (from_pt.pair_kind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
if (from_pt.pair_kind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
|
to_pt->RA_ICRS = from_pt.X;
|
||||||
|
to_pt->DEC_ICRS = from_pt.Y;
|
||||||
|
|
||||||
return icrs2obs(from_pt, to_pt);
|
return icrs2obs(from_pt, to_pt);
|
||||||
|
} else { // from apparent (2025-12-18: according to addition of RA/DEC_OCRS to mcc_eqt_hrz_coord_c)
|
||||||
|
cpt.pair_kind = MccCoordPairKind::COORDS_KIND_RADEC_ICRS;
|
||||||
|
ret = transformCoordinates(from_pt, &cpt); // to ICRS
|
||||||
|
if (!ret) {
|
||||||
|
ret = transformCoordinates(cpt, to_pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from apparent: copy corresponded coordinates and compute other ones (ignore to_pt->pair_kind)
|
// from apparent: copy corresponded coordinates and compute other ones (ignore to_pt->pair_kind)
|
||||||
|
|||||||
@ -441,23 +441,12 @@ struct MccGenericEqtHrzCoords : MccGenericCelestialPoint<CoordT> {
|
|||||||
|
|
||||||
using MccGenericCelestialPoint<CoordT>::time_point;
|
using MccGenericCelestialPoint<CoordT>::time_point;
|
||||||
|
|
||||||
coord_t RA_APP{}, DEC_APP{}, HA{}, AZ{}, ZD{}, ALT{};
|
coord_t RA_ICRS{}, DEC_ICRS{}, RA_APP{}, DEC_APP{}, HA{}, AZ{}, ZD{}, ALT{};
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef MccGenericEqtHrzCoords<MccCelestialPoint::coord_t> MccEqtHrzCoords;
|
typedef MccGenericEqtHrzCoords<MccCelestialPoint::coord_t> MccEqtHrzCoords;
|
||||||
|
|
||||||
|
|
||||||
template <mcc_angle_c CoordT>
|
|
||||||
struct MccGenericPointingTarget : MccGenericEqtHrzCoords<CoordT> {
|
|
||||||
using typename MccGenericEqtHrzCoords<CoordT>::coord_t;
|
|
||||||
|
|
||||||
coord_t RA_ICRS{}, DEC_ICRS{};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef MccGenericPointingTarget<MccCelestialPoint::coord_t> MccPointingTarget;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <mcc_angle_c CoordT>
|
template <mcc_angle_c CoordT>
|
||||||
struct MccGenericPCMResult {
|
struct MccGenericPCMResult {
|
||||||
@ -479,7 +468,7 @@ struct MccGenericTelemetryData : MccGenericEqtHrzCoords<CoordT> {
|
|||||||
|
|
||||||
MccGenericCelestialPoint<coord_t> entered_target{};
|
MccGenericCelestialPoint<coord_t> entered_target{};
|
||||||
|
|
||||||
MccGenericPointingTarget<coord_t> target{};
|
MccGenericEqtHrzCoords<coord_t> target{};
|
||||||
|
|
||||||
coord_t speedX, speedY;
|
coord_t speedX, speedY;
|
||||||
|
|
||||||
@ -505,7 +494,6 @@ struct MccPositionControls : CCTE_T, HARDWARE_T, PCM_T {
|
|||||||
|
|
||||||
static_assert(mcc_julday_c<MccJulianDay>, "");
|
static_assert(mcc_julday_c<MccJulianDay>, "");
|
||||||
static_assert(mcc_celestial_point_c<MccCelestialPoint>, "");
|
static_assert(mcc_celestial_point_c<MccCelestialPoint>, "");
|
||||||
static_assert(mcc_pointing_target_coord_c<MccGenericPointingTarget<double>>, "");
|
|
||||||
static_assert(mcc_telemetry_data_c<MccTelemetryData>, "");
|
static_assert(mcc_telemetry_data_c<MccTelemetryData>, "");
|
||||||
|
|
||||||
|
|
||||||
@ -918,13 +906,20 @@ public:
|
|||||||
template <mcc_eqt_hrz_coord_c T, traits::mcc_output_char_range OR>
|
template <mcc_eqt_hrz_coord_c T, traits::mcc_output_char_range OR>
|
||||||
void operator()(const T& value, OR& bytes)
|
void operator()(const T& value, OR& bytes)
|
||||||
{
|
{
|
||||||
// output format: RA, DEC, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
// output format: RA_ICRS, DEC_ICRS, RA, DEC, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
||||||
// in the case of sexagesimal output X,Y coordinates will be interpretated
|
// in the case of sexagesimal output X,Y coordinates will be interpretated
|
||||||
// according to value.pair_kind field
|
// according to value.pair_kind field
|
||||||
|
|
||||||
if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
||||||
toDegrees(bytes, value.RA_APP, value.DEC_APP, value.HA, value.AZ, value.ZD, value.ALT, value.X, value.Y);
|
toDegrees(bytes, value.RA_ICRS, value.DEC_ICRS, value.RA_APP, value.DEC_APP, value.HA, value.AZ, value.ZD,
|
||||||
|
value.ALT, value.X, value.Y);
|
||||||
} else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
} else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
||||||
|
toSexagesimalHour(bytes, value.RA_ICRS);
|
||||||
|
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
|
toSexagesimalDeg(bytes, value.DEC_ICRS);
|
||||||
|
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
toSexagesimalHour(bytes, value.RA_APP);
|
toSexagesimalHour(bytes, value.RA_APP);
|
||||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
@ -967,54 +962,65 @@ public:
|
|||||||
template <traits::mcc_input_char_range IR, mcc_eqt_hrz_coord_c T>
|
template <traits::mcc_input_char_range IR, mcc_eqt_hrz_coord_c T>
|
||||||
std::error_code operator()(IR&& bytes, T& value)
|
std::error_code operator()(IR&& bytes, T& value)
|
||||||
{
|
{
|
||||||
// valid format: RA, DEC, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
// valid format: RA_ICRS, DEC_ICRS, RA, DEC, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
||||||
// in the case of sexagesimal input the X,Y coordinates will be interpretated
|
// in the case of sexagesimal input the X,Y coordinates will be interpretated
|
||||||
// according to value.pair_kind field
|
// according to value.pair_kind field
|
||||||
|
|
||||||
auto els = splitToElements(std::forward<IR>(bytes));
|
auto els = splitToElements(std::forward<IR>(bytes));
|
||||||
if (els.size() < 10) {
|
if (els.size() < 12) {
|
||||||
// return std::make_error_code(std::errc::invalid_argument);
|
// return std::make_error_code(std::errc::invalid_argument);
|
||||||
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
MccEqtHrzCoords pt;
|
MccEqtHrzCoords pt;
|
||||||
pt.pair_kind = MccCoordStrToPairKind(els[8]);
|
pt.pair_kind = MccCoordStrToPairKind(els[10]);
|
||||||
if (pt.pair_kind == MccCoordPairKind::COORDS_KIND_UNKNOWN) {
|
if (pt.pair_kind == MccCoordPairKind::COORDS_KIND_UNKNOWN) {
|
||||||
// return std::make_error_code(std::errc::invalid_argument);
|
// return std::make_error_code(std::errc::invalid_argument);
|
||||||
return MccCoordinateConvErrorCode::ERROR_INVALID_CPAIR;
|
return MccCoordinateConvErrorCode::ERROR_INVALID_CPAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto err = parseTimePoint(els[9], pt);
|
auto err = parseTimePoint(els[11], pt);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseHourRepr(els[0], pt.RA_APP);
|
size_t idx = 0;
|
||||||
|
err = parseHourRepr(els[idx++], pt.RA_ICRS);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseDegreeRepr(els[1], pt.DEC_APP);
|
err = parseDegreeRepr(els[idx++], pt.DEC_ICRS);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseHourRepr(els[2], pt.HA);
|
err = parseHourRepr(els[idx++], pt.RA_APP);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseDegreeRepr(els[4], pt.AZ);
|
err = parseDegreeRepr(els[idx++], pt.DEC_APP);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseDegreeRepr(els[5], pt.ZD);
|
err = parseHourRepr(els[idx++], pt.HA);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseDegreeRepr(els[6], pt.ALT);
|
err = parseDegreeRepr(els[idx++], pt.AZ);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = parseDegreeRepr(els[idx++], pt.ZD);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = parseDegreeRepr(els[idx++], pt.ALT);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1023,16 +1029,16 @@ public:
|
|||||||
case MccCoordPairKind::COORDS_KIND_RADEC_ICRS:
|
case MccCoordPairKind::COORDS_KIND_RADEC_ICRS:
|
||||||
case MccCoordPairKind::COORDS_KIND_RADEC_APP:
|
case MccCoordPairKind::COORDS_KIND_RADEC_APP:
|
||||||
case MccCoordPairKind::COORDS_KIND_HADEC_APP:
|
case MccCoordPairKind::COORDS_KIND_HADEC_APP:
|
||||||
err = parseHourRepr(els[7], pt.X);
|
err = parseHourRepr(els[idx++], pt.X);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err = parseDegreeRepr(els[7], pt.X);
|
err = parseDegreeRepr(els[idx++], pt.X);
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseDegreeRepr(els[8], pt.Y);
|
err = parseDegreeRepr(els[idx++], pt.Y);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1045,74 +1051,74 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MccPointingTargetSerializer : public MccCoordinateSerializer
|
// class MccPointingTargetSerializer : public MccCoordinateSerializer
|
||||||
{
|
// {
|
||||||
public:
|
// public:
|
||||||
template <mcc_pointing_target_coord_c T, traits::mcc_output_char_range OR>
|
// template <mcc_pointing_target_coord_c T, traits::mcc_output_char_range OR>
|
||||||
void operator()(const T& value, OR& bytes)
|
// void operator()(const T& value, OR& bytes)
|
||||||
{
|
// {
|
||||||
static MccEqtHrzCoordsSerializer eqhrz_ser;
|
// static MccEqtHrzCoordsSerializer eqhrz_ser;
|
||||||
|
|
||||||
// output format: RA_ICRS, DEC_ICRS, RA_APP, DEC_APP, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
// // output format: RA_ICRS, DEC_ICRS, RA_APP, DEC_APP, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
||||||
// in the case of sexagesimal output X,Y coordinates will be interpretated
|
// // in the case of sexagesimal output X,Y coordinates will be interpretated
|
||||||
// according to value.pair_kind field
|
// // according to value.pair_kind field
|
||||||
|
|
||||||
if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
// if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
||||||
toDegrees(bytes, value.RA_ICRS, value.DEC_ICRS);
|
// toDegrees(bytes, value.RA_ICRS, value.DEC_ICRS);
|
||||||
} else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
// } else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
||||||
toSexagesimalHour(bytes, value.RA_ICRS);
|
// toSexagesimalHour(bytes, value.RA_ICRS);
|
||||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
// std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
toSexagesimalDeg(bytes, value.DEC_ICRS);
|
// toSexagesimalDeg(bytes, value.DEC_ICRS);
|
||||||
}
|
// }
|
||||||
|
|
||||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
// std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
eqhrz_ser.setFormat(_currentFormat);
|
// eqhrz_ser.setFormat(_currentFormat);
|
||||||
eqhrz_ser.setPrecision(_currentPrec);
|
// eqhrz_ser.setPrecision(_currentPrec);
|
||||||
eqhrz_ser(value, bytes);
|
// eqhrz_ser(value, bytes);
|
||||||
|
|
||||||
// MccEqtHrzCoordsSerializer{}(value, bytes);
|
// // MccEqtHrzCoordsSerializer{}(value, bytes);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
class MccPointingTargetDeserializer : public MccCoordinateDeserializer
|
// class MccPointingTargetDeserializer : public MccCoordinateDeserializer
|
||||||
{
|
// {
|
||||||
public:
|
// public:
|
||||||
template <traits::mcc_input_char_range IR, mcc_pointing_target_coord_c T>
|
// template <traits::mcc_input_char_range IR, mcc_pointing_target_coord_c T>
|
||||||
std::error_code operator()(IR&& bytes, T& value)
|
// std::error_code operator()(IR&& bytes, T& value)
|
||||||
{
|
// {
|
||||||
// valid format: RA_ICRS, DEC_ICRS, RA_APP, DEC_APP, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
// // valid format: RA_ICRS, DEC_ICRS, RA_APP, DEC_APP, HA, AZ, ZD, ALT, X, Y, pair-kind, time-point
|
||||||
// in the case of sexagesimal input the X,Y coordinates will be interpretated
|
// // in the case of sexagesimal input the X,Y coordinates will be interpretated
|
||||||
// according to value.pair_kind field
|
// // according to value.pair_kind field
|
||||||
|
|
||||||
auto els = splitToElements(std::forward<IR>(bytes));
|
// auto els = splitToElements(std::forward<IR>(bytes));
|
||||||
if (els.size() < 12) {
|
// if (els.size() < 12) {
|
||||||
// return std::make_error_code(std::errc::invalid_argument);
|
// // return std::make_error_code(std::errc::invalid_argument);
|
||||||
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
// return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||||
}
|
// }
|
||||||
|
|
||||||
MccPointingTarget pt;
|
// MccPointingTarget pt;
|
||||||
auto err = parseHourRepr(els[0], pt.RA_ICRS);
|
// auto err = parseHourRepr(els[0], pt.RA_ICRS);
|
||||||
if (err) {
|
// if (err) {
|
||||||
return err;
|
// return err;
|
||||||
}
|
// }
|
||||||
|
|
||||||
err = parseDegreeRepr(els[1], pt.DEC_ICRS);
|
// err = parseDegreeRepr(els[1], pt.DEC_ICRS);
|
||||||
if (err) {
|
// if (err) {
|
||||||
return err;
|
// return err;
|
||||||
}
|
// }
|
||||||
|
|
||||||
err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[2].begin(), els[11].end()}, pt);
|
// err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[2].begin(), els[11].end()}, pt);
|
||||||
if (err) {
|
// if (err) {
|
||||||
return err;
|
// return err;
|
||||||
}
|
// }
|
||||||
|
|
||||||
mcc_copy_pointing_target_coord(pt, &value);
|
// mcc_copy_pointing_target_coord(pt, &value);
|
||||||
|
|
||||||
return {};
|
// return {};
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
class MccTelemetryDataSerializer : public MccCoordinateSerializer
|
class MccTelemetryDataSerializer : public MccCoordinateSerializer
|
||||||
@ -1122,13 +1128,13 @@ public:
|
|||||||
void operator()(const T& value, OR& bytes)
|
void operator()(const T& value, OR& bytes)
|
||||||
{
|
{
|
||||||
static MccEqtHrzCoordsSerializer eqhrz_ser;
|
static MccEqtHrzCoordsSerializer eqhrz_ser;
|
||||||
static MccPointingTargetSerializer pt_ser;
|
// static MccPointingTargetSerializer pt_ser;
|
||||||
|
|
||||||
// output format: <mount data>, speedX, speedY, pcmX, pcmY, refCorr (in arcsecs), <target data>
|
// output format: <mount data>, speedX, speedY, pcmX, pcmY, refCorr (in arcsecs), <target data>
|
||||||
// RA-APP_mnt, DEC-APP_mnt, HA_mnt, AZ_mnt, ZD_mnt, ALT_mnt, X_mnt, Y_mnt, COO-PAIR_mnt, TIME-POINT_mnt,
|
// RA-ICRS_mnt, DEC-ICRS_mnt, RA-APP_mnt, DEC-APP_mnt, HA_mnt, AZ_mnt, ZD_mnt, ALT_mnt, X_mnt, Y_mnt,
|
||||||
// LST, EO, SPEED_X_mnt, SPEED_Y_mnt, PCM_X, PCM_Y, REFCORR,
|
// COO-PAIR_mnt, TIME-POINT_mnt, LST, EO, SPEED_X_mnt, SPEED_Y_mnt, PCM_X, PCM_Y, REFCORR, RA-ICRS_tag,
|
||||||
// RA-ICRS_tag, DEC-ICRS_tag, RA-APP_tag, DEC-APP_tag, HA_tag, AZ_tag, ZD_tag, ALT_tag, X_tag, Y_tag,
|
// DEC-ICRS_tag, RA-APP_tag, DEC-APP_tag, HA_tag, AZ_tag, ZD_tag, ALT_tag, X_tag, Y_tag, COO-PAIR_tag,
|
||||||
// COO-PAIR_tag, TIME-POINT_tag
|
// TIME-POINT_tag
|
||||||
|
|
||||||
eqhrz_ser.setFormat(_currentFormat);
|
eqhrz_ser.setFormat(_currentFormat);
|
||||||
eqhrz_ser.setPrecision(_currentPrec);
|
eqhrz_ser.setPrecision(_currentPrec);
|
||||||
@ -1147,9 +1153,11 @@ public:
|
|||||||
toSexagesimalDeg(bytes, value.speedX, value.speedY, value.pcmX, value.pcmY, value.refCorr);
|
toSexagesimalDeg(bytes, value.speedX, value.speedY, value.pcmX, value.pcmY, value.refCorr);
|
||||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||||
|
|
||||||
pt_ser.setFormat(_currentFormat);
|
// pt_ser.setFormat(_currentFormat);
|
||||||
pt_ser.setPrecision(_currentPrec);
|
// pt_ser.setPrecision(_currentPrec);
|
||||||
pt_ser(value.target, bytes);
|
// pt_ser(value.target, bytes);
|
||||||
|
|
||||||
|
eqhrz_ser(value.target, bytes);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1165,18 +1173,18 @@ public:
|
|||||||
// valid format: <mount data>, speedX, speedY, pcmX, pcmY, refCorr, <target data>
|
// valid format: <mount data>, speedX, speedY, pcmX, pcmY, refCorr, <target data>
|
||||||
|
|
||||||
auto els = splitToElements(std::forward<IR>(bytes));
|
auto els = splitToElements(std::forward<IR>(bytes));
|
||||||
if (els.size() < 29) {
|
if (els.size() < 31) {
|
||||||
// return std::make_error_code(std::errc::invalid_argument);
|
// return std::make_error_code(std::errc::invalid_argument);
|
||||||
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
MccTelemetryData tdata;
|
MccTelemetryData tdata;
|
||||||
auto err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[0].begin(), els[9].end()}, tdata);
|
auto err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[0].begin(), els[11].end()}, tdata);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t idx = 10;
|
size_t idx = 12;
|
||||||
|
|
||||||
err = parseHourRepr(els[idx++], tdata.LST);
|
err = parseHourRepr(els[idx++], tdata.LST);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -1213,7 +1221,8 @@ public:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = MccPointingTargetDeserializer{}(std::string_view{els[idx].begin(), els.back().end()}, tdata.target);
|
// err = MccPointingTargetDeserializer{}(std::string_view{els[idx].begin(), els.back().end()}, tdata.target);
|
||||||
|
err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[idx].begin(), els.back().end()}, tdata.target);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,6 +281,9 @@ static constexpr void mcc_copy_celestial_point(mcc_celestial_point_c auto const&
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_eqt_hrz_coord_c = mcc_celestial_point_c<T> && requires(T t) {
|
concept mcc_eqt_hrz_coord_c = mcc_celestial_point_c<T> && requires(T t) {
|
||||||
|
requires mcc_angle_c<decltype(t.RA_ICRS)>; // ICRS right ascention
|
||||||
|
requires mcc_angle_c<decltype(t.DEC_ICRS)>; // ICRS declination
|
||||||
|
|
||||||
requires mcc_angle_c<decltype(t.RA_APP)>; // right ascension
|
requires mcc_angle_c<decltype(t.RA_APP)>; // right ascension
|
||||||
requires mcc_angle_c<decltype(t.DEC_APP)>; // declination
|
requires mcc_angle_c<decltype(t.DEC_APP)>; // declination
|
||||||
requires mcc_angle_c<decltype(t.HA)>; // hour angle
|
requires mcc_angle_c<decltype(t.HA)>; // hour angle
|
||||||
@ -311,6 +314,9 @@ static constexpr void mcc_copy_eqt_hrz_coord(mcc_eqt_hrz_coord_c auto const& fro
|
|||||||
to_pt->X = (double)from_pt.X;
|
to_pt->X = (double)from_pt.X;
|
||||||
to_pt->Y = (double)from_pt.Y;
|
to_pt->Y = (double)from_pt.Y;
|
||||||
|
|
||||||
|
to_pt->RA_ICRS = (double)from_pt.RA_ICRS;
|
||||||
|
to_pt->DEC_ICRS = (double)from_pt.DEC_ICRS;
|
||||||
|
|
||||||
to_pt->RA_APP = (double)from_pt.RA_APP;
|
to_pt->RA_APP = (double)from_pt.RA_APP;
|
||||||
to_pt->DEC_APP = (double)from_pt.DEC_APP;
|
to_pt->DEC_APP = (double)from_pt.DEC_APP;
|
||||||
|
|
||||||
@ -582,47 +588,6 @@ concept mcc_hardware_c = requires(T t, const T t_const) {
|
|||||||
|
|
||||||
/* MOUNT TELEMETRY DATA CLASS CONCEPT */
|
/* MOUNT TELEMETRY DATA CLASS CONCEPT */
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
concept mcc_pointing_target_coord_c = mcc_eqt_hrz_coord_c<T> && requires(T t) {
|
|
||||||
requires mcc_angle_c<decltype(t.RA_ICRS)>; // ICRS right ascention
|
|
||||||
requires mcc_angle_c<decltype(t.DEC_ICRS)>; // ICRS declination
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr void mcc_copy_pointing_target_coord(mcc_pointing_target_coord_c auto const& from_pt,
|
|
||||||
mcc_pointing_target_coord_c auto* to_pt)
|
|
||||||
{
|
|
||||||
if (to_pt == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using from_pt_t = std::remove_cvref_t<decltype(from_pt)>;
|
|
||||||
using to_pt_t = std::remove_cvref_t<decltype(*to_pt)>;
|
|
||||||
|
|
||||||
if constexpr (std::derived_from<to_pt_t, from_pt_t> && std::copyable<to_pt_t>) {
|
|
||||||
*to_pt = from_pt;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
to_pt->pair_kind = from_pt.pair_kind;
|
|
||||||
to_pt->time_point =
|
|
||||||
std::chrono::time_point_cast<typename decltype(to_pt->time_point)::duration>(from_pt.time_point);
|
|
||||||
to_pt->X = (double)from_pt.X;
|
|
||||||
to_pt->Y = (double)from_pt.Y;
|
|
||||||
|
|
||||||
to_pt->RA_ICRS = (double)from_pt.RA_ICRS;
|
|
||||||
to_pt->DEC_ICRS = (double)from_pt.DEC_ICRS;
|
|
||||||
|
|
||||||
to_pt->RA_APP = (double)from_pt.RA_APP;
|
|
||||||
to_pt->DEC_APP = (double)from_pt.DEC_APP;
|
|
||||||
|
|
||||||
to_pt->HA = (double)from_pt.HA;
|
|
||||||
to_pt->AZ = (double)from_pt.AZ;
|
|
||||||
to_pt->ZD = (double)from_pt.ZD;
|
|
||||||
to_pt->ALT = (double)from_pt.ALT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept mcc_telemetry_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializable<T> && requires(T t) {
|
concept mcc_telemetry_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializable<T> && requires(T t) {
|
||||||
@ -630,7 +595,7 @@ concept mcc_telemetry_data_c = mcc_eqt_hrz_coord_c<T> && std::default_initializa
|
|||||||
requires mcc_celestial_point_c<decltype(t.entered_target)>;
|
requires mcc_celestial_point_c<decltype(t.entered_target)>;
|
||||||
|
|
||||||
// target target coordinates
|
// target target coordinates
|
||||||
requires mcc_pointing_target_coord_c<decltype(t.target)>;
|
requires mcc_eqt_hrz_coord_c<decltype(t.target)>;
|
||||||
|
|
||||||
// t.X and t.Y (from mcc_celestial_point_c) are encoder coordinates
|
// t.X and t.Y (from mcc_celestial_point_c) are encoder coordinates
|
||||||
// t.* from mcc_eqt_hrz_coord_c are apparent mount pointing coordinates
|
// t.* from mcc_eqt_hrz_coord_c are apparent mount pointing coordinates
|
||||||
@ -673,6 +638,9 @@ static constexpr void mcc_copy_telemetry_data(mcc_telemetry_data_c auto const& f
|
|||||||
to_pt->speedX = (double)from_pt.speedX;
|
to_pt->speedX = (double)from_pt.speedX;
|
||||||
to_pt->speedY = (double)from_pt.speedY;
|
to_pt->speedY = (double)from_pt.speedY;
|
||||||
|
|
||||||
|
to_pt->RA_ICRS = (double)from_pt.RA_ICRS;
|
||||||
|
to_pt->DEC_ICRS = (double)from_pt.DEC_ICRS;
|
||||||
|
|
||||||
to_pt->RA_APP = (double)from_pt.RA_APP;
|
to_pt->RA_APP = (double)from_pt.RA_APP;
|
||||||
to_pt->DEC_APP = (double)from_pt.DEC_APP;
|
to_pt->DEC_APP = (double)from_pt.DEC_APP;
|
||||||
|
|
||||||
@ -686,7 +654,9 @@ static constexpr void mcc_copy_telemetry_data(mcc_telemetry_data_c auto const& f
|
|||||||
|
|
||||||
to_pt->refCorr = (double)from_pt.refCorr;
|
to_pt->refCorr = (double)from_pt.refCorr;
|
||||||
|
|
||||||
mcc_copy_pointing_target_coord(from_pt.target, &to_pt->target);
|
mcc_copy_eqt_hrz_coord(from_pt.target, &to_pt->target);
|
||||||
|
|
||||||
|
mcc_copy_celestial_point(from_pt.entered_target, &to_pt->entered_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
#include <future>
|
#include <future>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <stop_token>
|
#include <stop_token>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include "mcc_defaults.h"
|
#include "mcc_defaults.h"
|
||||||
|
|
||||||
@ -181,12 +180,14 @@ public:
|
|||||||
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_data.entered_target.pair_kind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
// if (_data.entered_target.pair_kind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||||
_data.target.RA_ICRS = _data.entered_target.X;
|
// _data.target.RA_ICRS = _data.entered_target.X;
|
||||||
_data.target.DEC_ICRS = _data.entered_target.Y;
|
// _data.target.DEC_ICRS = _data.entered_target.Y;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return MccTelemetryErrorCode::ERROR_OK;
|
||||||
|
|
||||||
if (stop_token.stop_requested()) {
|
if (stop_token.stop_requested()) {
|
||||||
return MccTelemetryErrorCode::ERROR_UPDATE_STOPPED;
|
return MccTelemetryErrorCode::ERROR_UPDATE_STOPPED;
|
||||||
}
|
}
|
||||||
@ -232,8 +233,7 @@ public:
|
|||||||
|
|
||||||
double eo;
|
double eo;
|
||||||
|
|
||||||
_data.time_point =
|
mcc_tp2tp(hw_pos.time_point, hw_pos.time_point);
|
||||||
std::chrono::time_point_cast<typename decltype(_data.time_point)::duration>(hw_pos.time_point);
|
|
||||||
|
|
||||||
auto ccte_err = controls->timepointToJulday(_data.time_point, &_data.JD);
|
auto ccte_err = controls->timepointToJulday(_data.time_point, &_data.JD);
|
||||||
if (!ccte_err) {
|
if (!ccte_err) {
|
||||||
@ -261,6 +261,40 @@ public:
|
|||||||
_data.speedX = (double)hw_pos.speedX;
|
_data.speedX = (double)hw_pos.speedX;
|
||||||
_data.speedY = (double)hw_pos.speedY;
|
_data.speedY = (double)hw_pos.speedY;
|
||||||
|
|
||||||
|
// 2025.12.18: according to addition RA/DEC_ICRS to mcc_eqt_hrz_coord_c ...
|
||||||
|
|
||||||
|
MccCelestialPoint pt;
|
||||||
|
mcc_tp2tp(_data.time_point, pt.time_point);
|
||||||
|
|
||||||
|
auto pcm_err = controls->computePCM(_data, &_data, &pt);
|
||||||
|
if (pcm_err) {
|
||||||
|
return mcc_deduce_error_code(pcm_err, MccTelemetryErrorCode::ERROR_PCM_COMP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (mccIsEquatorialMount(pcm_t::mountType)) {
|
||||||
|
pt.pair_kind = MccCoordPairKind::COORDS_KIND_HADEC_APP;
|
||||||
|
_data.pair_kind = MccCoordPairKind::COORDS_KIND_HADEC_APP;
|
||||||
|
} else if constexpr (mccIsAltAzMount(pcm_t::mountType)) {
|
||||||
|
pt.pair_kind = MccCoordPairKind::COORDS_KIND_AZALT;
|
||||||
|
_data.pair_kind = MccCoordPairKind::COORDS_KIND_AZALT;
|
||||||
|
} else {
|
||||||
|
static_assert(false, "UNKNOWN MOUNT TYPE!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ccte_err = controls->transformCoordinates(pt, &_data);
|
||||||
|
if (!ccte_err) {
|
||||||
|
ccte_err = controls->refractionCorrection(_data, &_data.refCorr);
|
||||||
|
if (!ccte_err) {
|
||||||
|
return _updateTargetFunc(stop_token);
|
||||||
|
} else {
|
||||||
|
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
// fill _data.pcmX, _data.pcmY and corresponded apparent coordinates
|
// fill _data.pcmX, _data.pcmY and corresponded apparent coordinates
|
||||||
auto pcm_err = controls->computePCM(_data, &_data, &_data);
|
auto pcm_err = controls->computePCM(_data, &_data, &_data);
|
||||||
if (pcm_err) {
|
if (pcm_err) {
|
||||||
@ -276,8 +310,7 @@ public:
|
|||||||
if constexpr (mccIsEquatorialMount(pcm_t::mountType)) {
|
if constexpr (mccIsEquatorialMount(pcm_t::mountType)) {
|
||||||
// NOTE: now it are OBSERVED (NOT APPARENT) RA, HA, DEC!!!
|
// NOTE: now it are OBSERVED (NOT APPARENT) RA, HA, DEC!!!
|
||||||
_data.RA_APP =
|
_data.RA_APP =
|
||||||
MccAngle((double)_data.LST - (double)_data.HA - eo).normalize<MccAngle::NORM_KIND_0_360>();
|
MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
|
||||||
// MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
|
|
||||||
|
|
||||||
_data.X = _data.HA;
|
_data.X = _data.HA;
|
||||||
_data.Y = _data.DEC_APP;
|
_data.Y = _data.DEC_APP;
|
||||||
@ -304,8 +337,7 @@ public:
|
|||||||
_data.HA = pt.X;
|
_data.HA = pt.X;
|
||||||
_data.DEC_APP = pt.Y;
|
_data.DEC_APP = pt.Y;
|
||||||
_data.RA_APP =
|
_data.RA_APP =
|
||||||
MccAngle((double)_data.LST - (double)_data.HA - eo).normalize<MccAngle::NORM_KIND_0_360>();
|
MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
|
||||||
// MccAngle((double)_data.LST - (double)_data.HA + eo).normalize<MccAngle::NORM_KIND_0_360>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -367,6 +399,8 @@ public:
|
|||||||
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
return mcc_deduce_error_code(ccte_err, MccTelemetryErrorCode::ERROR_COORD_TRANSFORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
return MccTelemetryErrorCode::ERROR_OK;
|
return MccTelemetryErrorCode::ERROR_OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -741,4 +775,5 @@ protected:
|
|||||||
|
|
||||||
static_assert(mcc_telemetry_c<MccTelemetry>, "");
|
static_assert(mcc_telemetry_c<MccTelemetry>, "");
|
||||||
|
|
||||||
|
|
||||||
} // namespace mcc
|
} // namespace mcc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user