11 #include "../../libMagAOX/libMagAOX.hpp"
12 #include "../../magaox_git_version.h"
14 #include <mx/math/gslInterpolation.hpp>
15 #include <mx/ioutils/readColumns.hpp>
136 config.add(
"k.zero",
"",
"k.zero", argType::Required,
"k",
"zero",
false,
"float",
"The k-mirror zero position. Default is -40.0.");
138 config.add(
"k.sign",
"",
"k.sign", argType::Required,
"k",
"sign",
false,
"int",
"The k-mirror rotation sign. Default is +1.");
142 config.add(
"k.devName",
"",
"k.devName", argType::Required,
"k",
"devName",
false,
"string",
"The device name of the k-mirrorstage. Default is 'stagek'");
144 config.add(
"tcs.devName",
"",
"tcs.devName", argType::Required,
"tcs",
"devName",
false,
"string",
"The device name of the TCS Interface providing 'teldata.zd'. Default is 'tcsi'");
146 config.add(
"tracking.updateInterval",
"",
"tracking.updateInterval", argType::Required,
"tracking",
"updateInterval",
false,
"float",
"The interval at which to update positions, in seconds. Default is 10 secs.");
151 _config(
m_zero,
"k.zero");
152 _config(
m_sign,
"k.sign");
177 m_indiP_kpos = pcf::IndiProperty(pcf::IndiProperty::Number);
190 static double lastupdate = 0;
196 std::cerr <<
"Sending k-mirror to: " << k <<
"\n";
201 lastupdate = mx::sys::get_curr_time();
217 if(
ipRecv.getName() != m_indiP_tracking.getName())
219 log<software_error>({__FILE__,__LINE__,
"wrong INDI property received."});
223 if(!
ipRecv.find(
"toggle"))
return 0;
225 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::On)
231 log<text_log>(
"started ADC rotation tracking");
239 log<text_log>(
"stopped ADC rotation tracking");
248 if(
ipRecv.getName() != m_indiP_teldata.getName())
250 log<software_error>({__FILE__,__LINE__,
"wrong INDI property received"});
255 if(!
ipRecv.find(
"zd"))
return 0;
257 m_zd =
ipRecv[
"zd"].get<
float>();
The base-class for MagAO-X applications.
stateCodes::stateCodeT state()
Get the current state code.
int registerIndiPropertyNew(pcf::IndiProperty &prop, int(*)(void *, const pcf::IndiProperty &))
Register an INDI property which is exposed for others to request a New Property for.
int createStandardIndiToggleSw(pcf::IndiProperty &prop, const std::string &name, const std::string &label="", const std::string &group="")
Create a standard R/W INDI switch with a single toggle element.
int sendNewProperty(const pcf::IndiProperty &ipSend, const std::string &el, const T &newVal)
Send a newProperty command to another device (using the INDI Client interface)
pcf::IndiProperty m_indiP_tracking
virtual void loadConfig()
pcf::IndiProperty m_indiP_teldata
~kTracker() noexcept
D'tor, declared and defined for noexcept.
float m_zero
The starting point for the K-mirorr at zd=0.
virtual int appShutdown()
Shutdown the app.
pcf::IndiProperty m_indiP_kpos
virtual void setupConfig()
INDI_SETCALLBACK_DECL(kTracker, m_indiP_teldata)
INDI_NEWCALLBACK_DECL(kTracker, m_indiP_tracking)
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
friend class kTracker_test
virtual int appStartup()
Startup function.
int m_sign
The sign to apply to the zd to rotate the k-mirror.
std::string m_tcsDevName
The device name of the TCS Interface providing 'teldata.zd'. Default is 'tcsi'.
std::string m_devName
The device name of the K-mirror stage. Default is 'stagek'.
bool m_tracking
The interval at which to update positions, in seconds. Default is 10 secs.
virtual int appLogic()
Implementation of the FSM for kTracker.
#define INDI_NEWCALLBACK(prop)
Get the name of the static callback wrapper for a new property.
#define REG_INDI_SETPROP(prop, devName, propName)
Register a SET INDI property with the class, using the standard callback name.
@ READY
The device is ready for operation, but is not operating.
void updateSwitchIfChanged(pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
Update the value of the INDI element, but only if it has changed.
const pcf::IndiProperty & ipRecv
INDI_SETCALLBACK_DEFN(adcTracker, m_indiP_teldata)(const pcf
INDI_NEWCALLBACK_DEFN(acesxeCtrl, m_indiP_windspeed)(const pcf