#include <frameGrabber.hpp>
Public Types | |
enum | fgFlip { fgFlipNone , fgFlipUD , fgFlipLR , fgFlipUDLR } |
Public Member Functions | |
void | setupConfig (mx::app::appConfigurator &config) |
Setup the configuration system. More... | |
void | loadConfig (mx::app::appConfigurator &config) |
load the configuration system results More... | |
int | appStartup () |
Startup function. More... | |
int | appLogic () |
Checks the framegrabber thread. More... | |
int | onPowerOff () |
On power off, sets m_reconfig to true. More... | |
int | appShutdown () |
Shuts down the framegrabber thread. More... | |
Telemeter Interface | |
int | recordFGTimings (bool force=false) |
Protected Types | |
typedef uint16_t | cbIndexT |
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. More... | |
uint32_t | m_height {0} |
The height of the image, once deinterlaced etc. More... | |
uint8_t | m_dataType {0} |
The ImageStreamIO type code. More... | |
size_t | m_typeSize {0} |
The size of the type, in bytes. Result of sizeof. More... | |
int | m_xbinning {0} |
The x-binning according to the framegrabber. More... | |
int | m_ybinning {0} |
The y-binning according to the framegrabber. More... | |
timespec | m_currImageTimestamp {0,0} |
The timestamp of the current image. More... | |
bool | m_reconfig {false} |
Flag to set if a camera reconfiguration requires a framegrabber reset. More... | |
IMAGE * | m_imageStream {nullptr} |
The ImageStreamIO shared memory buffer. More... | |
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_mnw |
double | m_varw |
double | m_mnwa |
double | m_varwa |
Configurable Parameters | |
std::string | m_shmimName {""} |
The name of the shared memory image, is used in /tmp/<shmimName>.im.shm . Derived classes should set a default. More... | |
int | m_fgThreadPrio {2} |
Priority of the framegrabber thread, should normally be > 00. More... | |
std::string | m_fgCpuset |
The cpuset to assign the framegrabber thread to. Not used if empty, the default. More... | |
uint32_t | m_circBuffLength {1} |
Length of the circular buffer, in frames. More... | |
uint16_t | m_latencyCircBuffMaxLength {3600} |
Maximum length of the latency measurement circular buffers. More... | |
float | m_latencyCircBuffMaxTime {5} |
Maximum time of the latency meaurement circular buffers. More... | |
int | m_defaultFlip {fgFlipNone} |
Private Member Functions | |
derivedT & | derived () |
Framegrabber Thread | |
bool | m_fgThreadInit {true} |
Synchronizer for thread startup, to allow priority setting to finish. More... | |
pid_t | m_fgThreadID {0} |
The ID of the framegrabber thread. More... | |
pcf::IndiProperty | m_fgThreadProp |
The property to hold the f.g. thread details. More... | |
std::thread | m_fgThread |
A separate thread for the actual framegrabbings. More... | |
static void | fgThreadStart (frameGrabber *o) |
Thread starter, called by MagAOXApp::threadStart on thread construction. Calls fgThreadExec. More... | |
void | fgThreadExec () |
Execute framegrabbing. More... | |
INDI | |
pcf::IndiProperty | m_indiP_shmimName |
Property used to report the shmim buffer name. More... | |
pcf::IndiProperty | m_indiP_frameSize |
Property used to report the current frame size. More... | |
pcf::IndiProperty | m_indiP_timing |
int | updateINDI () |
Update the INDI properties for this device controller. More... | |
MagAO-X generic frame grabber
The derived class derivedT
must expose the following interface
Each of the above functions should return 0 on success, and -1 on an error (except fps). For 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
and appShutdown
functions must be placed in the derived class's functions of the same name.
Definition at line 78 of file frameGrabber.hpp.
|
protected |
Definition at line 120 of file frameGrabber.hpp.
enum MagAOX::app::dev::frameGrabber::fgFlip |
Enumerator | |
---|---|
fgFlipNone | |
fgFlipUD | |
fgFlipLR | |
fgFlipUDLR |
Definition at line 81 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 434 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 525 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::appShutdown(), MagAOX::app::cameraSim::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 367 of file frameGrabber.hpp.
|
inlineprivate |
Definition at line 283 of file frameGrabber.hpp.
|
protected |
Execute framegrabbing.
Definition at line 553 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 546 of file frameGrabber.hpp.
void 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 312 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::loadConfig(), MagAOX::app::cameraSim::loadConfig(), MagAOX::app::ocam2KCtrl::loadConfig(), MagAOX::app::picamCtrl::loadConfig(), MagAOX::app::qhyCtrl::loadConfig(), MagAOX::app::zylaCtrl::loadConfig(), and MagAOX::app::pvcamCtrl::loadConfigImpl().
|
protected |
Definition at line 734 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 503 of file frameGrabber.hpp.
int MagAOX::app::dev::frameGrabber< derivedT >::recordFGTimings | ( | bool | force = false | ) |
Definition at line 786 of file frameGrabber.hpp.
void 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 290 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::setupConfig(), MagAOX::app::cameraSim::setupConfig(), MagAOX::app::ocam2KCtrl::setupConfig(), MagAOX::app::picamCtrl::setupConfig(), MagAOX::app::pvcamCtrl::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 766 of file frameGrabber.hpp.
|
protected |
Definition at line 122 of file frameGrabber.hpp.
|
protected |
Definition at line 125 of file frameGrabber.hpp.
|
protected |
Length of the circular buffer, in frames.
Definition at line 93 of file frameGrabber.hpp.
|
protected |
Definition at line 102 of file frameGrabber.hpp.
|
protected |
The timestamp of the current image.
Definition at line 114 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO type code.
Definition at line 107 of file frameGrabber.hpp.
|
protected |
Definition at line 98 of file frameGrabber.hpp.
|
protected |
Definition at line 131 of file frameGrabber.hpp.
|
protected |
Definition at line 130 of file frameGrabber.hpp.
|
protected |
Definition at line 129 of file frameGrabber.hpp.
|
protected |
The cpuset to assign the framegrabber thread to. Not used if empty, the default.
Definition at line 91 of file frameGrabber.hpp.
|
protected |
A separate thread for the actual framegrabbings.
Definition at line 230 of file frameGrabber.hpp.
|
protected |
The ID of the framegrabber thread.
Definition at line 226 of file frameGrabber.hpp.
|
protected |
Synchronizer for thread startup, to allow priority setting to finish.
Definition at line 224 of file frameGrabber.hpp.
|
protected |
Priority of the framegrabber thread, should normally be > 00.
Definition at line 90 of file frameGrabber.hpp.
|
protected |
The property to hold the f.g. thread details.
Definition at line 228 of file frameGrabber.hpp.
|
protected |
The height of the image, once deinterlaced etc.
Definition at line 105 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO shared memory buffer.
Definition at line 118 of file frameGrabber.hpp.
|
protected |
Property used to report the current frame size.
Definition at line 258 of file frameGrabber.hpp.
|
protected |
Property used to report the shmim buffer name.
Definition at line 256 of file frameGrabber.hpp.
|
protected |
Definition at line 260 of file frameGrabber.hpp.
|
protected |
Maximum length of the latency measurement circular buffers.
Definition at line 95 of file frameGrabber.hpp.
|
protected |
Maximum time of the latency meaurement circular buffers.
Definition at line 96 of file frameGrabber.hpp.
|
protected |
Definition at line 133 of file frameGrabber.hpp.
|
protected |
Definition at line 136 of file frameGrabber.hpp.
|
protected |
Definition at line 139 of file frameGrabber.hpp.
|
protected |
Flag to set if a camera reconfiguration requires a framegrabber reset.
Definition at line 116 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 88 of file frameGrabber.hpp.
|
protected |
The size of the type, in bytes. Result of sizeof.
Definition at line 108 of file frameGrabber.hpp.
|
protected |
Definition at line 134 of file frameGrabber.hpp.
|
protected |
Definition at line 137 of file frameGrabber.hpp.
|
protected |
Definition at line 140 of file frameGrabber.hpp.
|
protected |
Definition at line 127 of file frameGrabber.hpp.
|
protected |
The width of the image, once deinterlaced etc.
Definition at line 104 of file frameGrabber.hpp.
|
protected |
Definition at line 123 of file frameGrabber.hpp.
|
protected |
Definition at line 126 of file frameGrabber.hpp.
|
protected |
The x-binning according to the framegrabber.
Definition at line 110 of file frameGrabber.hpp.
|
protected |
The y-binning according to the framegrabber.
Definition at line 111 of file frameGrabber.hpp.