... compiled!
This commit is contained in:
parent
620f8ba136
commit
85259fc6ad
@ -2,16 +2,18 @@ cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
|
||||
#**********************************************
|
||||
# Astrosib(c) BM-700 mount control software *
|
||||
# Astrosib(c) FM-700 mount control software *
|
||||
#**********************************************
|
||||
|
||||
project(ASIB_BM700 LANGUAGES C CXX)
|
||||
project(ASIB_FM700 LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
#
|
||||
# ******* C++ PART OF THE PROJECT *******
|
||||
|
||||
set(EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(LibSidServo)
|
||||
# add_subdirectory(cxx)
|
||||
add_subdirectory(mcc)
|
||||
add_subdirectory(asibfm700)
|
||||
|
||||
@ -65,12 +65,12 @@ add_library(${ASIBFM700_LIB} STATIC ${ASIBFM700_LIB_SRC}
|
||||
)
|
||||
|
||||
target_include_directories(${ASIBFM700_LIB} PUBLIC mcc spdlog ${ERFA_INCLUDE_DIR})
|
||||
target_link_libraries(${ASIBFM700_LIB} mcc spdlog ${ERFA_LIBFILE})
|
||||
# target_link_libraries(${ASIBFM700_LIB} PUBLIC mcc spdlog ${ERFA_LIBFILE})
|
||||
target_link_libraries(${ASIBFM700_LIB} PUBLIC mcc spdlog ERFA_LIB bsplines sidservo)
|
||||
|
||||
|
||||
set(ASIBFM700_NETSERVER_APP asibfm700_netserver)
|
||||
add_executable(${ASIBFM700_NETSERVER_APP} asibfm700_netserver_main.cpp)
|
||||
# target_include_directories(${ASIBFM700_NETSERVER_APP} PRIVATE mcc spdlog)
|
||||
target_link_libraries(${ASIBFM700_NETSERVER_APP} PRIVATE mcc spdlog ${ASIBFM700_LIB})
|
||||
|
||||
option(WITH_TESTS "Build tests" ON)
|
||||
|
||||
@ -208,6 +208,177 @@ static auto Asibfm700MountConfigDefaults = std::make_tuple(
|
||||
);
|
||||
|
||||
|
||||
static constexpr std::string_view Asibfm700MountDefaultConfigString =
|
||||
R"--(
|
||||
#
|
||||
# ASTROSIB FM-700 MOUNT DEFAULT CONFIGURATION
|
||||
#
|
||||
# (created 2025-10-01T03:00:00.0)
|
||||
#
|
||||
|
||||
# main cycle period in millisecs
|
||||
hardwarePollingPeriod = 100
|
||||
|
||||
# geographic coordinates of the observation site
|
||||
|
||||
# site latitude in degrees
|
||||
siteLatitude = 43.646711
|
||||
|
||||
# site longitude in degrees
|
||||
siteLongitude = 41.440732
|
||||
|
||||
# site elevation in meters
|
||||
siteElevation = 2070.0
|
||||
|
||||
# celestial coordinate transformation
|
||||
|
||||
# wavelength at which refraction is calculated (in mkm)
|
||||
refractWavelength = 0.5
|
||||
|
||||
# an empty filename means default precompiled string
|
||||
leapSecondFilename =
|
||||
|
||||
# an empty filename means default precompiled string
|
||||
bulletinAFilename =
|
||||
|
||||
# pointing correction model
|
||||
|
||||
# PCM default type:
|
||||
# GEOMETRY - "classic" geometry-based correction coefficients
|
||||
# GEOMETRY-BSPLINE - previous one and additional 2D B-spline corrections
|
||||
# BSPLINE - pure 2D B-spline corrections
|
||||
pcmType = GEOMETRY
|
||||
|
||||
# PCM geometrical coefficients
|
||||
pcmGeomCoeffs = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
|
||||
|
||||
# PCM B-spline degrees
|
||||
pcmBsplineDegree = 3, 3
|
||||
|
||||
# PCM B-spline knots along X-axis (HA-angle). By default from 0 to 2*PI radians
|
||||
pcmBsplineXknots = 0.0, 0.6981317, 1.3962634, 2.0943951, 2.7925268, 3.4906585, 4.1887902, 4.88692191, 5.58505361, 6.28318531
|
||||
|
||||
# PCM B-spline knots along Y-axis (declination-angle). By default from -PI/6 to PI/2 radians
|
||||
pcmBsplineYknots = -0.52359878, -0.29088821, -0.05817764, 0.17453293, 0.40724349, 0.63995406, 0.87266463, 1.10537519, 1.33808576, 1.57079633
|
||||
|
||||
# PCM B-spline coeffs for along X-axis (HA-angle)
|
||||
pcmBsplineXcoeffs =
|
||||
|
||||
# PCM B-spline coeffs for along Y-axis (declination-angle)
|
||||
pcmBsplineYcoeffs =
|
||||
|
||||
|
||||
# slewing and tracking parameters
|
||||
|
||||
# arcseconds per second
|
||||
#sideralRate = 15.0410686
|
||||
|
||||
# timeout for telemetry updating in milliseconds
|
||||
telemetryTimeout = 3000
|
||||
|
||||
# minimal allowed time in seconds to prohibited zone
|
||||
minTimeToPZone = 10
|
||||
|
||||
# a time interval to update prohibited zones related quantities (millisecs)
|
||||
updatingPZoneInterval = 5000
|
||||
|
||||
# coordinates difference in arcsecs to stop slewing
|
||||
slewToleranceRadius = 5.0
|
||||
|
||||
# target-mount coordinate difference in arcsecs to start adjusting of slewing
|
||||
adjustCoordDiff = 50.0
|
||||
|
||||
# minimum time in millisecs between two successive adjustments
|
||||
adjustCycleInterval = 300
|
||||
|
||||
# slew process timeout in seconds
|
||||
slewTimeout = 3600
|
||||
|
||||
# a time shift into future to compute target position in future (UT1-scale time duration, millisecs)
|
||||
timeShiftToTargetPoint = 10000
|
||||
|
||||
# minimum time in millisecs between two successive tracking corrections
|
||||
trackingCycleInterval = 300
|
||||
|
||||
# maximal valid target-to-mount distance for tracking process (arcsecs)
|
||||
# if current distance is greater than assume current mount coordinate as target point
|
||||
trackingMaxCoordDiff = 20.0
|
||||
|
||||
# prohibited zones
|
||||
|
||||
# minimal altitude in degrees
|
||||
pzMinAltitude = 10.0
|
||||
|
||||
# HA-axis limit switch minimal value in degrees
|
||||
pzLimitSwitchHAMin = -170.0
|
||||
|
||||
# HA-axis limit switch maximal value in degrees
|
||||
pzLimitSwitchHAMax = 170.0
|
||||
|
||||
# DEC-axis limit switch minimal value in degrees
|
||||
pzLimitSwitchDecMin = -90.0
|
||||
|
||||
# DEC-axis limit switch maximal value in degrees
|
||||
pzLimitSwitchDecMax = 90.0
|
||||
|
||||
|
||||
# hardware-related
|
||||
|
||||
# hardware mode: 1 - model mode, otherwise real mode
|
||||
RunModel = 0
|
||||
|
||||
# mount serial device paths
|
||||
MountDevPath = /dev/ttyUSB0
|
||||
|
||||
# mount serial device speed
|
||||
MountDevSpeed = 19200
|
||||
|
||||
# motor encoders serial device path
|
||||
EncoderDevPath =
|
||||
|
||||
# X-axis encoder serial device path
|
||||
EncoderXDevPath = /dev/encoderX0
|
||||
|
||||
# Y-axis encoder serial device path
|
||||
EncoderYDevPath = /dev/encoderY0
|
||||
|
||||
# encoders serial device speed
|
||||
EncoderDevSpeed = 153000
|
||||
|
||||
# ==1 if encoder works as separate serial device, ==2 if there's new version with two devices
|
||||
SepEncoder = 2
|
||||
|
||||
# mount polling interval in millisecs
|
||||
MountReqInterval = 100
|
||||
|
||||
# encoders polling interval in millisecs
|
||||
EncoderReqInterval = 50
|
||||
|
||||
# mount axes rate calculation interval in millisecs
|
||||
EncoderSpeedInterval = 100
|
||||
|
||||
# X-axis coordinate PID P,I,D-params
|
||||
XPIDC = 0.8, 0.1, 0.3
|
||||
|
||||
# X-axis rate PID P,I,D-params
|
||||
XPIDV = 1.0, 0.01, 0.2
|
||||
|
||||
# Y-axis coordinate PID P,I,D-params
|
||||
YPIDC = 0.8, 0.1, 0.3
|
||||
|
||||
# Y-axis rate PID P,I,D-params
|
||||
YPIDV = 0.5, 0.2, 0.5
|
||||
|
||||
|
||||
# maximal moving rate (degrees per second) along HA-axis (Y-axis of Sidereal servo microcontroller)
|
||||
hwMaxRateHA = 8.0
|
||||
|
||||
# maximal moving rate (degrees per second) along DEC-axis (X-axis of Sidereal servo microcontroller)
|
||||
hwMaxRateDEC = 10.0
|
||||
|
||||
)--";
|
||||
|
||||
|
||||
|
||||
class Asibfm700MountConfig : public mcc::utils::KeyValueHolder<decltype(Asibfm700MountConfigDefaults)>
|
||||
{
|
||||
@ -227,14 +398,14 @@ protected:
|
||||
} else if constexpr (std::same_as<VT, mcc::MccAngle>) { // assume here all angles are in degrees
|
||||
double vd;
|
||||
// ec = base_t::defaultDeserializeFunc(str, vd);
|
||||
ec = deser(str, value);
|
||||
ec = deser(str, vd);
|
||||
if (!ec) {
|
||||
value = mcc::MccAngle(vd, mcc::MccDegreeTag{});
|
||||
}
|
||||
} else if constexpr (std::same_as<VT, mcc::MccDefaultPCMType>) {
|
||||
std::string vstr;
|
||||
// ec = base_t::defaultDeserializeFunc(str, vstr);
|
||||
ec = deser(str, value);
|
||||
ec = deser(str, vstr);
|
||||
|
||||
if (!ec) {
|
||||
auto s = mcc::utils::trimSpaces(vstr);
|
||||
@ -620,172 +791,22 @@ public:
|
||||
|
||||
return ec;
|
||||
}
|
||||
|
||||
// dump default values to file
|
||||
static bool dumpDefaults(const std::filesystem::path& path)
|
||||
{
|
||||
std::ofstream fst(path);
|
||||
if (!fst.is_open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fst << asibfm700::Asibfm700MountDefaultConfigString;
|
||||
fst.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static constexpr std::string_view Asibfm700MountConfigString =
|
||||
R"--(
|
||||
#
|
||||
# ASTROSIB FM-700 MOUNT DEFAULT CONFIGURATION
|
||||
#
|
||||
# (created 2025-10-01T03:00:00.0)
|
||||
#
|
||||
|
||||
# main cycle period
|
||||
hardwarePollingPeriod = 100
|
||||
|
||||
# geographic coordinates of the observation site
|
||||
|
||||
# site latitude in degrees
|
||||
siteLatitude = 43.646711
|
||||
|
||||
# site longitude in degrees
|
||||
siteLongitude = 41.440732
|
||||
|
||||
# site elevation in meters
|
||||
siteElevation = 2070.0
|
||||
|
||||
# celestial coordinate transformation
|
||||
|
||||
# wavelength at which refraction is calculated (in mkm)
|
||||
refractWavelength = 0.5
|
||||
|
||||
# an empty filename means default precompiled string
|
||||
leapSecondFilename =
|
||||
|
||||
# an empty filename means default precompiled string
|
||||
bulletinAFilename =
|
||||
|
||||
# pointing correction model
|
||||
|
||||
# PCM default type
|
||||
pcmType = GEOMETRY
|
||||
|
||||
# PCM geometrical coefficients
|
||||
pcmGeomCoeffs = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
|
||||
|
||||
# PCM B-spline degrees
|
||||
pcmBsplineDegree = 3, 3
|
||||
|
||||
# PCM B-spline knots along X-axis (HA-angle or azimuth). By default from 0 to 2*PI radians
|
||||
pcmBsplineXknots = 0.0, 0.6981317, 1.3962634, 2.0943951, 2.7925268, 3.4906585, 4.1887902, 4.88692191, 5.58505361, 6.28318531
|
||||
|
||||
# PCM B-spline knots along Y-axis (declination or zenithal distance). By default from -PI/6 to PI/2 radians
|
||||
pcmBsplineYknots = -0.52359878, -0.29088821, -0.05817764, 0.17453293, 0.40724349, 0.63995406, 0.87266463, 1.10537519, 1.33808576, 1.57079633
|
||||
|
||||
# PCM B-spline coeffs for along X-axis (HA-angle or azimuth)
|
||||
pcmBsplineXcoeffs =
|
||||
|
||||
# PCM B-spline coeffs for along Y-axis (declination or zenithal distance)
|
||||
pcmBsplineYcoeffs =
|
||||
|
||||
|
||||
# slewing and tracking parameters
|
||||
|
||||
# arcseconds per second
|
||||
#sideralRate = 15.0410686
|
||||
|
||||
# timeout for telemetry updating in milliseconds
|
||||
telemetryTimeout = 3000
|
||||
|
||||
# minimal allowed time in seconds to prohibited zone
|
||||
minTimeToPZone = 10
|
||||
|
||||
# a time interval to update prohibited zones related quantities (millisecs)
|
||||
updatingPZoneInterval = 5000
|
||||
|
||||
# coordinates difference in arcsecs to stop slewing
|
||||
slewToleranceRadius = 5.0
|
||||
|
||||
# target-mount coordinate difference in arcsecs to start adjusting of slewing
|
||||
adjustCoordDiff = 50.0
|
||||
|
||||
# minimum time in millisecs between two successive adjustments
|
||||
adjustCycleInterval = 300
|
||||
|
||||
# slew process timeout in seconds
|
||||
slewTimeout = 3600
|
||||
|
||||
# a time shift into future to compute target position in future (UT1-scale time duration, millisecs)
|
||||
timeShiftToTargetPoint = 10000
|
||||
|
||||
# minimum time in millisecs between two successive tracking corrections
|
||||
trackingCycleInterval = 300
|
||||
|
||||
|
||||
# prohibited zones
|
||||
|
||||
# minimal altitude in degrees
|
||||
pzMinAltitude = 10.0
|
||||
|
||||
# HA-axis limit switch minimal value in degrees
|
||||
pzLimitSwitchHAMin = -170.0
|
||||
|
||||
# HA-axis limit switch maximal value in degrees
|
||||
pzLimitSwitchHAMax = 170.0
|
||||
|
||||
# DEC-axis limit switch minimal value in degrees
|
||||
pzLimitSwitchDecMin = -90.0
|
||||
|
||||
# DEC-axis limit switch maximal value in degrees
|
||||
pzLimitSwitchDecMax = 90.0
|
||||
|
||||
|
||||
# hardware-related
|
||||
|
||||
# hardware mode: 1 - model mode, otherwise real mode
|
||||
RunModel = 0
|
||||
|
||||
# mount serial device paths
|
||||
MountDevPath = /dev/ttyUSB0
|
||||
|
||||
# mount serial device speed
|
||||
MountDevSpeed = 19200
|
||||
|
||||
# motor encoders serial device path
|
||||
EncoderDevPath =
|
||||
|
||||
# X-axis encoder serial device path
|
||||
EncoderXDevPath = /dev/encoderX0
|
||||
|
||||
# Y-axis encoder serial device path
|
||||
EncoderYDevPath = /dev/encoderY0
|
||||
|
||||
# encoders serial device speed
|
||||
EncoderDevSpeed = 153000
|
||||
|
||||
# ==1 if encoder works as separate serial device, ==2 if there's new version with two devices
|
||||
SepEncoder = 2
|
||||
|
||||
# mount polling interval in millisecs
|
||||
MountReqInterval = 100
|
||||
|
||||
# encoders polling interval in millisecs
|
||||
EncoderReqInterval = 50
|
||||
|
||||
# mount axes rate calculation interval in millisecs
|
||||
EncoderSpeedInterval = 100
|
||||
|
||||
# X-axis coordinate PID P,I,D-params
|
||||
XPIDC = 0.8, 0.1, 0.3
|
||||
|
||||
# X-axis rate PID P,I,D-params
|
||||
XPIDV = 1.0, 0.01, 0.2
|
||||
|
||||
# Y-axis coordinate PID P,I,D-params
|
||||
YPIDC = 0.8, 0.1, 0.3
|
||||
|
||||
# Y-axis rate PID P,I,D-params
|
||||
YPIDV = 0.5, 0.2, 0.5
|
||||
|
||||
|
||||
# maximal moving rate (degrees per second) along HA-axis (Y-axis of Sidereal servo microcontroller)
|
||||
hwMaxRateHA = 8.0
|
||||
|
||||
# maximal moving rate (degrees per second) along DEC-axis (X-axis of Sidereal servo microcontroller)
|
||||
hwMaxRateDEC = 10.0
|
||||
|
||||
)--";
|
||||
|
||||
} // namespace asibfm700
|
||||
|
||||
@ -97,6 +97,11 @@ public:
|
||||
|
||||
~Asibfm700Mount();
|
||||
|
||||
Asibfm700Mount(Asibfm700Mount&&) = default;
|
||||
Asibfm700Mount& operator=(Asibfm700Mount&&) = default;
|
||||
|
||||
Asibfm700Mount(const Asibfm700Mount&) = delete;
|
||||
Asibfm700Mount& operator=(const Asibfm700Mount&) = delete;
|
||||
|
||||
error_t initMount();
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ Asibfm700MountNetServer::Asibfm700MountNetServer(asio::io_context& ctx,
|
||||
auto* mount_ptr = &mount;
|
||||
|
||||
base_t::_handleMessageFunc = [mount_ptr, this](std::string_view command) {
|
||||
using mount_error_t = typename Asibfm700Mount::error_t;
|
||||
// using mount_error_t = typename Asibfm700Mount::error_t;
|
||||
std::error_code err{};
|
||||
|
||||
Asibfm700NetMessage input_msg;
|
||||
@ -46,8 +46,10 @@ Asibfm700MountNetServer::Asibfm700MountNetServer(asio::io_context& ctx,
|
||||
}
|
||||
}
|
||||
|
||||
return output_msg.byteRepr();
|
||||
return output_msg.template byteRepr<typename base_t::handle_message_func_result_t>();
|
||||
};
|
||||
}
|
||||
|
||||
Asibfm700MountNetServer::~Asibfm700MountNetServer() {}
|
||||
|
||||
} // namespace asibfm700
|
||||
|
||||
@ -72,9 +72,9 @@ protected:
|
||||
if constexpr (std::same_as<T, Asibfm700CCTE::meteo_t>) {
|
||||
// serialize just like a vector
|
||||
std::vector<double> meteo{value.temperature, value.humidity, value.pressure};
|
||||
base_t::operator()(meteo, bytes);
|
||||
base_t::DefaultSerializer::operator()(meteo, bytes);
|
||||
} else {
|
||||
base_t::operator()(value, bytes);
|
||||
base_t::DefaultSerializer::operator()(value, bytes);
|
||||
}
|
||||
}
|
||||
} _serializer;
|
||||
@ -84,13 +84,13 @@ protected:
|
||||
{
|
||||
public:
|
||||
template <mcc::traits::mcc_input_char_range IR, typename VT>
|
||||
std::error_code operator()(IR&& bytes, VT& value)
|
||||
std::error_code operator()(IR&& bytes, VT& value) const
|
||||
{
|
||||
if constexpr (std::same_as<VT, Asibfm700CCTE::meteo_t>) {
|
||||
// deserialize just like a vector
|
||||
|
||||
std::vector<double> v;
|
||||
auto ec = base_t::operator()(std::forward<IR>(bytes), v);
|
||||
auto ec = base_t::DefaultDeserializer::operator()(std::forward<IR>(bytes), v);
|
||||
if (ec) {
|
||||
return ec;
|
||||
}
|
||||
@ -105,7 +105,7 @@ protected:
|
||||
|
||||
return {};
|
||||
} else {
|
||||
return base_t::operator()(std::forward<IR>(bytes), value);
|
||||
return base_t::DefaultDeserializer::operator()(std::forward<IR>(bytes), value);
|
||||
}
|
||||
}
|
||||
} _deserializer;
|
||||
@ -116,9 +116,9 @@ public:
|
||||
using base_t::base_t;
|
||||
|
||||
template <typename T>
|
||||
std::expected<T, std::error_code> paramValue(size_t idx)
|
||||
std::expected<T, std::error_code> paramValue(size_t idx) const
|
||||
{
|
||||
return paramValue<T>(idx, _deserializer);
|
||||
return base_t::template paramValue<T>(idx, _deserializer);
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ public:
|
||||
std::error_code construct(KT&& key, PTs&&... params)
|
||||
requires mcc::traits::mcc_output_char_range<BYTEREPR_T>
|
||||
{
|
||||
return construct(_serializer, std::forward<KT>(key), std::forward<PTs>(params)...);
|
||||
return base_t::construct(_serializer, std::forward<KT>(key), std::forward<PTs>(params)...);
|
||||
}
|
||||
};
|
||||
|
||||
@ -141,9 +141,6 @@ public:
|
||||
Asibfm700MountNetServer(asio::io_context& ctx, Asibfm700Mount& mount, std::shared_ptr<spdlog::logger> logger);
|
||||
|
||||
~Asibfm700MountNetServer();
|
||||
|
||||
private:
|
||||
std::vector<char> handleMessage(std::string_view msg);
|
||||
};
|
||||
|
||||
} // namespace asibfm700
|
||||
|
||||
@ -49,7 +49,7 @@ int main(int argc, char* argv[])
|
||||
std::cout << "\n";
|
||||
std::cout << "[endpoint0] [enpoint1] ... [endpointN] - endpoints server will be listening for. For 'local' "
|
||||
"endpoint the '@' symbol at the beginning of the path "
|
||||
"means abstract namespace socket (e.g. local://stream/@BM700_SERVER)."
|
||||
"means abstract namespace socket (e.g. local://stream/@ASIBFM700_SERVER)."
|
||||
<< "\n";
|
||||
return 0;
|
||||
}
|
||||
@ -63,7 +63,7 @@ int main(int argc, char* argv[])
|
||||
} else if (logname == "stderr") {
|
||||
return spdlog::stderr_color_mt("stderr");
|
||||
} else if (logname == "") {
|
||||
return spdlog::null_logger_mt("BM700_SERVER_NULL_LOGGER");
|
||||
return spdlog::null_logger_mt("FM700_SERVER_NULL_LOGGER");
|
||||
} else {
|
||||
return spdlog::basic_logger_mt(logname, logname);
|
||||
}
|
||||
@ -80,10 +80,10 @@ int main(int argc, char* argv[])
|
||||
logger->set_pattern("%v");
|
||||
int w = 90;
|
||||
// const std::string fmt = std::format("{{:*^{}}}", w);
|
||||
constexpr std::string_view fmt = "{{:*^90}}";
|
||||
constexpr std::string_view fmt = "{:*^90}";
|
||||
logger->info("\n\n\n");
|
||||
logger->info(fmt, "");
|
||||
logger->info(fmt, " ASTROSIB BM700 MOUNT SERVER ");
|
||||
logger->info(fmt, " ASTROSIB FM700 MOUNT SERVER ");
|
||||
auto zt = std::chrono::zoned_time(std::chrono::current_zone(),
|
||||
std::chrono::floor<std::chrono::seconds>(std::chrono::system_clock::now()));
|
||||
logger->info(fmt, std::format(" {} ", zt));
|
||||
@ -128,7 +128,7 @@ int main(int argc, char* argv[])
|
||||
asio::post(pool, [&ctx]() { ctx.run(); });
|
||||
|
||||
pool.join();
|
||||
// ctx.run();
|
||||
ctx.run();
|
||||
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
@ -16,15 +16,15 @@ std::string AsibFM700ServoControllerErrorCategory::message(int ec) const
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_OK:
|
||||
return "OK";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_FATAL:
|
||||
return "LibServo fatal error";
|
||||
return "LibSidServo fatal error";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_BADFORMAT:
|
||||
return "LibServo wrong arguments of function";
|
||||
return "LibSidServo wrong arguments of function";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_ENCODERDEV:
|
||||
return "LibServo encoder device error or can't open";
|
||||
return "LibSidServo encoder device error or can't open";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_MOUNTDEV:
|
||||
return "LibServo mount device error or can't open";
|
||||
return "LibSidServo mount device error or can't open";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_FAILED:
|
||||
return "LibServo failed to run command";
|
||||
return "LibSidServo failed to run command";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_NULLPTR:
|
||||
return "nullptr argument";
|
||||
case AsibFM700ServoControllerErrorCode::ERROR_POLLING_TIMEOUT:
|
||||
|
||||
@ -23,12 +23,17 @@ int main()
|
||||
|
||||
std::error_code err;
|
||||
|
||||
std::ofstream fst("/tmp/cfg.cfg");
|
||||
fst << asibfm700::Asibfm700MountConfigString;
|
||||
fst.close();
|
||||
// std::ofstream fst("/tmp/cfg.cfg");
|
||||
// fst << asibfm700::Asibfm700MountConfigString;
|
||||
// fst.close();
|
||||
|
||||
bool ok = asibfm700::Asibfm700MountConfig::dumpDefaults("/tmp/cfg.cfg");
|
||||
if (!ok) {
|
||||
std::cerr << "Cannot dump default configuration!\n";
|
||||
exit(10);
|
||||
}
|
||||
|
||||
asibfm700::Asibfm700MountConfig acfg;
|
||||
// asibfm700::Asibfm700MountConfig2 acfg;
|
||||
|
||||
auto ec = acfg.load("/tmp/cfg.cfg");
|
||||
std::cout << "EC (load) = " << ec.message() << "\n";
|
||||
|
||||
@ -58,11 +58,11 @@ ExternalProject_Add(erfalib
|
||||
INSTALL_COMMAND meson install -C <BINARY_DIR>
|
||||
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/erfa_lib/liberfa.a
|
||||
)
|
||||
add_library(ERFA_LIB STATIC IMPORTED)
|
||||
add_library(ERFA_LIB STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(ERFA_LIB PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/erfa_lib/liberfa.a)
|
||||
add_dependencies(ERFA_LIB erfalib)
|
||||
set(ERFA_INCLUDE_DIR ${CMAKE_BINARY_DIR}/erfa_lib)
|
||||
set(ERFA_LIBFILE ${CMAKE_BINARY_DIR}/erfa_lib/erfa)
|
||||
# set(ERFA_LIBFILE ${CMAKE_BINARY_DIR}/erfa_lib/liberfa.a PARENT_SCOPE)
|
||||
# include_directories(${ERFA_INCLUDE_DIR})
|
||||
|
||||
message(STATUS ${ERFA_INCLUDE_DIR})
|
||||
|
||||
@ -168,7 +168,7 @@ public:
|
||||
SlewModelT(std::move(slew_model)),
|
||||
TrackModelT(std::move(track_model)),
|
||||
LoggerT(std::move(logger)),
|
||||
_mountStatus(new std::atomic<mount_status_t>)
|
||||
_mountStatus(new std::atomic<mount_status_t>{})
|
||||
{
|
||||
*_mountStatus = mount_status_t::IDLE;
|
||||
}
|
||||
@ -242,7 +242,7 @@ public:
|
||||
|
||||
logInfo(std::format("Set entered target coordinates to: {} {} {}", xstr,
|
||||
MccAngle(_enteredTargetCoordiniates.Y).sexagesimal(),
|
||||
MccCoordPairKindStr<_enteredTargetCoordiniates.pair_kind>));
|
||||
MccCoordPairKindToStr(_enteredTargetCoordiniates.pair_kind)));
|
||||
|
||||
return MccGenericMountErrorCode::ERROR_OK;
|
||||
}
|
||||
@ -293,7 +293,8 @@ public:
|
||||
|
||||
error_t stopTracking()
|
||||
{
|
||||
*_mountStatus = mount_status_t::IDLE;
|
||||
// *_mountStatus = mount_status_t::IDLE;
|
||||
_mountStatus->store(mount_status_t::IDLE);
|
||||
|
||||
TrackModelT::stopTracking();
|
||||
|
||||
@ -303,7 +304,7 @@ public:
|
||||
|
||||
MccGenericMount::mount_status_t mountStatus() const
|
||||
{
|
||||
return _mountStatus.get();
|
||||
return *_mountStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@ -651,13 +651,13 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
std::vector<char> handleClientCommand(std::string_view command)
|
||||
{
|
||||
std::vector<char> resp{MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR.begin(),
|
||||
MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR.end()};
|
||||
// std::vector<char> handleClientCommand(std::string_view command)
|
||||
// {
|
||||
// std::vector<char> resp{MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR.begin(),
|
||||
// MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR.end()};
|
||||
|
||||
return resp;
|
||||
}
|
||||
// return resp;
|
||||
// }
|
||||
|
||||
|
||||
template <mcc::traits::mcc_time_duration_c RCVT = decltype(DEFAULT_RCV_TIMEOUT),
|
||||
@ -917,7 +917,7 @@ public:
|
||||
output_msg = handleMessage<output_msg_t>(input_msg, mount_ptr);
|
||||
}
|
||||
|
||||
return output_msg.byteRepr();
|
||||
return output_msg.template byteRepr<typename base_t::handle_message_func_result_t>();
|
||||
};
|
||||
}
|
||||
|
||||
@ -951,9 +951,6 @@ protected:
|
||||
} else if (input_msg.withKey(MCC_COMMPROTO_KEYWORD_RESTART_SERVER_STR)) {
|
||||
this->restart();
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, input_msg.byteRepr());
|
||||
} else if (input_msg.withKey(MCC_COMMPROTO_KEYWORD_STATUS_STR)) {
|
||||
auto st = mount_ptr->status(); // according to mcc_generic_mount_c 'st' is formattable
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_STATUS_STR, st);
|
||||
} else if (input_msg.withKey(MCC_COMMPROTO_KEYWORD_INIT_STR)) {
|
||||
m_err = mount_ptr->initMount();
|
||||
if (m_err) {
|
||||
@ -1066,6 +1063,16 @@ protected:
|
||||
_coordFormat, _coordPrec, cp);
|
||||
}
|
||||
}
|
||||
} else if (input_msg.withKey(mcc::network::MCC_COMMPROTO_KEYWORD_STATUS_STR)) {
|
||||
auto st = mount_ptr->mountStatus(); // according to mcc_generic_mount_c 'st' is formattable
|
||||
using st_t = decltype(st);
|
||||
if constexpr (std::is_enum_v<st_t>) {
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_STATUS_STR,
|
||||
std::to_underlying(st));
|
||||
} else {
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_STATUS_STR,
|
||||
std::format(st));
|
||||
}
|
||||
} else {
|
||||
err = std::make_error_code(std::errc::invalid_argument);
|
||||
}
|
||||
@ -1084,7 +1091,12 @@ protected:
|
||||
{
|
||||
auto ec = msg.fromCharRange(msg_bytes);
|
||||
|
||||
return ec;
|
||||
if (ec != MSG_T::ERROR_OK) {
|
||||
return std::make_error_code(std::errc::invalid_argument);
|
||||
}
|
||||
// return ec;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ protected:
|
||||
DefaultDeserializer() : base_t(MCC_COMMPROTO_RANGEPARAM_DELIM_SEQ) {}
|
||||
|
||||
template <traits::mcc_input_char_range IR, typename VT>
|
||||
std::error_code operator()(IR&& bytes, VT& value)
|
||||
std::error_code operator()(IR&& bytes, VT& value) const
|
||||
{
|
||||
if constexpr (mcc_telemetry_data_c<VT>) {
|
||||
return _telemetryDeserializer(std::forward<IR>(bytes), value);
|
||||
|
||||
@ -442,7 +442,7 @@ public:
|
||||
}
|
||||
|
||||
template <traits::mcc_input_char_range IR, typename VT>
|
||||
std::error_code operator()(IR&& bytes, VT& value)
|
||||
std::error_code operator()(IR&& bytes, VT& value) const
|
||||
{
|
||||
std::error_code ret{};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user