#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) |
| int | openShmim () |
Protected Attributes | |
| 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. | |
| bool | m_ownShmim { true } |
| Flag controlling if the shmim is owned. If true it will be destroyed as needed. | |
| ino_t | m_inode { 0 } |
| The inode of the image stream file. | |
| 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.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 99 of file frameGrabber.hpp.
| typedef int32_t MagAOX::app::dev::frameGrabber< derivedT >::cbIndexT |
Definition at line 110 of file frameGrabber.hpp.
| enum MagAOX::app::dev::frameGrabber::fgFlip |
| Enumerator | |
|---|---|
| fgFlipNone | |
| fgFlipUD | |
| fgFlipLR | |
| fgFlipUDLR | |
Definition at line 102 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 551 of file frameGrabber.hpp.
References a(), and MagAOX::app::stateCodes::OPERATING.
| 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 722 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::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 468 of file frameGrabber.hpp.
| int MagAOX::app::dev::frameGrabber< derivedT >::configCircBuffs | ( | ) |
Definition at line 739 of file frameGrabber.hpp.
|
inlineprivate |
Definition at line 309 of file frameGrabber.hpp.
|
protected |
Execute framegrabbing.
Definition at line 780 of file frameGrabber.hpp.
References MagAOX::app::stateCodes::OPERATING, and MagAOX::app::stateCodes::READY.
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 774 of file frameGrabber.hpp.
References MagAOX::app::dev::frameGrabber< derivedT >::fgThreadExec().
| 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 398 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::loadConfig(), MagAOX::app::ocam2KCtrl::loadConfig(), MagAOX::app::picamCtrl::loadConfig(), MagAOX::app::qhyCtrl::loadConfig(), and MagAOX::app::zylaCtrl::loadConfig().
|
protected |
Definition at line 1044 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 697 of file frameGrabber.hpp.
|
protected |
Definition at line 1069 of file frameGrabber.hpp.
| int MagAOX::app::dev::frameGrabber< derivedT >::recordFGTimings | ( | bool | force = false | ) |
Definition at line 1213 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 316 of file frameGrabber.hpp.
Referenced by MagAOX::app::andorCtrl::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 1177 of file frameGrabber.hpp.
References MagAOX::app::indi::updateIfChanged().
|
protected |
Definition at line 153 of file frameGrabber.hpp.
|
protected |
Definition at line 156 of file frameGrabber.hpp.
|
protected |
The FPS used to configure the circular buffers.
Definition at line 151 of file frameGrabber.hpp.
|
protected |
Length of the circular buffer, in frames.
Definition at line 122 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 128 of file frameGrabber.hpp.
|
protected |
Definition at line 162 of file frameGrabber.hpp.
|
protected |
Definition at line 161 of file frameGrabber.hpp.
|
protected |
Definition at line 160 of file frameGrabber.hpp.
|
protected |
The cpuset to assign the framegrabber thread to. Not used if empty, the default.
Definition at line 120 of file frameGrabber.hpp.
|
protected |
A separate thread for the actual framegrabbings.
Definition at line 261 of file frameGrabber.hpp.
|
protected |
The ID of the framegrabber thread.
Definition at line 257 of file frameGrabber.hpp.
|
protected |
Synchronizer for thread startup, to allow priority setting to finish.
Definition at line 255 of file frameGrabber.hpp.
|
protected |
Priority of the framegrabber thread, should normally be > 00.
Definition at line 119 of file frameGrabber.hpp.
|
protected |
The property to hold the f.g. thread details.
Definition at line 259 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 284 of file frameGrabber.hpp.
|
protected |
Property used to report the shmim buffer name.
Definition at line 282 of file frameGrabber.hpp.
|
protected |
Definition at line 286 of file frameGrabber.hpp.
|
protected |
The inode of the image stream file.
Definition at line 149 of file frameGrabber.hpp.
|
protected |
Maximum length of the latency measurement circular buffers.
Definition at line 124 of file frameGrabber.hpp.
|
protected |
Maximum time of the latency meaurement circular buffers.
Definition at line 126 of file frameGrabber.hpp.
|
protected |
Definition at line 167 of file frameGrabber.hpp.
|
protected |
Definition at line 172 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 164 of file frameGrabber.hpp.
|
protected |
Definition at line 169 of file frameGrabber.hpp.
|
protected |
Definition at line 174 of file frameGrabber.hpp.
|
protected |
Flag controlling if the shmim is owned. If true it will be destroyed as needed.
Definition at line 147 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 116 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 165 of file frameGrabber.hpp.
|
protected |
Definition at line 170 of file frameGrabber.hpp.
|
protected |
Definition at line 175 of file frameGrabber.hpp.
|
protected |
Definition at line 158 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 154 of file frameGrabber.hpp.
|
protected |
Definition at line 157 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.