#include <frameGrabber.hpp>
Public Types | |
enum | fgFlip { fgFlipNone , fgFlipUD , fgFlipLR , fgFlipUDLR } |
typedef int32_t | cbIndexT |
Public Member Functions | |
int | setupConfig (mx::app::appConfigurator &config) |
Setup the configuration system. | |
int | loadConfig (mx::app::appConfigurator &config) |
load the configuration system results | |
int | appStartup () |
Startup function. | |
int | appLogic () |
Checks the framegrabber thread. | |
int | onPowerOff () |
On power off, sets m_reconfig to true. | |
int | appShutdown () |
Shuts down the framegrabber thread. | |
int | configCircBuffs () |
Telemeter Interface | |
int | recordFGTimings (bool force=false) |
Protected Member Functions | |
void * | loadImageIntoStreamCopy (void *dest, void *src, size_t width, size_t height, size_t szof) |
Protected Attributes | |
int | m_currentFlip { fgFlipNone } |
uint32_t | m_width { 0 } |
The width of the image, once deinterlaced etc. | |
uint32_t | m_height { 0 } |
The height of the image, once deinterlaced etc. | |
uint8_t | m_dataType { 0 } |
The ImageStreamIO type code. | |
size_t | m_typeSize { 0 } |
The size of the type, in bytes. Result of sizeof. | |
int | m_xbinning { 0 } |
The x-binning according to the framegrabber. | |
int | m_ybinning { 0 } |
The y-binning according to the framegrabber. | |
timespec | m_currImageTimestamp { 0, 0 } |
The timestamp of the current image. | |
bool | m_reconfig { false } |
Flag to set if a camera reconfiguration requires a framegrabber reset. | |
IMAGE * | m_imageStream { nullptr } |
The ImageStreamIO shared memory buffer. | |
float | m_cbFPS { 0 } |
The FPS used to configure the circular buffers. | |
mx::sigproc::circularBufferIndex< timespec, cbIndexT > | m_atimes |
mx::sigproc::circularBufferIndex< timespec, cbIndexT > | m_wtimes |
std::vector< double > | m_atimesD |
std::vector< double > | m_wtimesD |
std::vector< double > | m_watimesD |
timespec | m_dummy_ts { 0, 0 } |
uint64_t | m_dummy_cnt { 0 } |
char | m_dummy_c { 0 } |
double | m_mna |
double | m_vara |
double | m_mina |
double | m_maxa |
double | m_mnw |
double | m_varw |
double | m_minw |
double | m_maxw |
double | m_mnwa |
double | m_varwa |
Configurable Parameters | |
std::string | m_shmimName { "" } |
int | m_fgThreadPrio { 2 } |
Priority of the framegrabber thread, should normally be > 00. | |
std::string | m_fgCpuset |
The cpuset to assign the framegrabber thread to. Not used if empty, the default. | |
uint32_t | m_circBuffLength { 1 } |
Length of the circular buffer, in frames. | |
cbIndexT | m_latencyCircBuffMaxLength { 100000 } |
Maximum length of the latency measurement circular buffers. | |
float | m_latencyCircBuffMaxTime { 5 } |
Maximum time of the latency meaurement circular buffers. | |
int | m_defaultFlip { fgFlipNone } |
Private Member Functions | |
derivedT & | derived () |
Framegrabber Thread | |
This thread actually manages the framegrabbing hardware | |
bool | m_fgThreadInit { true } |
Synchronizer for thread startup, to allow priority setting to finish. | |
pid_t | m_fgThreadID { 0 } |
The ID of the framegrabber thread. | |
pcf::IndiProperty | m_fgThreadProp |
The property to hold the f.g. thread details. | |
std::thread | m_fgThread |
A separate thread for the actual framegrabbings. | |
static void | fgThreadStart (frameGrabber *o) |
Thread starter, called by MagAOXApp::threadStart on thread construction. Calls fgThreadExec. | |
void | fgThreadExec () |
Execute framegrabbing. | |
INDI | |
pcf::IndiProperty | m_indiP_shmimName |
Property used to report the shmim buffer name. | |
pcf::IndiProperty | m_indiP_frameSize |
Property used to report the current frame size. | |
pcf::IndiProperty | m_indiP_timing |
int | updateINDI () |
Update the INDI properties for this device controller. | |
MagAO-X generic frame grabber
The derived class derivedT
has the following requirements:
acquireAndCheckValid
>0 will indicate no data but not an error. In most cases, an appropriate state code, such as NOTCONNECTED, should be set as well.A static configuration variable must be defined in derivedT as
which determines whether or not the images can be flipped programatically.
Calls to this class's setupConfig
, loadConfig
, appStartup
, appLogic
, updateINDI
, and appShutdown
functions must be placed in the derived class's functions of the same name. For convenience the following macros are defined to provide error checking:
Definition at line 97 of file frameGrabber.hpp.
typedef int32_t MagAOX::app::dev::frameGrabber< derivedT >::cbIndexT |
Definition at line 108 of file frameGrabber.hpp.
enum MagAOX::app::dev::frameGrabber::fgFlip |
Enumerator | |
---|---|
fgFlipNone | |
fgFlipUD | |
fgFlipLR | |
fgFlipUDLR |
Definition at line 100 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::appLogic | ( | ) |
Checks the framegrabber thread.
This should be called in derivedT::appLogic
as
with appropriate error checking.
Definition at line 528 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::appShutdown | ( | ) |
Shuts down the framegrabber thread.
This should be called in derivedT::appShutdown
as
with appropriate error checking.
Definition at line 696 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::appShutdown(), MagAOX::app::baslerCtrl::appShutdown(), MagAOX::app::ocam2KCtrl::appShutdown(), MagAOX::app::picamCtrl::appShutdown(), MagAOX::app::qhyCtrl::appShutdown(), and MagAOX::app::zylaCtrl::appShutdown().
int MagAOX::app::dev::frameGrabber< derivedT >::appStartup | ( | ) |
Startup function.
Starts the framegrabber thread This should be called in derivedT::appStartup
as
with appropriate error checking.
Definition at line 450 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::configCircBuffs | ( | ) |
Definition at line 713 of file frameGrabber.hpp.
|
inlineprivate |
Definition at line 303 of file frameGrabber.hpp.
|
protected |
Execute framegrabbing.
Definition at line 757 of file frameGrabber.hpp.
Referenced by MagAOX::app::dev::frameGrabber< derivedT >::fgThreadStart().
|
staticprotected |
Thread starter, called by MagAOXApp::threadStart on thread construction. Calls fgThreadExec.
[in] | o | a pointer to a frameGrabber instance (normally this) |
Definition at line 751 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< 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 | the derived classes configurator |
Definition at line 392 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::loadConfig(), MagAOX::app::baslerCtrl::loadConfig(), MagAOX::app::ocam2KCtrl::loadConfig(), MagAOX::app::picamCtrl::loadConfig(), MagAOX::app::qhyCtrl::loadConfig(), and MagAOX::app::zylaCtrl::loadConfig().
|
protected |
Definition at line 962 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::onPowerOff | ( | ) |
On power off, sets m_reconfig to true.
This should be called in derivedT::onPowerOff
as
with appropriate error checking.
Definition at line 672 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::recordFGTimings | ( | bool | force = false | ) |
Definition at line 1022 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::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 310 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::setupConfig(), MagAOX::app::baslerCtrl::setupConfig(), MagAOX::app::ocam2KCtrl::setupConfig(), MagAOX::app::picamCtrl::setupConfig(), MagAOX::app::qhyCtrl::setupConfig(), and MagAOX::app::zylaCtrl::setupConfig().
int MagAOX::app::dev::frameGrabber< derivedT >::updateINDI | ( | ) |
Update the INDI properties for this device controller.
You should call this once per main loop. It is not called automatically.
Definition at line 987 of file frameGrabber.hpp.
|
protected |
Definition at line 149 of file frameGrabber.hpp.
|
protected |
Definition at line 152 of file frameGrabber.hpp.
|
protected |
The FPS used to configure the circular buffers.
Definition at line 147 of file frameGrabber.hpp.
|
protected |
Length of the circular buffer, in frames.
Definition at line 120 of file frameGrabber.hpp.
|
protected |
Definition at line 130 of file frameGrabber.hpp.
|
protected |
The timestamp of the current image.
Definition at line 141 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO type code.
Definition at line 135 of file frameGrabber.hpp.
|
protected |
Definition at line 126 of file frameGrabber.hpp.
|
protected |
Definition at line 158 of file frameGrabber.hpp.
|
protected |
Definition at line 157 of file frameGrabber.hpp.
|
protected |
Definition at line 156 of file frameGrabber.hpp.
|
protected |
The cpuset to assign the framegrabber thread to. Not used if empty, the default.
Definition at line 118 of file frameGrabber.hpp.
|
protected |
A separate thread for the actual framegrabbings.
Definition at line 257 of file frameGrabber.hpp.
|
protected |
The ID of the framegrabber thread.
Definition at line 253 of file frameGrabber.hpp.
|
protected |
Synchronizer for thread startup, to allow priority setting to finish.
Definition at line 251 of file frameGrabber.hpp.
|
protected |
Priority of the framegrabber thread, should normally be > 00.
Definition at line 117 of file frameGrabber.hpp.
|
protected |
The property to hold the f.g. thread details.
Definition at line 255 of file frameGrabber.hpp.
|
protected |
The height of the image, once deinterlaced etc.
Definition at line 133 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO shared memory buffer.
Definition at line 145 of file frameGrabber.hpp.
|
protected |
Property used to report the current frame size.
Definition at line 278 of file frameGrabber.hpp.
|
protected |
Property used to report the shmim buffer name.
Definition at line 276 of file frameGrabber.hpp.
|
protected |
Definition at line 280 of file frameGrabber.hpp.
|
protected |
Maximum length of the latency measurement circular buffers.
Definition at line 122 of file frameGrabber.hpp.
|
protected |
Maximum time of the latency meaurement circular buffers.
Definition at line 124 of file frameGrabber.hpp.
|
protected |
Definition at line 163 of file frameGrabber.hpp.
|
protected |
Definition at line 168 of file frameGrabber.hpp.
|
protected |
Definition at line 162 of file frameGrabber.hpp.
|
protected |
Definition at line 167 of file frameGrabber.hpp.
|
protected |
Definition at line 160 of file frameGrabber.hpp.
|
protected |
Definition at line 165 of file frameGrabber.hpp.
|
protected |
Definition at line 170 of file frameGrabber.hpp.
|
protected |
Flag to set if a camera reconfiguration requires a framegrabber reset.
Definition at line 143 of file frameGrabber.hpp.
|
protected |
The name of the shared memory image, is used in /tmp/<shmimName>.im.shm
. Derived classes should set a default.
Definition at line 114 of file frameGrabber.hpp.
|
protected |
The size of the type, in bytes. Result of sizeof.
Definition at line 136 of file frameGrabber.hpp.
|
protected |
Definition at line 161 of file frameGrabber.hpp.
|
protected |
Definition at line 166 of file frameGrabber.hpp.
|
protected |
Definition at line 171 of file frameGrabber.hpp.
|
protected |
Definition at line 154 of file frameGrabber.hpp.
|
protected |
The width of the image, once deinterlaced etc.
Definition at line 132 of file frameGrabber.hpp.
|
protected |
Definition at line 150 of file frameGrabber.hpp.
|
protected |
Definition at line 153 of file frameGrabber.hpp.
|
protected |
The x-binning according to the framegrabber.
Definition at line 138 of file frameGrabber.hpp.
|
protected |
The y-binning according to the framegrabber.
Definition at line 139 of file frameGrabber.hpp.