A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera image. More...
#include <dmPokeWFS.hpp>
Classes | |
struct | darkShmimT |
struct | wfsShmimT |
Public Member Functions | |
MagAOXApp Interface | |
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 () |
dmPokeWFS application logic More... | |
int | appShutdown () |
dmPokeWFS shutdown More... | |
shmimMonitor Interface | |
int | allocate (const wfsShmimT &) |
int | processImage (void *curr_src, const wfsShmimT &) |
darkShmimMonitor Interface | |
int | allocate (const darkShmimT &) |
int | processImage (void *curr_src, const darkShmimT &) |
Protected Member Functions | |
int | basicTimedPoke (float pokeSign) |
Apply a single DM poke pattern and record the results. More... | |
int | basicRunSensor () |
Run the basic +/- poke sensor steps. More... | |
int | updateMeasurement (float deltaX, float deltaY) |
Telemeter Interface | |
int | recordTelem (const telem_pokeloop *) |
int | recordPokeLoop (bool force=false) |
Protected Attributes | |
std::mutex | m_wfsImageMutex |
mx::improc::milkImage< float > | m_rawImage |
mx::improc::milkImage< float > | m_pokeImage |
mx::improc::eigenImage< float > | m_pokeLocal |
float(* | wfsPixget )(void *, size_t) |
float | m_wfsFps {-1} |
Pointer to a function to extract the image data as float. More... | |
mx::improc::eigenImage< float > | m_darkImage |
The dark image. More... | |
bool | m_darkValid {false} |
Flag indicating if dark is valid based on its size. More... | |
float(* | darkPixget )(void *, size_t) |
mx::improc::milkImage< float > | m_dmStream |
Pointer to a function to extract the dark image data as float. More... | |
mx::improc::eigenImage< float > | m_dmImage |
float | m_deltaX {0} |
float | m_deltaY {0} |
uint64_t | m_counter {0} |
sem_t | m_imageSemaphore |
Semaphore used to signal that an image is ready. More... | |
unsigned | m_imageSemWait_sec {1} |
The timeout for the image semaphore, seconds component. More... | |
unsigned | m_imageSemWait_nsec {0} |
The timeout for the image semaphore, nanoseconds component. More... | |
Configurable Parameters | |
std::string | m_wfsCamDevName |
INDI device name of the WFS camera. Default is wfscam.shmimName. More... | |
double | m_wfsSemWait {1.5} |
The time in sec to wait on the WFS semaphore. Default 0.5 sec. More... | |
double | m_imageSemWait {0.5} |
The time in sec to wait on the image semaphore. Default 0.5 sec. More... | |
unsigned | m_nPokeImages {5} |
The number of images to average for the poke images. Default is 5. More... | |
unsigned | m_nPokeAverage {10} |
The number of poke sequences to average. Default is 10. More... | |
std::string | m_dmChan |
std::vector< int > | m_poke_x |
std::vector< int > | m_poke_y |
float | m_poke_amp {0.0} |
float | m_dmSleep {10000} |
The time to sleep for the DM command to be applied, in microseconds. Default is 10000. More... | |
Private Member Functions | |
derivedT & | derived () |
WFS Thread | |
int | m_wfsThreadPrio {1} |
Priority of the WFS thread, should normally be > 00. More... | |
std::string | m_wfsCpuset |
The cpuset for the framegrabber thread. Ignored if empty (the default). More... | |
std::thread | m_wfsThread |
A separate thread for the actual WFSing. More... | |
bool | m_wfsThreadInit {true} |
Synchronizer to ensure wfs thread initializes before doing dangerous things. More... | |
pid_t | m_wfsThreadID {0} |
WFS thread PID. More... | |
pcf::IndiProperty | m_wfsThreadProp |
The property to hold the WFS thread details. More... | |
sem_t | m_wfsSemaphore |
Semaphore used to signal the WFS thread to start WFSing. More... | |
unsigned | m_wfsSemWait_sec {1} |
The timeout for the WFS semaphore, seconds component. More... | |
unsigned | m_wfsSemWait_nsec {0} |
The timeoutfor the WFS semaphore, nanoseconds component. More... | |
int | m_measuring {0} |
Status of measuring: 0 no, 1 single in progress, 2 continuous in progress. More... | |
bool | m_single {false} |
True a single measurement is in progress. More... | |
bool | m_continuous {false} |
True if continuous measurements are in progress. More... | |
bool | m_stopMeasurement {false} |
Used to request that the measurement in progress stop. More... | |
static void | wfsThreadStart (dmPokeWFS *s) |
Thread starter, called by wfsThreadStart on thread construction. Calls wfsThreadExec. More... | |
void | wfsThreadExec () |
Execute the frame grabber main loop. More... | |
INDI Interface | |
pcf::IndiProperty | m_indiP_poke_amp |
pcf::IndiProperty | m_indiP_nPokeImages |
pcf::IndiProperty | m_indiP_nPokeAverage |
pcf::IndiProperty | m_indiP_wfsFps |
Property to get the FPS from the WFS camera. More... | |
pcf::IndiProperty | m_indiP_single |
Switch to start a single measurement. More... | |
pcf::IndiProperty | m_indiP_continuous |
Switch to start continuous measurement. More... | |
pcf::IndiProperty | m_indiP_stop |
Switch to request that measurement stop. More... | |
pcf::IndiProperty | m_indiP_measurement |
Property to report the delta measurement, including the loop counter. More... | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_poke_amp) | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_nPokeImages) | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_nPokeAverage) | |
INDI_SETCALLBACK_DECL (derivedT, m_indiP_wfsFps) | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_single) | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_continuous) | |
INDI_NEWCALLBACK_DECL (derivedT, m_indiP_stop) | |
A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera image.
CRTP class derivedT
has the following requirements:
dev::shmimMonitor<DERIVEDNAME, dev::dmPokeWFS<DERIVEDNAME>wfsShmimT>
(replace DERIVEDNAME with derivedT class name)dev::shmimMonitor<DERIVEDNAME, dev::dmPokeWFS<DERIVEDNAME>::darkShmimT>
(replace DERIVEDNAME with derivedT class name)dev::telemeter<DERIVEDNAME>
(replace DERIVEDNAME with derivedT class name) and meet the requirements of dev::telemeter
derivedT::checkRecordTimes()
required by dev::telemeter
, the telem_pokeloop
type must be checked. The minimum derivedT::checkRecordTimes()
is: Definition at line 136 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::allocate | ( | const darkShmimT & | dummy | ) |
[in] | dummy | tag to differentiate shmimMonitor parents. |
Definition at line 744 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::allocate | ( | const wfsShmimT & | dummy | ) |
[in] | dummy | tag to differentiate shmimMonitor parents. |
Definition at line 662 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::appLogic |
dmPokeWFS application logic
This should be called in derivedT::appLogic
as
with appropriate error checking.
Definition at line 571 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::appShutdown |
dmPokeWFS shutdown
This should be called in derivedT::appShutdown
as
with appropriate error checking.
Definition at line 634 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::appStartup |
Startup function.
This should be called in derivedT::appStartup
as
with appropriate error checking.
Definition at line 515 of file dmPokeWFS.hpp.
|
protected |
Run the basic +/- poke sensor steps.
Coordinates the actions of poking and collecting images.
This can be called from the derived class runSensor.
Definition at line 944 of file dmPokeWFS.hpp.
|
protected |
Apply a single DM poke pattern and record the results.
This accumulates m_nPokeImages*m_nPokeAverage images in m_pokeLocal, so m_pokeLocal should be zeroed before the first call to this (e.g. for a +1 poke), but not zeroed before the second call (e.g. for the -1 poke). You also need to 0 the DM after finishing a poke pair. See basicRunSensor() for how to use.
[in] | pokeSign | the sign, and possibly a scaling, to apply to m_pokeAmplitude |
Definition at line 885 of file dmPokeWFS.hpp.
|
inlineprivate |
Definition at line 426 of file dmPokeWFS.hpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int MagAOX::app::dev::dmPokeWFS< derivedT >::loadConfig | ( | mx::app::appConfigurator & | config | ) |
load the configuration system results
This should be called in derivedT::loadConfig
as
with appropriate error checking.
[in] | config | an application configuration from which to load values |
Definition at line 466 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::processImage | ( | void * | curr_src, |
const darkShmimT & | dummy | ||
) |
[in] | curr_src | pointer to the start of the current frame |
[in] | dummy | tag to differentiate shmimMonitor parents. |
Definition at line 770 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::processImage | ( | void * | curr_src, |
const wfsShmimT & | dummy | ||
) |
[in] | curr_src | pointer to the start of the current frame |
[in] | dummy | tag to differentiate shmimMonitor parents. |
Definition at line 704 of file dmPokeWFS.hpp.
|
protected |
Definition at line 1180 of file dmPokeWFS.hpp.
|
protected |
Definition at line 1174 of file dmPokeWFS.hpp.
int MagAOX::app::dev::dmPokeWFS< derivedT >::setupConfig | ( | mx::app::appConfigurator & | config | ) |
Setup the configuration system.
This should be called in derivedT::setupConfig
as
with appropriate error checking.
[in] | config | an application configuration to load values to |
Definition at line 434 of file dmPokeWFS.hpp.
|
protected |
Definition at line 1015 of file dmPokeWFS.hpp.
|
protected |
Execute the frame grabber main loop.
Definition at line 797 of file dmPokeWFS.hpp.
Referenced by MagAOX::app::dev::dmPokeWFS< derivedT >::wfsThreadStart().
|
staticprotected |
Thread starter, called by wfsThreadStart on thread construction. Calls wfsThreadExec.
[in] | s | a pointer to an streamWriter instance (normally this) |
Definition at line 791 of file dmPokeWFS.hpp.
|
inlineprotected |
Definition at line 209 of file dmPokeWFS.hpp.
|
protected |
True if continuous measurements are in progress.
Definition at line 343 of file dmPokeWFS.hpp.
|
protected |
Definition at line 217 of file dmPokeWFS.hpp.
|
protected |
The dark image.
Definition at line 205 of file dmPokeWFS.hpp.
|
protected |
Flag indicating if dark is valid based on its size.
Definition at line 207 of file dmPokeWFS.hpp.
|
protected |
Definition at line 215 of file dmPokeWFS.hpp.
|
protected |
Definition at line 216 of file dmPokeWFS.hpp.
|
protected |
Definition at line 183 of file dmPokeWFS.hpp.
|
protected |
Definition at line 213 of file dmPokeWFS.hpp.
|
protected |
The time to sleep for the DM command to be applied, in microseconds. Default is 10000.
Definition at line 190 of file dmPokeWFS.hpp.
|
protected |
Pointer to a function to extract the dark image data as float.
Definition at line 211 of file dmPokeWFS.hpp.
|
protected |
Semaphore used to signal that an image is ready.
Definition at line 349 of file dmPokeWFS.hpp.
|
protected |
The time in sec to wait on the image semaphore. Default 0.5 sec.
Definition at line 177 of file dmPokeWFS.hpp.
|
protected |
The timeout for the image semaphore, nanoseconds component.
Definition at line 353 of file dmPokeWFS.hpp.
|
protected |
The timeout for the image semaphore, seconds component.
Definition at line 351 of file dmPokeWFS.hpp.
|
protected |
Switch to start continuous measurement.
Definition at line 404 of file dmPokeWFS.hpp.
|
protected |
Property to report the delta measurement, including the loop counter.
Definition at line 410 of file dmPokeWFS.hpp.
|
protected |
Definition at line 395 of file dmPokeWFS.hpp.
|
protected |
Definition at line 392 of file dmPokeWFS.hpp.
|
protected |
Definition at line 389 of file dmPokeWFS.hpp.
|
protected |
Switch to start a single measurement.
Definition at line 401 of file dmPokeWFS.hpp.
|
protected |
Switch to request that measurement stop.
Definition at line 407 of file dmPokeWFS.hpp.
|
protected |
Property to get the FPS from the WFS camera.
Definition at line 398 of file dmPokeWFS.hpp.
|
protected |
Status of measuring: 0 no, 1 single in progress, 2 continuous in progress.
Definition at line 339 of file dmPokeWFS.hpp.
|
protected |
The number of poke sequences to average. Default is 10.
Definition at line 181 of file dmPokeWFS.hpp.
|
protected |
The number of images to average for the poke images. Default is 5.
Definition at line 179 of file dmPokeWFS.hpp.
|
protected |
Definition at line 188 of file dmPokeWFS.hpp.
|
protected |
Definition at line 185 of file dmPokeWFS.hpp.
|
protected |
Definition at line 186 of file dmPokeWFS.hpp.
|
protected |
Definition at line 198 of file dmPokeWFS.hpp.
|
protected |
Definition at line 199 of file dmPokeWFS.hpp.
|
protected |
Definition at line 196 of file dmPokeWFS.hpp.
|
protected |
True a single measurement is in progress.
Definition at line 341 of file dmPokeWFS.hpp.
|
protected |
Used to request that the measurement in progress stop.
Definition at line 345 of file dmPokeWFS.hpp.
|
protected |
INDI device name of the WFS camera. Default is wfscam.shmimName.
Definition at line 173 of file dmPokeWFS.hpp.
|
protected |
The cpuset for the framegrabber thread. Ignored if empty (the default).
Definition at line 317 of file dmPokeWFS.hpp.
|
protected |
Pointer to a function to extract the image data as float.
The WFS camera FPS
Definition at line 203 of file dmPokeWFS.hpp.
|
protected |
Definition at line 194 of file dmPokeWFS.hpp.
|
protected |
Semaphore used to signal the WFS thread to start WFSing.
Definition at line 333 of file dmPokeWFS.hpp.
|
protected |
The time in sec to wait on the WFS semaphore. Default 0.5 sec.
Definition at line 175 of file dmPokeWFS.hpp.
|
protected |
The timeoutfor the WFS semaphore, nanoseconds component.
Definition at line 337 of file dmPokeWFS.hpp.
|
protected |
The timeout for the WFS semaphore, seconds component.
Definition at line 335 of file dmPokeWFS.hpp.
|
protected |
A separate thread for the actual WFSing.
Definition at line 319 of file dmPokeWFS.hpp.
|
protected |
WFS thread PID.
Definition at line 323 of file dmPokeWFS.hpp.
|
protected |
Synchronizer to ensure wfs thread initializes before doing dangerous things.
Definition at line 321 of file dmPokeWFS.hpp.
|
protected |
Priority of the WFS thread, should normally be > 00.
Definition at line 315 of file dmPokeWFS.hpp.
|
protected |
The property to hold the WFS thread details.
Definition at line 325 of file dmPokeWFS.hpp.
|
inlineprotected |
Definition at line 201 of file dmPokeWFS.hpp.