#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 () |
Static Private Member Functions | |
| template<class hookT > | |
| static auto | postPublishHook (hookT &hookOwner, IMAGE *imageStream, int callPriorityTag) -> decltype(hookOwner.frameGrabberPostPublish(imageStream)) |
| Call an optional derived-class hook after the main stream publication completes. | |
| static int | postPublishHook (derivedT &hookOwner, IMAGE *imageStream, long callPriorityTag) |
| Return success when the derived class does not expose a post-publication hook. | |
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 105 of file frameGrabber.hpp.
| typedef int32_t MagAOX::app::dev::frameGrabber< derivedT >::cbIndexT |
Definition at line 116 of file frameGrabber.hpp.
| enum MagAOX::app::dev::frameGrabber::fgFlip |
| Enumerator | |
|---|---|
| fgFlipNone | |
| fgFlipUD | |
| fgFlipLR | |
| fgFlipUDLR | |
Definition at line 108 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 590 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 763 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 507 of file frameGrabber.hpp.
| int MagAOX::app::dev::frameGrabber< derivedT >::configCircBuffs | ( | ) |
Definition at line 780 of file frameGrabber.hpp.
|
inlineprivate |
Definition at line 328 of file frameGrabber.hpp.
|
protected |
Execute framegrabbing.
Definition at line 821 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 815 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 437 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 1090 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 738 of file frameGrabber.hpp.
|
protected |
Definition at line 1115 of file frameGrabber.hpp.
|
staticprivate |
Return success when the derived class does not expose a post-publication hook.
| [in] | hookOwner | derived object lacking the optional hook |
| [in] | imageStream | published image stream |
| [in] | callPriorityTag | fallback overload selector |
Definition at line 345 of file frameGrabber.hpp.
|
staticprivate |
Call an optional derived-class hook after the main stream publication completes.
| [in] | hookOwner | derived object that may expose the hook |
| [in] | imageStream | published image stream |
| [in] | callPriorityTag | overload selector preferring the hook |
Definition at line 336 of file frameGrabber.hpp.
| int MagAOX::app::dev::frameGrabber< derivedT >::recordFGTimings | ( | bool | force = false | ) |
Definition at line 1259 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 355 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 1223 of file frameGrabber.hpp.
References MagAOX::app::indi::updateIfChanged().
|
protected |
Definition at line 159 of file frameGrabber.hpp.
|
protected |
Definition at line 162 of file frameGrabber.hpp.
|
protected |
The FPS used to configure the circular buffers.
Definition at line 157 of file frameGrabber.hpp.
|
protected |
Length of the circular buffer, in frames.
Definition at line 128 of file frameGrabber.hpp.
|
protected |
The timestamp of the current image.
Definition at line 147 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO type code.
Definition at line 141 of file frameGrabber.hpp.
|
protected |
Definition at line 134 of file frameGrabber.hpp.
|
protected |
Definition at line 168 of file frameGrabber.hpp.
|
protected |
Definition at line 167 of file frameGrabber.hpp.
|
protected |
Definition at line 166 of file frameGrabber.hpp.
|
protected |
The cpuset to assign the framegrabber thread to. Not used if empty, the default.
Definition at line 126 of file frameGrabber.hpp.
|
protected |
A separate thread for the actual framegrabbings.
Definition at line 267 of file frameGrabber.hpp.
|
protected |
The ID of the framegrabber thread.
Definition at line 263 of file frameGrabber.hpp.
|
protected |
Synchronizer for thread startup, to allow priority setting to finish.
Definition at line 261 of file frameGrabber.hpp.
|
protected |
Priority of the framegrabber thread, should normally be > 00.
Definition at line 125 of file frameGrabber.hpp.
|
protected |
The property to hold the f.g. thread details.
Definition at line 265 of file frameGrabber.hpp.
|
protected |
The height of the image, once deinterlaced etc.
Definition at line 139 of file frameGrabber.hpp.
|
protected |
The ImageStreamIO shared memory buffer.
Definition at line 151 of file frameGrabber.hpp.
|
protected |
Property used to report the current frame size.
Definition at line 290 of file frameGrabber.hpp.
|
protected |
Property used to report the shmim buffer name.
Definition at line 288 of file frameGrabber.hpp.
|
protected |
Definition at line 292 of file frameGrabber.hpp.
|
protected |
The inode of the image stream file.
Definition at line 155 of file frameGrabber.hpp.
|
protected |
Maximum length of the latency measurement circular buffers.
Definition at line 130 of file frameGrabber.hpp.
|
protected |
Maximum time of the latency meaurement circular buffers.
Definition at line 132 of file frameGrabber.hpp.
|
protected |
Definition at line 173 of file frameGrabber.hpp.
|
protected |
Definition at line 178 of file frameGrabber.hpp.
|
protected |
Definition at line 172 of file frameGrabber.hpp.
|
protected |
Definition at line 177 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 180 of file frameGrabber.hpp.
|
protected |
Flag controlling if the shmim is owned. If true it will be destroyed as needed.
Definition at line 153 of file frameGrabber.hpp.
|
protected |
Flag to set if a camera reconfiguration requires a framegrabber reset.
Definition at line 149 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 122 of file frameGrabber.hpp.
|
protected |
The size of the type, in bytes. Result of sizeof.
Definition at line 142 of file frameGrabber.hpp.
|
protected |
Definition at line 171 of file frameGrabber.hpp.
|
protected |
Definition at line 176 of file frameGrabber.hpp.
|
protected |
Definition at line 181 of file frameGrabber.hpp.
|
protected |
Definition at line 164 of file frameGrabber.hpp.
|
protected |
The width of the image, once deinterlaced etc.
Definition at line 138 of file frameGrabber.hpp.
|
protected |
Definition at line 160 of file frameGrabber.hpp.
|
protected |
Definition at line 163 of file frameGrabber.hpp.
|
protected |
The x-binning according to the framegrabber.
Definition at line 144 of file frameGrabber.hpp.
|
protected |
The y-binning according to the framegrabber.
Definition at line 145 of file frameGrabber.hpp.