107 lines
3.7 KiB
C++
107 lines
3.7 KiB
C++
#pragma once
|
|
|
|
#include <mcc/mcc_generic_mount.h>
|
|
#include <mcc/mcc_generic_movecontrols.h>
|
|
// #include <mcc/mcc_movement_controls.h>
|
|
#include <mcc/mcc_pzone_container.h>
|
|
#include <mcc/mcc_spdlog.h>
|
|
#include <mcc/mcc_telemetry.h>
|
|
|
|
#include "asibfm700_common.h"
|
|
#include "asibfm700_configfile.h"
|
|
|
|
namespace asibfm700
|
|
{
|
|
|
|
|
|
|
|
class Asibfm700Mount
|
|
: public mcc::impl::MccGenericMount<mcc::impl::MccTelemetry<AsibFM700ServoController>,
|
|
Asibfm700PZoneContainer,
|
|
// mcc::impl::MccSimpleMovementControls,
|
|
// mcc::impl::MccGenericBlockingMovementControls<details::movement_pars_t>,
|
|
mcc::impl::MccGenericAsyncMovementControls<details::movement_pars_t>,
|
|
Asibfm700Logger>
|
|
{
|
|
typedef mcc::impl::MccGenericMount<mcc::impl::MccTelemetry<AsibFM700ServoController>,
|
|
Asibfm700PZoneContainer,
|
|
// mcc::impl::MccSimpleMovementControls,
|
|
// mcc::impl::MccGenericBlockingMovementControls<details::movement_pars_t>,
|
|
mcc::impl::MccGenericAsyncMovementControls<details::movement_pars_t>,
|
|
Asibfm700Logger>
|
|
gm_class_t;
|
|
|
|
|
|
public:
|
|
typedef mcc::impl::MccTelemetry<AsibFM700ServoController> telemetry_t;
|
|
|
|
typedef mcc::impl::MccGenericAsyncMovementControls<details::movement_pars_t> movement_controls_t;
|
|
// typedef mcc::impl::MccGenericBlockingMovementControls<details::movement_pars_t> movement_controls_t;
|
|
|
|
using typename gm_class_t::error_t;
|
|
using typename movement_controls_t::movement_params_t;
|
|
|
|
|
|
using gm_class_t::logCritical;
|
|
using gm_class_t::logDebug;
|
|
using gm_class_t::logError;
|
|
using gm_class_t::logInfo;
|
|
using gm_class_t::logWarn;
|
|
|
|
// using Asibfm700PZoneContainer::addPZone;
|
|
|
|
Asibfm700Mount(Asibfm700MountConfig const& config, std::shared_ptr<spdlog::logger> logger);
|
|
|
|
~Asibfm700Mount();
|
|
|
|
Asibfm700Mount(Asibfm700Mount&&) = default;
|
|
Asibfm700Mount& operator=(Asibfm700Mount&&) = default;
|
|
|
|
Asibfm700Mount(const Asibfm700Mount&) = delete;
|
|
Asibfm700Mount& operator=(const Asibfm700Mount&) = delete;
|
|
|
|
error_t initMount();
|
|
|
|
error_t updateMountConfig(Asibfm700MountConfig const&);
|
|
error_t updateMountConfig(std::string const& = std::string{}); // new filename
|
|
Asibfm700MountConfig currentMountConfig();
|
|
|
|
// redefined method
|
|
auto getPointingTarget() const
|
|
{
|
|
return _enteredBackupCoordinates;
|
|
}
|
|
|
|
protected:
|
|
Asibfm700MountConfig _mountConfig;
|
|
std::unique_ptr<std::mutex> _mountConfigMutex;
|
|
|
|
AsibFM700ServoController _servolController;
|
|
Asibfm700PCM _pcm;
|
|
|
|
void errorLogging(const std::string&, const std::error_code&);
|
|
|
|
// movement methods
|
|
mcc::impl::MccMovementPathFile _pathFile{};
|
|
decltype(telemetry_data_t::targetPos) _enteredBackupCoordinates;
|
|
|
|
error_t slewingImpl(bool);
|
|
error_t trackingImpl();
|
|
error_t stoppingImpl();
|
|
|
|
error_t sendToHardware(AsibFM700ServoController::hardware_state_t const& hw_state);
|
|
|
|
// if predicted == true then the method checks the coordinates calculated for a point in time in the future, i.e.
|
|
// the predicted position if the movement is immediately stopped.
|
|
// if predicted == false then the method checks the current mount coordinates
|
|
error_t checkPZone(typename telemetry_t::telemetry_data_t const& tdata, bool predicted = true);
|
|
|
|
void logMountPos(telemetry_t::telemetry_data_t const& tdata);
|
|
};
|
|
|
|
|
|
|
|
static_assert(mcc::mcc_generic_mount_c<Asibfm700Mount>, "");
|
|
|
|
} // namespace asibfm700
|