11#include "../../libMagAOX/libMagAOX.hpp"
12#include "../../magaox_git_version.h"
16#include <asdkWrapper.h>
210 config.add(
"dm.serialNumber",
"",
"dm.serialNumber", argType::Required,
"dm",
"serialNumber",
false,
"string",
"The ALPAO serial number used to find the default config directory.");
211 config.add(
"dm.satThresh",
"",
"dm.satThresh", argType::Required,
"dm",
"satThresh",
false,
"string",
"Threshold above which to log saturation.");
425 dmT::m_tact0 = mx::sys::get_curr_time();
476 dmT::m_tact1 = mx::sys::get_curr_time();
483 dmT::m_tact2 = mx::sys::get_curr_time();
487 dmT::m_tact3 = mx::sys::get_curr_time();
504 dmT::m_tact4 = mx::sys::get_curr_time();
628 printf(
"Error: this program only works on images, not tables\n");
635 if (status ||
naxis != 2) {
636 printf(
"Error: NAXIS = %d. Only 2-D images are supported.\n",
naxis);
643 printf(
"Memory allocation error\n");
The base-class for XWCTk applications.
stateCodes::stateCodeT state()
Get the current state code.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
int shutdown()
Get the value of the shutdown flag.
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
bool powerOnWaitElapsed()
This method tests whether the power on wait time has elapsed.
The MagAO-X ALPAO DM Controller.
Scalar m_max_stroke
The maximum allowable stroke.
~alpaoCtrl() noexcept
D'tor.
virtual void setupConfig()
Setup the configuration system.
std::string m_serialNumber
The ALPAO serial number used to find the default config directory.
Scalar * m_dminputs
Pre-allocated command vector, used only in commandDM.
asdkDM * m_dm
ALPAO SDK handle for the DM.
Scalar m_volume_factor
the volume factor to convert from displacement to commands
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
virtual int appShutdown()
Shutdown the app.
int get_actuator_mapping()
Read the actuator mapping from a FITS file.
int parse_calibration_file()
Parse the ALPAO calibration file.
int initDM()
Initialize the DM and prepare for operation.
virtual int appLogic()
Implementation of the FSM for alpaoCtrl.
float realT
This defines the datatype used to signal the DM using the ImageStreamIO library.
int * m_actuator_mapping
Array containing the mapping from 2D grid position to linear index in the command vector.
virtual int appStartup()
Startup function.
int releaseDM()
Release the DM, making it safe to turn off power.
int commandDM(void *curr_src)
Send a command to the DM.
dev::dm< alpaoCtrl, float > dmT
virtual int onPowerOff()
Cleanup after a power off.
alpaoCtrl()
Default c'tor.
int zeroDM()
Zero all commands on the DM.
UInt m_nbAct
The number of actuators.
friend class alpaoCtrl_test
virtual int whilePowerOff()
Maintenace while powered off.
dev::shmimMonitor< alpaoCtrl > shmimMonitorT
long m_satThresh
Threshold above which to log saturation.
virtual void loadConfig()
Load the configuration.
std::string m_calibPath
The path to this DM's calibration files.
std::string m_calibRelDir
mx::improc::eigenImage< uint8_t > m_instSatMap
mx::improc::milkImage< float > m_outputShape
The true output shape after saturation.
std::thread m_smThread
A separate thread for the actual monitoring.
#define DM_SETUP_CONFIG(cfig)
Call dmT::setupConfig with error checking for dm.
#define DM_APP_SHUTDOWN
Call dmT::appShutdown with error checking for dm.
#define DM_LOAD_CONFIG(cfig)
Call dmT::loadConfig with error checking for dm.
#define DM_APP_STARTUP
Call shmimMonitorT::appStartup with error checking for dm.
#define DM_APP_LOGIC
Call dmT::appLogic with error checking for dm.
#define DM_UPDATE_INDI
Call dmT::updateINDI with error checking for dm.
@ POWEROFF
The device power is off.
@ NOTHOMED
The device has not been homed.
@ READY
The device is ready for operation, but is not operating.
@ POWERON
The device power is on.
static constexpr logPrioT LOG_NOTICE
A normal but significant condition.
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
#define SHMIMMONITOR_APP_SHUTDOWN
Call shmimMonitorT::appShutdown with error checking for shmimMonitor.
#define SHMIMMONITOR_APP_LOGIC
Call shmimMonitorT::appLogic with error checking for shmimMonitor.
#define SHMIMMONITOR_APP_STARTUP
Call shmimMonitorT::appStartup with error checking for shmimMonitor.
#define SHMIMMONITOR_UPDATE_INDI
Call shmimMonitorT::updateINDI with error checking for shmimMonitor.