...
This commit is contained in:
@@ -84,7 +84,9 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
|
||||
" Thus the array length must be equal to or greater than 2!"}),
|
||||
|
||||
// PCM B-spline coeffs for along X-axis (HA-angle or azimuth)
|
||||
make_config_record("pcmBsplineXcoeffs", std::vector<double>{}, {"PCM B-spline coeffs for along X-axis (HA-angle)"}),
|
||||
make_config_record("pcmBsplineXcoeffs",
|
||||
std::vector<double>{},
|
||||
{" PCM B-spline coeffs for along X-axis (HA-angle)"}),
|
||||
|
||||
// PCM B-spline coeffs for along Y-axis (declination or zenithal distance)
|
||||
make_config_record("pcmBsplineYcoeffs",
|
||||
@@ -146,7 +148,8 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
|
||||
make_config_record("EncoderDevSpeed", 153000, {" encoders serial device speed"}),
|
||||
|
||||
// ==1 if encoder works as separate serial device, ==2 if there's new version with two devices
|
||||
make_config_record("SepEncoder",
|
||||
make_config_record(
|
||||
"SepEncoder",
|
||||
2,
|
||||
{" ==1 if encoder works as separate serial device, ==2 if there's new version with two devices"}),
|
||||
|
||||
@@ -177,14 +180,14 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
|
||||
|
||||
|
||||
|
||||
// X-axis coordinate PID P,I,D-params
|
||||
make_config_record("XPIDC", std::vector<double>{0.5, 0.1, 0.2}, {"X-axis coordinate PID P,I,D-params"}),
|
||||
// // X-axis coordinate PID P,I,D-params
|
||||
// make_config_record("XPIDC", std::vector<double>{0.5, 0.1, 0.2}, {" X-axis coordinate PID P,I,D-params"}),
|
||||
|
||||
// X-axis rate PID P,I,D-params
|
||||
make_config_record("XPIDV", std::vector<double>{0.09, 0.0, 0.05}, {" X-axis rate PID P,I,D-params"}),
|
||||
|
||||
// Y-axis coordinate PID P, I, D-params
|
||||
make_config_record("YPIDC", std::vector<double>{0.5, 0.1, 0.2}, {"Y-axis coordinate PID P, I, D-params"}),
|
||||
// // Y-axis coordinate PID P, I, D-params
|
||||
// make_config_record("YPIDC", std::vector<double>{0.5, 0.1, 0.2}, {" Y-axis coordinate PID P, I, D-params"}),
|
||||
|
||||
// Y-axis rate PID P,I,D-params
|
||||
make_config_record("YPIDV", std::vector<double>{0.09, 0.0, 0.05}, {" Y-axis rate PID P,I,D-params"}),
|
||||
@@ -216,7 +219,58 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
|
||||
|
||||
make_config_record("XEncZero", (int64_t)0, {" X-axis encoder zero-point in ticks"}),
|
||||
|
||||
make_config_record("YEncZero", (int64_t)0, {"Y-axis encoder zero-point in ticks"})
|
||||
make_config_record("YEncZero", (int64_t)0, {" Y-axis encoder zero-point in ticks"}),
|
||||
|
||||
|
||||
/* movement related common parameters */
|
||||
|
||||
// timeout for telemetry updating in milliseconds
|
||||
make_config_record("telemetryTimeout",
|
||||
std::chrono::milliseconds(3000),
|
||||
{" timeout for telemetry updating in milliseconds"}),
|
||||
|
||||
// mount stopping process timeout in seconds
|
||||
make_config_record("stopTimeout", std::chrono::seconds(30), {" mount stopping process timeout in seconds"}),
|
||||
|
||||
// minimal allowed time in seconds to prohibited zone
|
||||
make_config_record("minTimeToPZone",
|
||||
std::chrono::seconds(10),
|
||||
{" minimal allowed time in seconds to prohibited zone"}),
|
||||
|
||||
/* slewing and tracking parameters */
|
||||
|
||||
// telemetry request interval (in millisecs) in slewing mode
|
||||
make_config_record("slewingTelemetryInterval",
|
||||
std::chrono::milliseconds(100),
|
||||
{" telemetry request interval (in millisecs) in slewing mode"}),
|
||||
|
||||
|
||||
// slew process timeout in seconds
|
||||
make_config_record("slewTimeout", std::chrono::seconds(3600), {" slew process timeout in seconds"}),
|
||||
|
||||
// slewing trajectory filename (used for debugging purposes)
|
||||
// if it is an empty - just skip saving
|
||||
make_config_record("slewingPathFilename",
|
||||
std::string(),
|
||||
{" slewing trajectory filename", "if it is an empty - just skip saving"}),
|
||||
|
||||
|
||||
make_config_record("trackingTelemetryInterval",
|
||||
std::chrono::milliseconds(100),
|
||||
{" telemetry request interval (in millisecs) in tracking mode"}),
|
||||
|
||||
|
||||
// maximal valid target-to-mount distance for tracking process (arcsecs)
|
||||
// if current distance is greater than assume current mount coordinate as target point
|
||||
make_config_record("trackingMaxCoordDiff",
|
||||
20.0,
|
||||
{" maximal valid target-to-mount distance for tracking process (arcsecs)",
|
||||
" if current distance is greater than assume current mount coordinate as target point"}),
|
||||
|
||||
make_config_record("trackingPathFilename",
|
||||
std::string(),
|
||||
{" tracking trajectory filename", "if it is an empty - just skip saving"})
|
||||
|
||||
|
||||
);
|
||||
|
||||
@@ -403,6 +457,47 @@ public:
|
||||
return save(_lastConfigPath);
|
||||
}
|
||||
|
||||
std::error_code dumpDefaultsToFile(const std::filesystem::path& path)
|
||||
{
|
||||
std::error_code ec{};
|
||||
std::string output_buffer;
|
||||
|
||||
auto write_rec = [&output_buffer, &ec, this]<size_t I = 0>(this auto& self) {
|
||||
if constexpr (I < NUMBER_OF_RECORDS) {
|
||||
// add an empty string within records
|
||||
std::format_to(std::back_inserter(output_buffer), "{}", DEFAULT_RECORD_DELIMITER);
|
||||
|
||||
ec = formatRecord<I>(output_buffer, DEFAULT_RECORD_DELIMITER, true);
|
||||
if (ec) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
self.template operator()<I + 1>();
|
||||
}
|
||||
};
|
||||
|
||||
write_rec();
|
||||
if (!ec) {
|
||||
std::ofstream fst(path, std::ios_base::trunc);
|
||||
if (!fst.is_open()) {
|
||||
ec = std::make_error_code(std::errc::io_error);
|
||||
} else {
|
||||
try {
|
||||
fst << generateHeader();
|
||||
fst << output_buffer;
|
||||
} catch (std::ios_base::failure const& ex) {
|
||||
ec = ex.code();
|
||||
} catch (...) {
|
||||
ec = std::make_error_code(std::errc::operation_canceled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
||||
std::filesystem::path configFilename() const
|
||||
{
|
||||
return _lastConfigPath;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <mcc/mcc_coordinate.h>
|
||||
#include <mcc/mcc_pcm_fit.h>
|
||||
|
||||
#include "asibfm700_config.h"
|
||||
#include "asibfm700_configfile.h"
|
||||
|
||||
// static constexpr mcc::MccMountType MOUNT_TYPE{mcc::MccMountType::CROSSAXIS_TYPE};
|
||||
@@ -37,6 +38,9 @@ int main(int argc, char* argv[])
|
||||
mcc::impl::MccPCMFitter<asibfm700::asibfm700MountType>::compute_params_t comp_pars;
|
||||
|
||||
asibfm700::Asibfm700MountConfig mount_cfg;
|
||||
asibfm700::Asibfm700MountConfiguration cfg;
|
||||
|
||||
cfg.dumpDefaultsToFile("eecc.cfg");
|
||||
|
||||
try {
|
||||
auto opt_result = options.parse(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user