...
This commit is contained in:
@@ -441,23 +441,12 @@ struct MccGenericEqtHrzCoords : MccGenericCelestialPoint<CoordT> {
|
||||
|
||||
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;
|
||||
|
||||
|
||||
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>
|
||||
struct MccGenericPCMResult {
|
||||
@@ -479,7 +468,7 @@ struct MccGenericTelemetryData : MccGenericEqtHrzCoords<CoordT> {
|
||||
|
||||
MccGenericCelestialPoint<coord_t> entered_target{};
|
||||
|
||||
MccGenericPointingTarget<coord_t> target{};
|
||||
MccGenericEqtHrzCoords<coord_t> target{};
|
||||
|
||||
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_celestial_point_c<MccCelestialPoint>, "");
|
||||
static_assert(mcc_pointing_target_coord_c<MccGenericPointingTarget<double>>, "");
|
||||
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>
|
||||
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
|
||||
// according to value.pair_kind field
|
||||
|
||||
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) {
|
||||
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);
|
||||
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>
|
||||
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
|
||||
// according to value.pair_kind field
|
||||
|
||||
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 MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||
}
|
||||
|
||||
MccEqtHrzCoords pt;
|
||||
pt.pair_kind = MccCoordStrToPairKind(els[8]);
|
||||
pt.pair_kind = MccCoordStrToPairKind(els[10]);
|
||||
if (pt.pair_kind == MccCoordPairKind::COORDS_KIND_UNKNOWN) {
|
||||
// return std::make_error_code(std::errc::invalid_argument);
|
||||
return MccCoordinateConvErrorCode::ERROR_INVALID_CPAIR;
|
||||
}
|
||||
|
||||
auto err = parseTimePoint(els[9], pt);
|
||||
auto err = parseTimePoint(els[11], pt);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseHourRepr(els[0], pt.RA_APP);
|
||||
size_t idx = 0;
|
||||
err = parseHourRepr(els[idx++], pt.RA_ICRS);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseDegreeRepr(els[1], pt.DEC_APP);
|
||||
err = parseDegreeRepr(els[idx++], pt.DEC_ICRS);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseHourRepr(els[2], pt.HA);
|
||||
err = parseHourRepr(els[idx++], pt.RA_APP);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseDegreeRepr(els[4], pt.AZ);
|
||||
err = parseDegreeRepr(els[idx++], pt.DEC_APP);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseDegreeRepr(els[5], pt.ZD);
|
||||
err = parseHourRepr(els[idx++], pt.HA);
|
||||
if (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) {
|
||||
return err;
|
||||
}
|
||||
@@ -1023,16 +1029,16 @@ public:
|
||||
case MccCoordPairKind::COORDS_KIND_RADEC_ICRS:
|
||||
case MccCoordPairKind::COORDS_KIND_RADEC_APP:
|
||||
case MccCoordPairKind::COORDS_KIND_HADEC_APP:
|
||||
err = parseHourRepr(els[7], pt.X);
|
||||
err = parseHourRepr(els[idx++], pt.X);
|
||||
break;
|
||||
default:
|
||||
err = parseDegreeRepr(els[7], pt.X);
|
||||
err = parseDegreeRepr(els[idx++], pt.X);
|
||||
}
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = parseDegreeRepr(els[8], pt.Y);
|
||||
err = parseDegreeRepr(els[idx++], pt.Y);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
@@ -1045,74 +1051,74 @@ public:
|
||||
|
||||
|
||||
|
||||
class MccPointingTargetSerializer : public MccCoordinateSerializer
|
||||
{
|
||||
public:
|
||||
template <mcc_pointing_target_coord_c T, traits::mcc_output_char_range OR>
|
||||
void operator()(const T& value, OR& bytes)
|
||||
{
|
||||
static MccEqtHrzCoordsSerializer eqhrz_ser;
|
||||
// class MccPointingTargetSerializer : public MccCoordinateSerializer
|
||||
// {
|
||||
// public:
|
||||
// template <mcc_pointing_target_coord_c T, traits::mcc_output_char_range OR>
|
||||
// void operator()(const T& value, OR& bytes)
|
||||
// {
|
||||
// static MccEqtHrzCoordsSerializer eqhrz_ser;
|
||||
|
||||
// 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
|
||||
// according to value.pair_kind field
|
||||
// // 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
|
||||
// // according to value.pair_kind field
|
||||
|
||||
if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
||||
toDegrees(bytes, value.RA_ICRS, value.DEC_ICRS);
|
||||
} else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
||||
toSexagesimalHour(bytes, value.RA_ICRS);
|
||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||
// if (_currentFormat == SerializedCoordFormat::CFMT_DEGREES) {
|
||||
// toDegrees(bytes, value.RA_ICRS, value.DEC_ICRS);
|
||||
// } else if (_currentFormat == SerializedCoordFormat::CFMT_SGM) {
|
||||
// toSexagesimalHour(bytes, value.RA_ICRS);
|
||||
// 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.setPrecision(_currentPrec);
|
||||
eqhrz_ser(value, bytes);
|
||||
// eqhrz_ser.setFormat(_currentFormat);
|
||||
// eqhrz_ser.setPrecision(_currentPrec);
|
||||
// eqhrz_ser(value, bytes);
|
||||
|
||||
// MccEqtHrzCoordsSerializer{}(value, bytes);
|
||||
}
|
||||
};
|
||||
// // MccEqtHrzCoordsSerializer{}(value, bytes);
|
||||
// }
|
||||
// };
|
||||
|
||||
class MccPointingTargetDeserializer : public MccCoordinateDeserializer
|
||||
{
|
||||
public:
|
||||
template <traits::mcc_input_char_range IR, mcc_pointing_target_coord_c T>
|
||||
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
|
||||
// in the case of sexagesimal input the X,Y coordinates will be interpretated
|
||||
// according to value.pair_kind field
|
||||
// class MccPointingTargetDeserializer : public MccCoordinateDeserializer
|
||||
// {
|
||||
// public:
|
||||
// template <traits::mcc_input_char_range IR, mcc_pointing_target_coord_c T>
|
||||
// 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
|
||||
// // in the case of sexagesimal input the X,Y coordinates will be interpretated
|
||||
// // according to value.pair_kind field
|
||||
|
||||
auto els = splitToElements(std::forward<IR>(bytes));
|
||||
if (els.size() < 12) {
|
||||
// return std::make_error_code(std::errc::invalid_argument);
|
||||
return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||
}
|
||||
// auto els = splitToElements(std::forward<IR>(bytes));
|
||||
// if (els.size() < 12) {
|
||||
// // return std::make_error_code(std::errc::invalid_argument);
|
||||
// return MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||
// }
|
||||
|
||||
MccPointingTarget pt;
|
||||
auto err = parseHourRepr(els[0], pt.RA_ICRS);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
// MccPointingTarget pt;
|
||||
// auto err = parseHourRepr(els[0], pt.RA_ICRS);
|
||||
// if (err) {
|
||||
// return err;
|
||||
// }
|
||||
|
||||
err = parseDegreeRepr(els[1], pt.DEC_ICRS);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
// err = parseDegreeRepr(els[1], pt.DEC_ICRS);
|
||||
// if (err) {
|
||||
// return err;
|
||||
// }
|
||||
|
||||
err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[2].begin(), els[11].end()}, pt);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
// err = MccEqtHrzCoordsDeserializer{}(std::string_view{els[2].begin(), els[11].end()}, pt);
|
||||
// if (err) {
|
||||
// return err;
|
||||
// }
|
||||
|
||||
mcc_copy_pointing_target_coord(pt, &value);
|
||||
// mcc_copy_pointing_target_coord(pt, &value);
|
||||
|
||||
return {};
|
||||
}
|
||||
};
|
||||
// return {};
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
class MccTelemetryDataSerializer : public MccCoordinateSerializer
|
||||
@@ -1122,13 +1128,13 @@ public:
|
||||
void operator()(const T& value, OR& bytes)
|
||||
{
|
||||
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>
|
||||
// RA-APP_mnt, DEC-APP_mnt, HA_mnt, AZ_mnt, ZD_mnt, ALT_mnt, X_mnt, Y_mnt, COO-PAIR_mnt, TIME-POINT_mnt,
|
||||
// LST, EO, SPEED_X_mnt, SPEED_Y_mnt, PCM_X, PCM_Y, REFCORR,
|
||||
// RA-ICRS_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, TIME-POINT_tag
|
||||
// RA-ICRS_mnt, DEC-ICRS_mnt, RA-APP_mnt, DEC-APP_mnt, HA_mnt, AZ_mnt, ZD_mnt, ALT_mnt, X_mnt, Y_mnt,
|
||||
// COO-PAIR_mnt, TIME-POINT_mnt, LST, EO, SPEED_X_mnt, SPEED_Y_mnt, PCM_X, PCM_Y, REFCORR, RA-ICRS_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,
|
||||
// TIME-POINT_tag
|
||||
|
||||
eqhrz_ser.setFormat(_currentFormat);
|
||||
eqhrz_ser.setPrecision(_currentPrec);
|
||||
@@ -1147,9 +1153,11 @@ public:
|
||||
toSexagesimalDeg(bytes, value.speedX, value.speedY, value.pcmX, value.pcmY, value.refCorr);
|
||||
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
|
||||
|
||||
pt_ser.setFormat(_currentFormat);
|
||||
pt_ser.setPrecision(_currentPrec);
|
||||
pt_ser(value.target, bytes);
|
||||
// pt_ser.setFormat(_currentFormat);
|
||||
// pt_ser.setPrecision(_currentPrec);
|
||||
// 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>
|
||||
|
||||
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 MccCoordinateConvErrorCode::ERROR_ARG_LEN;
|
||||
}
|
||||
|
||||
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) {
|
||||
return err;
|
||||
}
|
||||
|
||||
size_t idx = 10;
|
||||
size_t idx = 12;
|
||||
|
||||
err = parseHourRepr(els[idx++], tdata.LST);
|
||||
if (err) {
|
||||
@@ -1213,7 +1221,8 @@ public:
|
||||
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) {
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user