#include <dm.hpp>
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 | |
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... | |
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:
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.
int MagAOX::app::dev::dm< derivedT, realT >::allocate | ( | const dev::shmimT & | sp | ) |
Called after shmimMonitor connects to the dmXXdisp stream. Checks for proper size.
int MagAOX::app::dev::dm< derivedT, realT >::appLogic |
DM application logic.
This should be called in derivedT::appLogic
as
with appropriate error checking.
Definition at line 823 of file dm.hpp.
Referenced by MagAOX::app::alpaoCtrl::appLogic(), MagAOX::app::bmcCtrl::appLogic(), and MagAOX::app::irisaoCtrl::appLogic().
int MagAOX::app::dev::dm< derivedT, realT >::appShutdown |
DM shutdown.
This should be called in derivedT::appShutdown
as
with appropriate error checking.
Definition at line 880 of file dm.hpp.
Referenced by MagAOX::app::alpaoCtrl::appShutdown(), MagAOX::app::bmcCtrl::appShutdown(), and MagAOX::app::irisaoCtrl::appShutdown().
int MagAOX::app::dev::dm< derivedT, realT >::appStartup |
Startup function.
This should be called in derivedT::appStartup
as
with appropriate error checking.
Definition at line 689 of file dm.hpp.
Referenced by MagAOX::app::alpaoCtrl::appStartup(), MagAOX::app::bmcCtrl::appStartup(), and MagAOX::app::irisaoCtrl::appStartup().
int MagAOX::app::dev::dm< derivedT, realT >::checkFlats |
int MagAOX::app::dev::dm< derivedT, realT >::checkTests |
|
protected |
|
inlineprivate |
Definition at line 567 of file dm.hpp.
Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().
int MagAOX::app::dev::dm< derivedT, realT >::findDMChannels |
|
inlineprotected |
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
with appropriate error checking.
[in] | config | the 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().
int MagAOX::app::dev::dm< derivedT, realT >::loadFlat | ( | const std::string & | target | ) |
int MagAOX::app::dev::dm< derivedT, realT >::loadTest | ( | const std::string & | target | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_flats | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_init | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_release | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_setFlat | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_setTest | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_tests | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_zero | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::newCallBack_zeroAll | ( | const pcf::IndiProperty & | ipRecv | ) |
int MagAOX::app::dev::dm< derivedT, realT >::onPowerOff |
DM Poweroff.
This should be called in derivedT::onPowerOff
as
with appropriate error checking.
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*).
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
|
protected |
Execute saturation processing.
Definition at line 1879 of file dm.hpp.
Referenced by MagAOX::app::dev::dm< derivedT, realT >::satThreadStart().
|
staticprotected |
Thread starter, called by MagAOXApp::threadStart on thread construction. Calls satThreadExec.
[in] | d | a pointer to a dm instance (normally this) |
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.
[in] | update | If true, this is an update rather than a new set |
int MagAOX::app::dev::dm< derivedT, realT >::setTest |
Send the current test command to the DM.
Writes the command to the designated shmim.
int MagAOX::app::dev::dm< derivedT, realT >::setupConfig | ( | mx::app::appConfigurator & | config | ) |
Setup the configuration system.
This should be called in derivedT::setupConfig
as
with appropriate error checking.
[out] | config | the 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().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int MagAOX::app::dev::dm< derivedT, realT >::updateINDI |
int MagAOX::app::dev::dm< derivedT, realT >::whilePowerOff |
DM Poweroff Updates.
This should be called in derivedT::whilePowerOff
as
with appropriate error checking.
int MagAOX::app::dev::dm< derivedT, realT >::zeroAll | ( | bool | nosem = false | ) |
int MagAOX::app::dev::dm< derivedT, realT >::zeroFlat |
Zero the flat command on the DM.
Writes a 0 array the designated shmim.
int MagAOX::app::dev::dm< derivedT, realT >::zeroTest |
Zero the test command on the DM.
Writes a 0 array the designated shmim.
|
protected |
|
protected |
|
protected |
The directory relative to the calibPath. Set this before calling dm<derivedT,realT>::loadConfig().
|
protected |
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 102 of file dm.hpp.
Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().
|
protected |
Definition at line 103 of file dm.hpp.
Referenced by MagAOX::app::dev::dm< derivedT, realT >::intervalSatTrip().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |