A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera image.
More...
#include <dmPokeWFS.hpp>
|
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.
|
|
mx::improc::eigenImage< float > | m_darkImage |
| The dark image.
|
|
bool | m_darkValid {false} |
| Flag indicating if dark is valid based on its size.
|
|
float(* | darkPixget )(void *, size_t) |
|
mx::improc::milkImage< float > | m_dmStream |
| Pointer to a function to extract the dark image data as float.
|
|
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.
|
|
unsigned | m_imageSemWait_sec {1} |
| The timeout for the image semaphore, seconds component.
|
|
unsigned | m_imageSemWait_nsec {0} |
| The timeout for the image semaphore, nanoseconds component.
|
|
|
std::string | m_wfsCamDevName |
| INDI device name of the WFS camera. Default is wfscam.shmimName.
|
|
double | m_wfsSemWait {1.5} |
| The time in sec to wait on the WFS semaphore. Default 0.5 sec.
|
|
double | m_imageSemWait {0.5} |
| The time in sec to wait on the image semaphore. Default 0.5 sec.
|
|
unsigned | m_nPokeImages {5} |
| The number of images to average for the poke images. Default is 5.
|
|
unsigned | m_nPokeAverage {10} |
| The number of poke sequences to average. Default is 10.
|
|
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.
|
|
|
This thread coordinates the WFS process
|
int | m_wfsThreadPrio {1} |
| Priority of the WFS thread, should normally be > 00.
|
|
std::string | m_wfsCpuset |
| The cpuset for the framegrabber thread. Ignored if empty (the default).
|
|
std::thread | m_wfsThread |
| A separate thread for the actual WFSing.
|
|
bool | m_wfsThreadInit {true} |
| Synchronizer to ensure wfs thread initializes before doing dangerous things.
|
|
pid_t | m_wfsThreadID {0} |
| WFS thread PID.
|
|
pcf::IndiProperty | m_wfsThreadProp |
| The property to hold the WFS thread details.
|
|
sem_t | m_wfsSemaphore |
| Semaphore used to signal the WFS thread to start WFSing.
|
|
unsigned | m_wfsSemWait_sec {1} |
| The timeout for the WFS semaphore, seconds component.
|
|
unsigned | m_wfsSemWait_nsec {0} |
| The timeoutfor the WFS semaphore, nanoseconds component.
|
|
int | m_measuring {0} |
| Status of measuring: 0 no, 1 single in progress, 2 continuous in progress.
|
|
bool | m_single {false} |
| True a single measurement is in progress.
|
|
bool | m_continuous {false} |
| True if continuous measurements are in progress.
|
|
bool | m_stopMeasurement {false} |
| Used to request that the measurement in progress stop.
|
|
static void | wfsThreadStart (dmPokeWFS *s) |
| Thread starter, called by wfsThreadStart on thread construction. Calls wfsThreadExec.
|
|
void | wfsThreadExec () |
| Execute the frame grabber main loop.
|
|
template<class derivedT>
class MagAOX::app::dev::dmPokeWFS< derivedT >
A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera image.
CRTP class derivedT
has the following requirements:
- Must be derived from MagAOXApp<true>
- Must be derived from
dev::shmimMonitor<DERIVEDNAME, dev::dmPokeWFS<DERIVEDNAME>::wfsShmimT>
(replace DERIVEDNAME with derivedT class name)
- Must be derived from
dev::shmimMonitor<DERIVEDNAME, dev::dmPokeWFS<DERIVEDNAME>::darkShmimT>
(replace DERIVEDNAME with derivedT class name)
- Must contain the following friend declarations (replace DERIVEDNAME with derivedT class name):
friend class
dev::shmimMonitor<DERIVEDNAME, dev::dmPokeWFS<DERIVEDNAME>::darkShmimT>;
A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera i...
- Must contain the following typedefs (replace DERIVEDNAME with derivedT class name):
- Must provide the following interfaces:
{
return *static_cast<shmimMonitorT *>(this);
}
darkShmimMonitorT & darkShmimMonitor()
{
return *static_cast<darkShmimMonitorT *>(this);
}
- If derivedT has additional shmimMonitor parents, you will need to include these lines in the class declaration:
using dmPokeWFST::allocate;
using dmPokeWFST::processImage;
- Must provide the following interface:
int runSensor(bool firstRun
);
- Must provide the following interface: At the conclusion of analyzeSensor the measured signal (e.g. deltaX and deltaY) should be updated and set in m_indiP_measurement. The function updateMeasurement() can be used for this. However, the updating of the loop counter and the subsequent INDI property update is handled automatically after that.
- Must be a telemeter with the following interface:
- Must be derived from
dev::telemeter<DERIVEDNAME>
(replace DERIVEDNAME with derivedT class name) and meet the requirements of dev::telemeter
- In the function
derivedT::checkRecordTimes()
required by dev::telemeter
, the telem_pokeloop
type must be checked. The minimum derivedT::checkRecordTimes()
is: int checkRecordTimes()
{
return telemeterT::checkRecordTimes(telem_pokeloop());
}
- Must call this base class's setupConfig(), loadConfig(), appStartup(), appStartup(), and appShutdown() in the appropriate functions. For convenience the following macros are defined to provide error checking:
#define DMPOKEWFS_APP_SHUTDOWN
Call dmPokeWFS::appShutdown with error checking.
#define DMPOKEWFS_APP_STARTUP
Call dmPokeWFS::appStartup with error checking.
#define DMPOKEWFS_SETUP_CONFIG(cfig)
Call dmPokeWFS::setupConfig with error checking.
#define DMPOKEWFS_LOAD_CONFIG(cfig)
Call dmPokeWFS::loadConfig with error checking.
#define DMPOKEWFS_APP_LOGIC
Call dmPokeWFS::appLogic with error checking.
Definition at line 136 of file dmPokeWFS.hpp.
◆ allocate() [1/2]
template<class derivedT >
◆ allocate() [2/2]
template<class derivedT >
◆ appLogic()
template<class derivedT >
dmPokeWFS application logic
This should be called in derivedT::appLogic
as
int appLogic()
dmPokeWFS application logic
with appropriate error checking.
- Returns
- 0 on success
-
-1 on error, which is logged.
Definition at line 571 of file dmPokeWFS.hpp.
◆ appShutdown()
template<class derivedT >
dmPokeWFS shutdown
This should be called in derivedT::appShutdown
as
int appShutdown()
dmPokeWFS shutdown
with appropriate error checking.
- Returns
- 0 on success
-
-1 on error, which is logged.
Definition at line 634 of file dmPokeWFS.hpp.
◆ appStartup()
template<class derivedT >
Startup function.
This should be called in derivedT::appStartup
as
int appStartup()
Startup function.
with appropriate error checking.
- Returns
- 0 on success
-
-1 on error, which is logged.
Definition at line 515 of file dmPokeWFS.hpp.
◆ basicRunSensor()
template<class derivedT >
Run the basic +/- poke sensor steps.
Coordinates the actions of poking and collecting images.
This can be called from the derived class runSensor.
- Returns
- +1 if exit is due to shutdown or stop request
-
0 if no error
-
-1 if an error occurs
Definition at line 944 of file dmPokeWFS.hpp.
◆ basicTimedPoke()
template<class derivedT >
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.
- Returns
- +1 if exit is due to shutdown or stop request
-
0 if no error
-
-1 if an error occurs
- Parameters
-
[in] | pokeSign | the sign, and possibly a scaling, to apply to m_pokeAmplitude |
Definition at line 885 of file dmPokeWFS.hpp.
◆ derived()
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [1/6]
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [2/6]
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [3/6]
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [4/6]
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [5/6]
template<class derivedT >
◆ INDI_NEWCALLBACK_DECL() [6/6]
template<class derivedT >
◆ INDI_SETCALLBACK_DECL()
template<class derivedT >
◆ loadConfig()
template<class derivedT >
load the configuration system results
This should be called in derivedT::loadConfig
as
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
with appropriate error checking.
- Parameters
-
[in] | config | an application configuration from which to load values |
Definition at line 466 of file dmPokeWFS.hpp.
◆ processImage() [1/2]
template<class derivedT >
- Parameters
-
[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.
◆ processImage() [2/2]
template<class derivedT >
- Parameters
-
[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.
◆ recordPokeLoop()
template<class derivedT >
◆ recordTelem()
template<class derivedT >
◆ setupConfig()
template<class derivedT >
Setup the configuration system.
This should be called in derivedT::setupConfig
as
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
with appropriate error checking.
- Parameters
-
[in] | config | an application configuration to load values to |
Definition at line 434 of file dmPokeWFS.hpp.
◆ updateMeasurement()
template<class derivedT >
◆ wfsThreadExec()
template<class derivedT >
◆ wfsThreadStart()
template<class derivedT >
Thread starter, called by wfsThreadStart on thread construction. Calls wfsThreadExec.
- Parameters
-
Definition at line 791 of file dmPokeWFS.hpp.
◆ darkPixget
template<class derivedT >
◆ m_continuous
template<class derivedT >
True if continuous measurements are in progress.
Definition at line 343 of file dmPokeWFS.hpp.
◆ m_counter
template<class derivedT >
◆ m_darkImage
template<class derivedT >
◆ m_darkValid
template<class derivedT >
Flag indicating if dark is valid based on its size.
Definition at line 207 of file dmPokeWFS.hpp.
◆ m_deltaX
template<class derivedT >
◆ m_deltaY
template<class derivedT >
◆ m_dmChan
template<class derivedT >
◆ m_dmImage
template<class derivedT >
◆ m_dmSleep
template<class derivedT >
The time to sleep for the DM command to be applied, in microseconds. Default is 10000.
Definition at line 190 of file dmPokeWFS.hpp.
◆ m_dmStream
template<class derivedT >
Pointer to a function to extract the dark image data as float.
Definition at line 211 of file dmPokeWFS.hpp.
◆ m_imageSemaphore
template<class derivedT >
Semaphore used to signal that an image is ready.
Definition at line 349 of file dmPokeWFS.hpp.
◆ m_imageSemWait
template<class derivedT >
The time in sec to wait on the image semaphore. Default 0.5 sec.
Definition at line 177 of file dmPokeWFS.hpp.
◆ m_imageSemWait_nsec
template<class derivedT >
The timeout for the image semaphore, nanoseconds component.
Definition at line 353 of file dmPokeWFS.hpp.
◆ m_imageSemWait_sec
template<class derivedT >
The timeout for the image semaphore, seconds component.
Definition at line 351 of file dmPokeWFS.hpp.
◆ m_indiP_continuous
template<class derivedT >
Switch to start continuous measurement.
Definition at line 404 of file dmPokeWFS.hpp.
◆ m_indiP_measurement
template<class derivedT >
Property to report the delta measurement, including the loop counter.
Definition at line 410 of file dmPokeWFS.hpp.
◆ m_indiP_nPokeAverage
template<class derivedT >
◆ m_indiP_nPokeImages
template<class derivedT >
◆ m_indiP_poke_amp
template<class derivedT >
◆ m_indiP_single
template<class derivedT >
Switch to start a single measurement.
Definition at line 401 of file dmPokeWFS.hpp.
◆ m_indiP_stop
template<class derivedT >
Switch to request that measurement stop.
Definition at line 407 of file dmPokeWFS.hpp.
◆ m_indiP_wfsFps
template<class derivedT >
Property to get the FPS from the WFS camera.
Definition at line 398 of file dmPokeWFS.hpp.
◆ m_measuring
template<class derivedT >
Status of measuring: 0 no, 1 single in progress, 2 continuous in progress.
Definition at line 339 of file dmPokeWFS.hpp.
◆ m_nPokeAverage
template<class derivedT >
The number of poke sequences to average. Default is 10.
Definition at line 181 of file dmPokeWFS.hpp.
◆ m_nPokeImages
template<class derivedT >
The number of images to average for the poke images. Default is 5.
Definition at line 179 of file dmPokeWFS.hpp.
◆ m_poke_amp
template<class derivedT >
◆ m_poke_x
template<class derivedT >
◆ m_poke_y
template<class derivedT >
◆ m_pokeImage
template<class derivedT >
◆ m_pokeLocal
template<class derivedT >
◆ m_rawImage
template<class derivedT >
◆ m_single
template<class derivedT >
True a single measurement is in progress.
Definition at line 341 of file dmPokeWFS.hpp.
◆ m_stopMeasurement
template<class derivedT >
Used to request that the measurement in progress stop.
Definition at line 345 of file dmPokeWFS.hpp.
◆ m_wfsCamDevName
template<class derivedT >
INDI device name of the WFS camera. Default is wfscam.shmimName.
Definition at line 173 of file dmPokeWFS.hpp.
◆ m_wfsCpuset
template<class derivedT >
The cpuset for the framegrabber thread. Ignored if empty (the default).
Definition at line 317 of file dmPokeWFS.hpp.
◆ m_wfsFps
template<class derivedT >
Pointer to a function to extract the image data as float.
The WFS camera FPS
Definition at line 203 of file dmPokeWFS.hpp.
◆ m_wfsImageMutex
template<class derivedT >
◆ m_wfsSemaphore
template<class derivedT >
Semaphore used to signal the WFS thread to start WFSing.
Definition at line 333 of file dmPokeWFS.hpp.
◆ m_wfsSemWait
template<class derivedT >
The time in sec to wait on the WFS semaphore. Default 0.5 sec.
Definition at line 175 of file dmPokeWFS.hpp.
◆ m_wfsSemWait_nsec
template<class derivedT >
The timeoutfor the WFS semaphore, nanoseconds component.
Definition at line 337 of file dmPokeWFS.hpp.
◆ m_wfsSemWait_sec
template<class derivedT >
The timeout for the WFS semaphore, seconds component.
Definition at line 335 of file dmPokeWFS.hpp.
◆ m_wfsThread
template<class derivedT >
A separate thread for the actual WFSing.
Definition at line 319 of file dmPokeWFS.hpp.
◆ m_wfsThreadID
template<class derivedT >
◆ m_wfsThreadInit
template<class derivedT >
Synchronizer to ensure wfs thread initializes before doing dangerous things.
Definition at line 321 of file dmPokeWFS.hpp.
◆ m_wfsThreadPrio
template<class derivedT >
Priority of the WFS thread, should normally be > 00.
Definition at line 315 of file dmPokeWFS.hpp.
◆ m_wfsThreadProp
template<class derivedT >
The property to hold the WFS thread details.
Definition at line 325 of file dmPokeWFS.hpp.
◆ wfsPixget
template<class derivedT >
The documentation for this class was generated from the following file: