API
MagAOX::app::dev::dm< derivedT, realT > Class Template Reference

#include <dm.hpp>

Collaboration diagram for MagAOX::app::dev::dm< derivedT, realT >:
Collaboration graph

Public Member Functions

int setupConfig (mx::app::appConfigurator &config)
 Setup the configuration system. More...
 
int loadConfig (mx::app::appConfigurator &config)
 load the configuration system results More...
 
int appStartup ()
 Startup function. More...
 
int appLogic ()
 DM application logic. More...
 
int appShutdown ()
 DM shutdown. More...
 
int onPowerOff ()
 DM Poweroff. More...
 
int whilePowerOff ()
 DM Poweroff Updates. More...
 
int findDMChannels ()
 Find the DM comb channels. More...
 
int allocate (const dev::shmimT &sp)
 Called after shmimMonitor connects to the dmXXdisp stream. Checks for proper size. More...
 
int processImage (void *curr_src, const dev::shmimT &sp)
 Called by shmimMonitor when a new DM command is available. This is just a pass-through to derivedT::commandDM(char*). More...
 
int releaseDM ()
 Calls derived()->releaseDM() and then 0s all channels and the sat map. More...
 
int checkFlats ()
 Check the flats directory and update the list of flats if anything changes. More...
 
int loadFlat (const std::string &target)
 Load a flat file. More...
 
int setFlat (bool update=false)
 Send the current flat command to the DM. More...
 
int zeroFlat ()
 Zero the flat command on the DM. More...
 
int checkTests ()
 Check the tests directory and update the list of tests if anything changes. More...
 
int loadTest (const std::string &target)
 Load a test file. More...
 
int setTest ()
 Send the current test command to the DM. More...
 
int zeroTest ()
 Zero the test command on the DM. More...
 
int zeroAll (bool nosem=false)
 Zero all channels. More...
 

Protected Member Functions

int clearSat ()
 Clear the saturation maps and zero the shared membory. More...
 

Protected Attributes

std::string m_calibRelDir
 The directory relative to the calibPath. Set this before calling dm<derivedT,realT>::loadConfig(). More...
 
int m_channels {0}
 The number of dmcomb channels found as part of allocation. More...
 
std::map< std::string, std::string > m_flatCommands
 Map of flat file name to full path. More...
 
std::string m_flatCurrent
 The name of the current flat command. More...
 
mx::improc::eigenImage< realT > m_flatCommand
 Data storage for the flat command. More...
 
bool m_flatLoaded {false}
 Flag indicating whether a flat is loaded in memory. More...
 
IMAGE m_flatImageStream
 The ImageStreamIO shared memory buffer for the flat. More...
 
bool m_flatSet {false}
 Flag indicating whether the flat command has been set. More...
 
std::map< std::string, std::string > m_testCommands
 Map of test file name to full path. More...
 
std::string m_testCurrent
 
mx::improc::eigenImage< realT > m_testCommand
 Data storage for the test command. More...
 
bool m_testLoaded {false}
 Flag indicating whether a test command is loaded in memory. More...
 
IMAGE m_testImageStream
 The ImageStreamIO shared memory buffer for the test. More...
 
bool m_testSet {false}
 Flag indicating whether the test command has been set. More...
 
int m_overSatAct {0}
 
int m_intervalSatExceeds {0}
 
bool m_intervalSatTrip {0}
 
mx::improc::eigenImage< uint8_t > m_instSatMap
 The instantaneous saturation map, 0/1, set by the commandDM() function of the derived class. More...
 
mx::improc::eigenImage< uint16_t > m_accumSatMap
 The accumulated saturation map, which acccumulates for m_satAvgInt then is publised as a 0/1 image. More...
 
mx::improc::eigenImage< float > m_satPercMap
 Map of the percentage of time each actator was saturated during the avg. interval. More...
 
IMAGE m_satImageStream
 The ImageStreamIO shared memory buffer for the sat map. More...
 
IMAGE m_satPercImageStream
 The ImageStreamIO shared memory buffer for the sat percentage map. More...
 

Private Member Functions

derivedT & derived ()
 

Configurable Parameters

std::string m_calibPath
 The path to this DM's calibration files. More...
 
std::string m_flatPath
 The path to this DM's flat files (usually the same as calibPath) More...
 
std::string m_testPath
 The path to this DM's test files (default is calibPath/tests;. More...
 
std::string m_flatDefault
 The file name of the this DM's default flat command. Path and extension will be ignored and can be omitted. More...
 
std::string m_testDefault
 The file name of the this DM's default test command. Path and extension will be ignored and can be omitted. More...
 
std::string m_shmimFlat
 The name of the shmim stream to write the flat to. More...
 
std::string m_shmimTest
 The name of the shmim stream to write the test to. More...
 
std::string m_shmimSat
 The name of the shmim stream to write the saturation map to. More...
 
std::string m_shmimSatPerc
 The name of the shmim stream to write the saturation percentage map to. More...
 
int m_satAvgInt {100}
 The time in milliseconds to accumulate saturation over. More...
 
int m_satThreadPrio {0}
 Priority of the saturation thread, should normally be > 0. More...
 
uint32_t m_dmWidth {0}
 The width of the images in the stream. More...
 
uint32_t m_dmHeight {0}
 The height of the images in the stream. More...
 
float m_percThreshold {0.98}
 
float m_intervalSatThreshold {0.50}
 
int m_intervalSatCountThreshold {10}
 
std::vector< std::string > m_satTriggerDevice
 
std::vector< std::string > m_satTriggerProperty
 
static constexpr uint8_t m_dmDataType = ImageStreamTypeCode<realT>()
 The ImageStreamIO type code. More...
 

Saturation Thread

This thread processes the saturation maps

sem_t m_satSemaphore
 Semaphore used to tell the saturation thread to run. More...
 
bool m_satThreadInit {true}
 Synchronizer for thread startup, to allow priority setting to finish. More...
 
pid_t m_satThreadID {0}
 The ID of the saturation thread. More...
 
pcf::IndiProperty m_satThreadProp
 The property to hold the saturation thread details. More...
 
std::thread m_satThread
 A separate thread for the actual saturation processing. More...
 
void satThreadExec ()
 Execute saturation processing. More...
 
void intervalSatTrip ()
 
static void satThreadStart (dm *d)
 Thread starter, called by MagAOXApp::threadStart on thread construction. Calls satThreadExec. More...
 

INDI

pcf::IndiProperty m_indiP_flat
 Property used to set and report the current flat. More...
 
pcf::IndiProperty m_indiP_init
 
pcf::IndiProperty m_indiP_zero
 
pcf::IndiProperty m_indiP_release
 
pcf::IndiProperty m_indiP_flats
 INDI Selection switch containing the flat files. More...
 
pcf::IndiProperty m_indiP_flatShmim
 Publish the shmim being used for the flat. More...
 
pcf::IndiProperty m_indiP_setFlat
 INDI toggle switch to set the current flat. More...
 
pcf::IndiProperty m_indiP_tests
 INDI Selection switch containing the test pattern files. More...
 
pcf::IndiProperty m_indiP_testShmim
 Publish the shmim being used for the test command. More...
 
pcf::IndiProperty m_indiP_setTest
 INDI toggle switch to set the current test pattern. More...
 
pcf::IndiProperty m_indiP_zeroAll
 
int newCallBack_init (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_zero (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_release (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_flats (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_setFlat (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_tests (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_setTest (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int newCallBack_zeroAll (const pcf::IndiProperty &ipRecv)
 The callback for the zeroAll toggle switch, called by the static version. More...
 
int updateINDI ()
 Update the INDI properties for this device controller. More...
 
static int st_newCallBack_init (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for initializing the DM. More...
 
static int st_newCallBack_zero (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for initializing the DM. More...
 
static int st_newCallBack_release (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for initializing the DM. More...
 
static int st_newCallBack_flats (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for selecting the flat file. More...
 
static int st_newCallBack_setFlat (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for setting the flat. More...
 
static int st_newCallBack_tests (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for selecting the test file. More...
 
static int st_newCallBack_setTest (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for setting the test shape. More...
 
static int st_newCallBack_zeroAll (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for zeroing all channels. More...
 

Detailed Description

template<class derivedT, typename realT>
class MagAOX::app::dev::dm< derivedT, realT >

MagAO-X generic deformable mirror controller

The derived class derivedT must expose the following interface

Each of the above functions should return 0 on success, and -1 on an error.

This class should be declared a friend in the derived class, like so:

friend class dev::dm<derivedT,realT>;

Calls to this class's setupConfig, loadConfig, appStartup, appLogic, appShutdown, and udpdateINDI functions must be placed in the derived class's functions of the same name.

Definition at line 68 of file dm.hpp.

Member Function Documentation

◆ allocate()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::allocate ( const dev::shmimT sp)

Called after shmimMonitor connects to the dmXXdisp stream. Checks for proper size.

Returns
0 on success
-1 if incorrect size or data type in stream.

Definition at line 951 of file dm.hpp.

◆ appLogic()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::appLogic

DM application logic.

This should be called in derivedT::appLogic as

int appLogic()
DM application logic.
Definition: dm.hpp:823

with appropriate error checking.

Returns
0 on success
-1 on error, which is logged.

Definition at line 823 of file dm.hpp.

Referenced by MagAOX::app::alpaoCtrl::appLogic(), MagAOX::app::bmcCtrl::appLogic(), and MagAOX::app::irisaoCtrl::appLogic().

◆ appShutdown()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::appShutdown

DM shutdown.

This should be called in derivedT::appShutdown as

with appropriate error checking.

Returns
0 on success
-1 on error, which is logged.

Definition at line 880 of file dm.hpp.

Referenced by MagAOX::app::alpaoCtrl::appShutdown(), MagAOX::app::bmcCtrl::appShutdown(), and MagAOX::app::irisaoCtrl::appShutdown().

◆ appStartup()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::appStartup

Startup function.

This should be called in derivedT::appStartup as

int appStartup()
Startup function.
Definition: dm.hpp:689

with appropriate error checking.

Returns
0 on success
-1 on error, which is logged.

Definition at line 689 of file dm.hpp.

Referenced by MagAOX::app::alpaoCtrl::appStartup(), MagAOX::app::bmcCtrl::appStartup(), and MagAOX::app::irisaoCtrl::appStartup().

◆ checkFlats()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::checkFlats

Check the flats directory and update the list of flats if anything changes.

This is called once per appLogic and whilePowerOff loops.

Returns
0 on success
-1 on error

Definition at line 1076 of file dm.hpp.

◆ checkTests()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::checkTests

Check the tests directory and update the list of tests if anything changes.

This is called once per appLogic and whilePowerOff loops.

Returns
0 on success
-1 on error

Definition at line 1429 of file dm.hpp.

◆ clearSat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::clearSat
protected

Clear the saturation maps and zero the shared membory.

Returns
0 on success
-1 on error

Definition at line 1815 of file dm.hpp.

◆ derived()

template<class derivedT , typename realT >
derivedT& MagAOX::app::dev::dm< derivedT, realT >::derived ( )
inlineprivate

Definition at line 567 of file dm.hpp.

Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().

◆ findDMChannels()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::findDMChannels

Find the DM comb channels.

Introspectively finds all dmXXdispYY channels, zeroes them, and raises the semapahore on the last to cause dmcomb to update.

Definition at line 915 of file dm.hpp.

◆ intervalSatTrip()

template<class derivedT , typename realT >
void MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip ( )
inlineprotected

Definition at line 348 of file dm.hpp.

◆ loadConfig()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::loadConfig ( mx::app::appConfigurator &  config)

load the configuration system results

This should be called in derivedT::loadConfig as

int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
Definition: dm.hpp:616

with appropriate error checking.

Parameters
[in]configthe derived classes configurator

Definition at line 616 of file dm.hpp.

Referenced by MagAOX::app::alpaoCtrl::loadConfigImpl(), MagAOX::app::bmcCtrl::loadConfigImpl(), and MagAOX::app::irisaoCtrl::loadConfigImpl().

◆ loadFlat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::loadFlat ( const std::string &  target)

Load a flat file.

Uses the target argument for lookup in m_flatCommands to find the path and loads the command in the local memory. Calls setFlat if the flat is currently set.

Returns
0 on success
-1 on error
Parameters
[in]targetthe name of the flat to load

Definition at line 1204 of file dm.hpp.

◆ loadTest()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::loadTest ( const std::string &  target)

Load a test file.

Uses the target argument for lookup in m_testCommands to find the path and loads the command in the local memory. Calls setTest if the test is currently set.

Definition at line 1520 of file dm.hpp.

◆ newCallBack_flats()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_flats ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2145 of file dm.hpp.

◆ newCallBack_init()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_init ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2070 of file dm.hpp.

◆ newCallBack_release()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_release ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2120 of file dm.hpp.

◆ newCallBack_setFlat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_setFlat ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2195 of file dm.hpp.

◆ newCallBack_setTest()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_setTest ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2273 of file dm.hpp.

◆ newCallBack_tests()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_tests ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2223 of file dm.hpp.

◆ newCallBack_zero()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_zero ( const pcf::IndiProperty &  ipRecv)

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2095 of file dm.hpp.

◆ newCallBack_zeroAll()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_zeroAll ( const pcf::IndiProperty &  ipRecv)

The callback for the zeroAll toggle switch, called by the static version.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2301 of file dm.hpp.

◆ onPowerOff()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::onPowerOff

DM Poweroff.

This should be called in derivedT::onPowerOff as

with appropriate error checking.

Returns
0 on success
-1 on error, which is logged.

Definition at line 898 of file dm.hpp.

◆ processImage()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::processImage ( void *  curr_src,
const dev::shmimT sp 
)

Called by shmimMonitor when a new DM command is available. This is just a pass-through to derivedT::commandDM(char*).

Definition at line 1006 of file dm.hpp.

◆ releaseDM()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::releaseDM

Calls derived()->releaseDM() and then 0s all channels and the sat map.

This is called by the relevant INDI callback

Returns
0 on success
-1 on error

Definition at line 1057 of file dm.hpp.

◆ satThreadExec()

template<class derivedT , typename realT >
void MagAOX::app::dev::dm< derivedT, realT >::satThreadExec
protected

Execute saturation processing.

Definition at line 1879 of file dm.hpp.

Referenced by MagAOX::app::dev::dm< derivedT, realT >::satThreadStart().

◆ satThreadStart()

template<class derivedT , typename realT >
void MagAOX::app::dev::dm< derivedT, realT >::satThreadStart ( dm< derivedT, realT > *  d)
staticprotected

Thread starter, called by MagAOXApp::threadStart on thread construction. Calls satThreadExec.

Parameters
[in]da pointer to a dm instance (normally this)

Definition at line 1873 of file dm.hpp.

◆ setFlat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::setFlat ( bool  update = false)

Send the current flat command to the DM.

Writes the command to the designated shmim.

Returns
0 on success
-1 on error
Todo:
we are assuming that dmXXcomYY is not a cube. This might be true, but we should add cnt1 handling here anyway. With bounds checks b/c not everyone handles cnt1 properly.
Parameters
[in]updateIf true, this is an update rather than a new set

Definition at line 1285 of file dm.hpp.

◆ setTest()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::setTest

Send the current test command to the DM.

Writes the command to the designated shmim.

Returns
0 on success
-1 on error
Todo:
we are assuming that dmXXcomYY is not a cube. This might be true, but we should add cnt1 handling here anyway. With bounds checks b/c not everyone handles cnt1 properly.

Definition at line 1594 of file dm.hpp.

◆ setupConfig()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::setupConfig ( mx::app::appConfigurator &  config)

Setup the configuration system.

This should be called in derivedT::setupConfig as

int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
Definition: dm.hpp:574

with appropriate error checking.

Todo:
we shmimMonitor now has configSection so this isn't necessary.
Parameters
[out]configthe derived classes configurator

Definition at line 574 of file dm.hpp.

Referenced by MagAOX::app::alpaoCtrl::setupConfig(), MagAOX::app::bmcCtrl::setupConfig(), and MagAOX::app::irisaoCtrl::setupConfig().

◆ st_newCallBack_flats()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_flats ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for selecting the flat file.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2138 of file dm.hpp.

◆ st_newCallBack_init()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_init ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for initializing the DM.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2063 of file dm.hpp.

◆ st_newCallBack_release()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_release ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for initializing the DM.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2113 of file dm.hpp.

◆ st_newCallBack_setFlat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_setFlat ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for setting the flat.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2188 of file dm.hpp.

◆ st_newCallBack_setTest()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_setTest ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for setting the test shape.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2266 of file dm.hpp.

◆ st_newCallBack_tests()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_tests ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for selecting the test file.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2216 of file dm.hpp.

◆ st_newCallBack_zero()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_zero ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for initializing the DM.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2088 of file dm.hpp.

◆ st_newCallBack_zeroAll()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::st_newCallBack_zeroAll ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
static

The static callback function to be registered for zeroing all channels.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 2294 of file dm.hpp.

◆ updateINDI()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::updateINDI

Update the INDI properties for this device controller.

You should call this once per main loop. It is not called automatically.

Returns
0 on success.
-1 on error.

Definition at line 2054 of file dm.hpp.

◆ whilePowerOff()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::whilePowerOff

DM Poweroff Updates.

This should be called in derivedT::whilePowerOff as

int whilePowerOff()
DM Poweroff Updates.
Definition: dm.hpp:906

with appropriate error checking.

Returns
0 on success
-1 on error, which is logged.

Definition at line 906 of file dm.hpp.

◆ zeroAll()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::zeroAll ( bool  nosem = false)

Zero all channels.

Returns
0 on sucess
<0 on an error
Parameters
[in]nosem[optional] if true then the semaphore is not raised after zeroing all channels

Definition at line 1737 of file dm.hpp.

◆ zeroFlat()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::zeroFlat

Zero the flat command on the DM.

Writes a 0 array the designated shmim.

Returns
0 on success
-1 on error
Todo:
we are assuming that dmXXcomYY is not a cube. This might be true, but we should add cnt1 handling here anyway. With bounds checks b/c not everyone handles cnt1 properly.

Definition at line 1375 of file dm.hpp.

◆ zeroTest()

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::zeroTest

Zero the test command on the DM.

Writes a 0 array the designated shmim.

Returns
0 on success
-1 on error
Todo:
we are assuming that dmXXcomYY is not a cube. This might be true, but we should add cnt1 handling here anyway. With bounds checks b/c not everyone handles cnt1 properly.

Definition at line 1682 of file dm.hpp.

Member Data Documentation

◆ m_accumSatMap

template<class derivedT , typename realT >
mx::improc::eigenImage<uint16_t> MagAOX::app::dev::dm< derivedT, realT >::m_accumSatMap
protected

The accumulated saturation map, which acccumulates for m_satAvgInt then is publised as a 0/1 image.

Definition at line 314 of file dm.hpp.

◆ m_calibPath

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_calibPath
protected

The path to this DM's calibration files.

Definition at line 76 of file dm.hpp.

◆ m_calibRelDir

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_calibRelDir
protected

The directory relative to the calibPath. Set this before calling dm<derivedT,realT>::loadConfig().

Definition at line 107 of file dm.hpp.

◆ m_channels

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_channels {0}
protected

The number of dmcomb channels found as part of allocation.

Definition at line 109 of file dm.hpp.

◆ m_dmDataType

template<class derivedT , typename realT >
constexpr uint8_t MagAOX::app::dev::dm< derivedT, realT >::m_dmDataType = ImageStreamTypeCode<realT>()
staticconstexprprotected

The ImageStreamIO type code.

Definition at line 96 of file dm.hpp.

◆ m_dmHeight

template<class derivedT , typename realT >
uint32_t MagAOX::app::dev::dm< derivedT, realT >::m_dmHeight {0}
protected

The height of the images in the stream.

Definition at line 94 of file dm.hpp.

◆ m_dmWidth

template<class derivedT , typename realT >
uint32_t MagAOX::app::dev::dm< derivedT, realT >::m_dmWidth {0}
protected

The width of the images in the stream.

Definition at line 93 of file dm.hpp.

◆ m_flatCommand

template<class derivedT , typename realT >
mx::improc::eigenImage<realT> MagAOX::app::dev::dm< derivedT, realT >::m_flatCommand
protected

Data storage for the flat command.

Definition at line 114 of file dm.hpp.

◆ m_flatCommands

template<class derivedT , typename realT >
std::map<std::string, std::string> MagAOX::app::dev::dm< derivedT, realT >::m_flatCommands
protected

Map of flat file name to full path.

Definition at line 111 of file dm.hpp.

◆ m_flatCurrent

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_flatCurrent
protected

The name of the current flat command.

Definition at line 112 of file dm.hpp.

◆ m_flatDefault

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_flatDefault
protected

The file name of the this DM's default flat command. Path and extension will be ignored and can be omitted.

Definition at line 80 of file dm.hpp.

◆ m_flatImageStream

template<class derivedT , typename realT >
IMAGE MagAOX::app::dev::dm< derivedT, realT >::m_flatImageStream
protected

The ImageStreamIO shared memory buffer for the flat.

Definition at line 117 of file dm.hpp.

◆ m_flatLoaded

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_flatLoaded {false}
protected

Flag indicating whether a flat is loaded in memory.

Definition at line 115 of file dm.hpp.

◆ m_flatPath

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_flatPath
protected

The path to this DM's flat files (usually the same as calibPath)

Definition at line 77 of file dm.hpp.

◆ m_flatSet

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_flatSet {false}
protected

Flag indicating whether the flat command has been set.

Definition at line 118 of file dm.hpp.

◆ m_indiP_flat

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_flat
protected

Property used to set and report the current flat.

Definition at line 384 of file dm.hpp.

◆ m_indiP_flats

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_flats
protected

INDI Selection switch containing the flat files.

Definition at line 390 of file dm.hpp.

◆ m_indiP_flatShmim

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_flatShmim
protected

Publish the shmim being used for the flat.

Definition at line 391 of file dm.hpp.

◆ m_indiP_init

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_init
protected

Definition at line 386 of file dm.hpp.

◆ m_indiP_release

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_release
protected

Definition at line 388 of file dm.hpp.

◆ m_indiP_setFlat

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_setFlat
protected

INDI toggle switch to set the current flat.

Definition at line 392 of file dm.hpp.

◆ m_indiP_setTest

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_setTest
protected

INDI toggle switch to set the current test pattern.

Definition at line 396 of file dm.hpp.

◆ m_indiP_tests

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_tests
protected

INDI Selection switch containing the test pattern files.

Definition at line 394 of file dm.hpp.

◆ m_indiP_testShmim

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_testShmim
protected

Publish the shmim being used for the test command.

Definition at line 395 of file dm.hpp.

◆ m_indiP_zero

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_zero
protected

Definition at line 387 of file dm.hpp.

◆ m_indiP_zeroAll

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_indiP_zeroAll
protected

Definition at line 398 of file dm.hpp.

◆ m_instSatMap

template<class derivedT , typename realT >
mx::improc::eigenImage<uint8_t> MagAOX::app::dev::dm< derivedT, realT >::m_instSatMap
protected

The instantaneous saturation map, 0/1, set by the commandDM() function of the derived class.

Definition at line 313 of file dm.hpp.

◆ m_intervalSatCountThreshold

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_intervalSatCountThreshold {10}
protected

Definition at line 100 of file dm.hpp.

◆ m_intervalSatExceeds

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_intervalSatExceeds {0}
protected

Definition at line 130 of file dm.hpp.

◆ m_intervalSatThreshold

template<class derivedT , typename realT >
float MagAOX::app::dev::dm< derivedT, realT >::m_intervalSatThreshold {0.50}
protected

Definition at line 99 of file dm.hpp.

◆ m_intervalSatTrip

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_intervalSatTrip {0}
protected

Definition at line 131 of file dm.hpp.

◆ m_overSatAct

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_overSatAct {0}
protected

Definition at line 129 of file dm.hpp.

◆ m_percThreshold

template<class derivedT , typename realT >
float MagAOX::app::dev::dm< derivedT, realT >::m_percThreshold {0.98}
protected

Definition at line 98 of file dm.hpp.

◆ m_satAvgInt

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_satAvgInt {100}
protected

The time in milliseconds to accumulate saturation over.

Definition at line 88 of file dm.hpp.

◆ m_satImageStream

template<class derivedT , typename realT >
IMAGE MagAOX::app::dev::dm< derivedT, realT >::m_satImageStream
protected

The ImageStreamIO shared memory buffer for the sat map.

Definition at line 317 of file dm.hpp.

◆ m_satPercImageStream

template<class derivedT , typename realT >
IMAGE MagAOX::app::dev::dm< derivedT, realT >::m_satPercImageStream
protected

The ImageStreamIO shared memory buffer for the sat percentage map.

Definition at line 318 of file dm.hpp.

◆ m_satPercMap

template<class derivedT , typename realT >
mx::improc::eigenImage<float> MagAOX::app::dev::dm< derivedT, realT >::m_satPercMap
protected

Map of the percentage of time each actator was saturated during the avg. interval.

Definition at line 315 of file dm.hpp.

◆ m_satSemaphore

template<class derivedT , typename realT >
sem_t MagAOX::app::dev::dm< derivedT, realT >::m_satSemaphore
protected

Semaphore used to tell the saturation thread to run.

Definition at line 332 of file dm.hpp.

◆ m_satThread

template<class derivedT , typename realT >
std::thread MagAOX::app::dev::dm< derivedT, realT >::m_satThread
protected

A separate thread for the actual saturation processing.

Definition at line 340 of file dm.hpp.

◆ m_satThreadID

template<class derivedT , typename realT >
pid_t MagAOX::app::dev::dm< derivedT, realT >::m_satThreadID {0}
protected

The ID of the saturation thread.

Definition at line 336 of file dm.hpp.

◆ m_satThreadInit

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_satThreadInit {true}
protected

Synchronizer for thread startup, to allow priority setting to finish.

Definition at line 334 of file dm.hpp.

◆ m_satThreadPrio

template<class derivedT , typename realT >
int MagAOX::app::dev::dm< derivedT, realT >::m_satThreadPrio {0}
protected

Priority of the saturation thread, should normally be > 0.

Todo:
satThreadPrio configuration is not actually implemented.

Definition at line 91 of file dm.hpp.

◆ m_satThreadProp

template<class derivedT , typename realT >
pcf::IndiProperty MagAOX::app::dev::dm< derivedT, realT >::m_satThreadProp
protected

The property to hold the saturation thread details.

Definition at line 338 of file dm.hpp.

◆ m_satTriggerDevice

template<class derivedT , typename realT >
std::vector<std::string> MagAOX::app::dev::dm< derivedT, realT >::m_satTriggerDevice
protected

Definition at line 102 of file dm.hpp.

Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().

◆ m_satTriggerProperty

template<class derivedT , typename realT >
std::vector<std::string> MagAOX::app::dev::dm< derivedT, realT >::m_satTriggerProperty
protected

Definition at line 103 of file dm.hpp.

Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().

◆ m_shmimFlat

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_shmimFlat
protected

The name of the shmim stream to write the flat to.

Definition at line 83 of file dm.hpp.

◆ m_shmimSat

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_shmimSat
protected

The name of the shmim stream to write the saturation map to.

Definition at line 85 of file dm.hpp.

◆ m_shmimSatPerc

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_shmimSatPerc
protected

The name of the shmim stream to write the saturation percentage map to.

Definition at line 86 of file dm.hpp.

◆ m_shmimTest

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_shmimTest
protected

The name of the shmim stream to write the test to.

Definition at line 84 of file dm.hpp.

◆ m_testCommand

template<class derivedT , typename realT >
mx::improc::eigenImage<realT> MagAOX::app::dev::dm< derivedT, realT >::m_testCommand
protected

Data storage for the test command.

Definition at line 123 of file dm.hpp.

◆ m_testCommands

template<class derivedT , typename realT >
std::map<std::string, std::string> MagAOX::app::dev::dm< derivedT, realT >::m_testCommands
protected

Map of test file name to full path.

Definition at line 120 of file dm.hpp.

◆ m_testCurrent

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_testCurrent
protected

Definition at line 121 of file dm.hpp.

◆ m_testDefault

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_testDefault
protected

The file name of the this DM's default test command. Path and extension will be ignored and can be omitted.

Definition at line 81 of file dm.hpp.

◆ m_testImageStream

template<class derivedT , typename realT >
IMAGE MagAOX::app::dev::dm< derivedT, realT >::m_testImageStream
protected

The ImageStreamIO shared memory buffer for the test.

Definition at line 126 of file dm.hpp.

◆ m_testLoaded

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_testLoaded {false}
protected

Flag indicating whether a test command is loaded in memory.

Definition at line 124 of file dm.hpp.

◆ m_testPath

template<class derivedT , typename realT >
std::string MagAOX::app::dev::dm< derivedT, realT >::m_testPath
protected

The path to this DM's test files (default is calibPath/tests;.

Definition at line 78 of file dm.hpp.

◆ m_testSet

template<class derivedT , typename realT >
bool MagAOX::app::dev::dm< derivedT, realT >::m_testSet {false}
protected

Flag indicating whether the test command has been set.

Definition at line 127 of file dm.hpp.


The documentation for this class was generated from the following file: