12#include <pylon/PylonIncludes.h>
13#include <pylon/PixelData.h>
14#include <pylon/GrabResultData.h>
15#include <pylon/usb/BaslerUsbInstantCamera.h>
16#include <pylon/usb/_BaslerUsbCameraParams.h>
17#include <GenApi/IFloat.h>
19typedef Pylon::CBaslerUsbInstantCamera
Camera_t;
22using namespace Basler_UsbCameraParams;
27#include <ImageStreamIO/ImageStreamIO.h>
29#include "../../libMagAOX/libMagAOX.hpp"
30#include "../../magaox_git_version.h"
297 config.add(
"camera.serialNumber",
299 "camera.serialNumber",
305 "The identifying serial number of the camera." );
307 config.add(
"camera.bits",
315 "The number of bits used by the camera. Default is 10." );
327 config(
m_bits,
"camera.bits" );
398 if( !
lock.owns_lock() )
502 (std::string)
m_camera->GetDeviceInfo().GetModelName() +
"_" +
503 (std::string)
m_camera->GetDeviceInfo().GetSerialNumber();
707 m_camera->CenterX.SetValue(
false );
708 m_camera->CenterY.SetValue(
false );
751 std::cerr <<
"m_nextROI.x: " <<
m_nextROI.x <<
" m_nextROI.w:" <<
m_nextROI.w <<
'\n';
761 std::cerr <<
"m_nextROI.y: " <<
m_nextROI.y <<
" m_nextROI.h:" <<
m_nextROI.h <<
'\n';
774 std::cerr <<
"xoff: " <<
xoff <<
" yoff: " <<
yoff <<
'\n';
947 float temp =
m_camera->DeviceTemperature.GetValue();
1041 m_camera->AcquisitionFrameRateEnable.SetValue(
false );
1052 m_camera->AcquisitionFrameRateEnable.SetValue(
true );
1087 std::cerr <<
"checkNextROI!\n";
1099 std::cerr <<
"req bin_x: " <<
m_nextROI.bin_x <<
" " <<
"adj bin_x: " <<
m_binXs[
bx] <<
"\n";
1111 std::cerr <<
"req bin_y: " <<
m_nextROI.bin_y <<
" " <<
"adj bin_y: " <<
m_binYs[
by] <<
"\n";
1129 std::cerr <<
"req w: " <<
m_nextROI.w <<
" " <<
"adj w: " << w <<
"\n";
1166 std::cerr <<
" adj x: " <<
m_nextROI.x <<
"\n";
1183 std::cerr <<
"req h: " <<
m_nextROI.h <<
" " <<
"adj h: " << h <<
"\n";
1220 std::cerr <<
" adj y: " <<
m_nextROI.y <<
"\n";
1233 catch(
const std::exception &
e )
1241 std::cerr <<
"setNextROI:\n";
1242 std::cerr <<
" m_nextROI.x = " <<
m_nextROI.x <<
"\n";
1243 std::cerr <<
" m_nextROI.y = " <<
m_nextROI.y <<
"\n";
1244 std::cerr <<
" m_nextROI.w = " <<
m_nextROI.w <<
"\n";
1245 std::cerr <<
" m_nextROI.h = " <<
m_nextROI.h <<
"\n";
1246 std::cerr <<
" m_nextROI.bin_x = " <<
m_nextROI.bin_x <<
"\n";
1247 std::cerr <<
" m_nextROI.bin_y = " <<
m_nextROI.bin_y <<
"\n";
Pylon::CBaslerUsbInstantCamera Camera_t
The base-class for XWCTk applications.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
stateCodes::stateCodeT state()
Get the current state code.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
void updateSwitchIfChanged(pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI switch element value if it has changed.
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
std::mutex m_indiMutex
Mutex for locking INDI communications.
int setFPS()
Set the framerate.
~baslerCtrl() noexcept
Destructor.
virtual int appStartup()
Startup functions.
static constexpr bool c_stdCamera_exptimeCtrl
app::dev config to tell stdCamera to expose exposure time controls
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
baslerCtrl()
Default c'tor.
static constexpr bool c_stdCamera_cropMode
app:dev config to tell stdCamera not to expose Crop Mode controls
static constexpr bool c_stdCamera_emGain
app::dev config to tell stdCamera to not expose EM gain controls
static constexpr bool c_stdCamera_fpsCtrl
app::dev config to tell stdCamera to expose FPS controls
int m_bits
The number of bits used by the camera.
static constexpr bool c_stdCamera_readoutSpeed
app::dev config to tell stdCamera not to expose readout speed controls
std::vector< int > m_minWs
The minimum value of the width for each X-binning.
static constexpr bool c_stdCamera_fps
app::dev config to tell stdCamera not to expose FPS status (ignored since fpsCtrl=true)
static constexpr bool c_stdCamera_hasShutter
app:dev config to tell stdCamera to expose shutter controls
int setExpTime()
Set the Exposure Time. [stdCamera interface].
static constexpr bool c_stdCamera_usesStateString
app::dev confg to tell stdCamera to expose the state string property
static constexpr bool c_stdCamera_vShiftSpeed
app:dev config to tell stdCamera not to expose vertical shift speed control
std::vector< int > m_maxWs
The minimum value of the width for each X-binning.
int getTemp()
Get the current detector temperature.
static constexpr bool c_stdCamera_synchro
app::dev config to tell stdCamera to not expose synchro mode controls
static constexpr bool c_stdCamera_temp
app::dev config to tell stdCamera to expose temperature
int configureAcquisition()
int recordTelem(const telem_stdcam *)
static constexpr bool c_stdCamera_usesModes
app:dev config to tell stdCamera not to expose mode controls
static constexpr bool c_stdCamera_usesROI
app:dev config to tell stdCamera to expose ROI controls
int checkNextROI()
Check the next ROI.
CBaslerUsbInstantCamera * m_camera
The library camera handle.
CGrabResultPtr ptrGrabResult
The result of an attempt to grab an image.
std::vector< int > m_maxHs
The minimum value of the height for each Y-binning.
std::vector< int > m_incYs
The allowed increment in Y for each Y-binning.
std::vector< int > m_binXs
The allowed values of binning in X (horizontal)
int setNextROI()
Set the next ROI.
static constexpr bool c_frameGrabber_flippable
app:dev config to tell framegrabber that this camera can be flipped
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
dev::telemeter< baslerCtrl > telemeterT
static constexpr bool c_stdCamera_tempControl
app::dev config to tell stdCamera to not expose temperature controls
int getExpTime()
Get the current exposure time.
int acquireAndCheckValid()
std::vector< int > m_incHs
The minimum value of the height for each Y-binning.
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
int getFPS()
Get the current framerate.
virtual int appLogic()
Implementation of the FSM for the Siglent SDG.
int loadImageIntoStream(void *dest)
std::vector< int > m_incWs
The minimum value of the width for each X-binning.
std::string stateString()
std::string m_serialNumber
The camera's identifying serial number.
dev::frameGrabber< baslerCtrl > frameGrabberT
std::vector< int > m_incXs
The allowed increment in X for each X-binning.
int powerOnDefaults()
Set defaults for a power on state.
dev::stdCamera< baslerCtrl > stdCameraT
std::vector< int > m_binYs
The allowed values of binning in Y (vertical)
mx::sigproc::circularBufferIndex< float, int32_t > m_tempHist
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
std::vector< int > m_minHs
The minimum value of the height for each Y-binning.
timespec m_currImageTimestamp
The timestamp of the current image.
uint32_t m_width
The width of the image, once deinterlaced etc.
uint8_t m_dataType
The ImageStreamIO type code.
bool m_reconfig
Flag to set if a camera reconfiguration requires a framegrabber reset.
uint32_t m_height
The height of the image, once deinterlaced etc.
MagAO-X standard camera interface.
float m_fpsSet
The commanded fps, as set by user.
pcf::IndiProperty m_indiP_roi_y
Property used to set the ROI x center coordinate.
int m_full_currbin_w
The current-binning full ROI width.
float m_full_currbin_x
The current-binning full ROI center x coordinate.
int m_full_w
The full ROI width.
float m_expTime
The current exposure time, in seconds.
int recordCamera(bool force=false)
pcf::IndiProperty m_indiP_roi_last
Property used to trigger setting the last ROI.
float m_expTimeSet
The exposure time, in seconds, as set by user.
pcf::IndiProperty m_indiP_roi_h
Property used to set the ROI height.
int m_full_h
The full ROI height.
float m_full_y
The full ROI center y coordinate.
pcf::IndiProperty m_indiP_roi_w
Property used to set the ROI width.
pcf::IndiProperty m_indiP_roi_default
Property used to trigger setting the default and startup ROI.
pcf::IndiProperty m_indiP_roi_bin_x
Property used to set the ROI x binning.
float m_full_x
The full ROI center x coordinate.
int m_full_currbin_h
The current-binning full ROI height.
float m_ccdTemp
The current temperature, in C.
float m_full_currbin_y
The current-binning full ROI center y coordinate.
pcf::IndiProperty m_indiP_roi_full
Property used to trigger setting the full ROI.
pcf::IndiProperty m_indiP_roi_set
Property used to trigger setting the ROI.
float m_fps
The current FPS.
pcf::IndiProperty m_indiP_roi_bin_y
Property used to set the ROI y binning.
pcf::IndiProperty m_indiP_roi_x
Property used to set the ROI x center coordinate.
#define FRAMEGRABBER_SETUP_CONFIG(cfig)
Call frameGrabberT::setupConfig with error checking for frameGrabber.
#define FRAMEGRABBER_APP_LOGIC
Call frameGrabberT::appLogic with error checking for frameGrabber.
#define FRAMEGRABBER_APP_SHUTDOWN
Call frameGrabberT::appShutdown with error checking for frameGrabber.
#define FRAMEGRABBER_UPDATE_INDI
Call frameGrabberT::updateINDI with error checking for frameGrabber.
#define FRAMEGRABBER_LOAD_CONFIG(cfig)
Call frameGrabberT::loadConfig with error checking for frameGrabber.
#define FRAMEGRABBER_APP_STARTUP
Call frameGrabberT::appStartup with error checking for frameGrabber.
@ OPERATING
The device is operating, other than homing.
@ NODEVICE
No device exists for the application to control.
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
@ READY
The device is ready for operation, but is not operating.
@ CONNECTED
The application has connected to the device or service.
@ NOTCONNECTED
The application is not connected to the device or service.
@ info
For information only.
std::unique_lock< std::mutex > lock(m_indiMutex)
#define STDCAMERA_SETUP_CONFIG(cfig)
Call stdCameraT::setupConfig with error checking for stdCamera.
#define STDCAMERA_APP_LOGIC
Call stdCameraT::appLogic with error checking for stdCamera.
#define STDCAMERA_APP_STARTUP
Call stdCameraT::appStartup with error checking for stdCamera.
#define STDCAMERA_LOAD_CONFIG(cfig)
Call stdCameraT::loadConfig with error checking for stdCamera.
#define STDCAMERA_UPDATE_INDI
Call stdCameraT::updateINDI with error checking for stdCamera.
#define STDCAMERA_APP_SHUTDOWN
Call stdCameraT::appShutdown with error checking for stdCamera.
A device base class which saves telemetry.
Software CRITICAL log entry.
Log entry recording stdcam stage specific status.
#define TELEMETER_APP_LOGIC
Call telemeter::appLogic with error checking.
#define TELEMETER_LOAD_CONFIG(cfig)
Call telemeter::loadConfig with error checking.
#define TELEMETER_APP_STARTUP
Call telemeter::appStartup with error checking.
#define TELEMETER_SETUP_CONFIG(cfig)
Call telemeter::setupConfig with error checking.
#define TELEMETER_APP_SHUTDOWN
Call telemeter::appShutdown with error checking.