24 #ifndef irisaoCtrl_hpp
25 #define irisaoCtrl_hpp
28 #include "../../libMagAOX/libMagAOX.hpp"
29 #include "../../magaox_git_version.h"
33 #include <irisao.mirrors.h>
203 config.add(
"dm.mserialNumber",
"",
"dm.mserialNumber", argType::Required,
"dm",
"mserialNumber",
false,
"string",
"The IrisAO MIRROR serial number used to find correct DM Profile.");
204 config.add(
"dm.dserialNumber",
"",
"dm.dserialNumber", argType::Required,
"dm",
"dserialNumber",
false,
"string",
"The IrisAO DRIVER serial number used to find correct DM Profile.");
205 config.add(
"dm.hardwareDisable",
"",
"dm.hardwareDisable", argType::Required,
"dm",
"hardwareDisable",
false,
"bool",
"Set to true to disable hardware for testing purposes.");
206 config.add(
"dm.calibRelDir",
"",
"dm.calibRelDir", argType::Required,
"dm",
"calibRelDir",
false,
"string",
"Used to find the default config directory.");
247 log<text_log>(
"detected POWERON");
283 log<text_log>(
"trying to init DM");
295 log<text_log>(
"Okay, connecting now");
305 log<text_log>(
"GOT THE MIRROR HANDLE");
329 log<text_log>(
"IrisAO mirror " + mser +
"with driver " + dser +
" initialized",
logPrio::LOG_NOTICE);
333 SegmentNumber segment = 0;
334 while (MirrorIterate(
m_dm, segment)){
338 log<text_log>(
"Found " + std::to_string(segment) +
" segments for IrisAO mirror " + mser,
logPrio::LOG_NOTICE);
370 SegmentNumber segment = 0;
371 while (MirrorIterate(
m_dm, segment)){
372 SetMirrorPosition(
m_dm, segment, 0, 0, 0);
375 MirrorCommand(
m_dm, MirrorSendSettings);
377 log<text_log>(
"DM zeroed");
384 SegmentNumber segment = 0;
385 MirrorPosition position;
387 while (MirrorIterate(
m_dm, segment)){
391 SetMirrorPosition(
m_dm, segment, ((
float *)curr_src)[idx], ((
float *)curr_src)[idx+1], ((
float *)curr_src)[idx+2]);
396 GetMirrorPosition(
m_dm, segment, &position);
397 if (!position.reachable)
414 MirrorCommand(
m_dm, MirrorSendSettings);
433 pthread_kill(
m_smThread.native_handle(), SIGUSR1);
The base-class for MagAO-X applications.
stateCodes::stateCodeT state()
Get the current state code.
int shutdown()
Get the value of the shutdown flag.
std::string m_calibRelDir
The directory relative to the calibPath. Set this before calling dm<derivedT,realT>::loadConfig().
int appShutdown()
DM shutdown.
mx::improc::eigenImage< uint8_t > m_instSatMap
The instantaneous saturation map, 0/1, set by the commandDM() function of the derived class.
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int whilePowerOff()
DM Poweroff Updates.
int appStartup()
Startup function.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int onPowerOff()
DM Poweroff.
int appLogic()
DM application logic.
int appStartup()
Startup function.
int appLogic()
Checks the shmimMonitor thread.
std::thread m_smThread
A separate thread for the actual monitoring.
int appShutdown()
Shuts down the shmimMonitor thread.
The MagAO-X IrisAO DM Controller.
bool m_hardwareDisable
Hardware disable flag (set to true to disable sending commands)
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
~irisaoCtrl() noexcept
D'tor.
virtual int appStartup()
Startup function.
std::string m_dserialNumber
The IrisAO DRIVER serial number.
virtual int appLogic()
Implementation of the FSM for irisaoCtrl.
int commandDM(void *curr_src)
Send a command to the DM.
double * m_dminputs
Pre-allocated command vector, used only in commandDM.
bool m_dmopen
Track whether the DM connection has been opened.
MirrorHandle m_dm
IrisAO SDK handle for the DM.
virtual void setupConfig()
Setup the configuration system.
int zeroDM()
Zero all commands on the DM.
virtual int whilePowerOff()
Maintenace while powered off.
irisaoCtrl()
Default c'tor.
virtual void loadConfig()
Load the configuration.
uint32_t m_nbAct
The number of actuators.
int initDM()
Initialize the DM and prepare for operation.
virtual int appShutdown()
Shutdown the app.
std::string m_mserialNumber
The IrisAO MIRROR serial number.
virtual int onPowerOff()
Cleanup after a power off.
float realT
This defines the datatype used to signal the DM using the ImageStreamIO library.
int releaseDM()
Release the DM, making it safe to turn off power.
friend class irisaoCtrl_test
@ OPERATING
The device is operating, other than homing.
@ POWEROFF
The device power is off.
@ READY
The device is ready for operation, but is not operating.
@ POWERON
The device power is on.
constexpr static logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
constexpr static logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
constexpr static logPrioT LOG_NOTICE
A normal but significant condition.