14#include <pylon/PylonIncludes.h>
15#include <pylon/PixelData.h>
16#include <pylon/GrabResultData.h>
17#include <pylon/usb/BaslerUsbInstantCamera.h>
18#include <pylon/usb/_BaslerUsbCameraParams.h>
19#include <GenApi/IFloat.h>
21typedef Pylon::CBaslerUsbInstantCamera
Camera_t;
24using namespace Basler_UsbCameraParams;
29#include <ImageStreamIO/ImageStreamIO.h>
31#include "../../libMagAOX/libMagAOX.hpp"
32#include "../../magaox_git_version.h"
272 config.add(
"camera.serialNumber",
"",
"camera.serialNumber", argType::Required,
"camera",
"serialNumber",
false,
"int",
"The identifying serial number of the camera.");
273 config.add(
"camera.bits",
"",
"camera.bits", argType::Required,
"camera",
"bits",
false,
"int",
"The number of bits used by the camera. Default is 10.");
285 config(
m_bits,
"camera.bits");
366 if(!
lock.owns_lock())
return 0;
471 m_shmimName = (std::string)
m_camera->GetDeviceInfo().GetModelName() +
"_" + (std::string)
m_camera->GetDeviceInfo().GetSerialNumber();
879 if(
src ==
nullptr)
return -1;
991 m_camera->AcquisitionFrameRateEnable.SetValue(
false);
1002 m_camera->AcquisitionFrameRateEnable.SetValue(
true);
1038 std::cerr <<
"checkNextROI!\n";
1050 std::cerr <<
"req bin_x: " <<
m_nextROI.bin_x <<
" " <<
"adj bin_x: " <<
m_binXs[
bx] <<
"\n";
1062 std::cerr <<
"req bin_y: " <<
m_nextROI.bin_y <<
" " <<
"adj bin_y: " <<
m_binYs[
by] <<
"\n";
1076 std::cerr <<
"req w: " <<
m_nextROI.w <<
" " <<
"adj w: " << w <<
"\n";
1109 std::cerr <<
" adj x: " <<
m_nextROI.x <<
"\n";
1122 std::cerr <<
"req h: " <<
m_nextROI.h <<
" " <<
"adj h: " << h <<
"\n";
1155 std::cerr <<
" adj y: " <<
m_nextROI.y <<
"\n";
1170 std::cerr <<
"setNextROI:\n";
1171 std::cerr <<
" m_nextROI.x = " <<
m_nextROI.x <<
"\n";
1172 std::cerr <<
" m_nextROI.y = " <<
m_nextROI.y <<
"\n";
1173 std::cerr <<
" m_nextROI.w = " <<
m_nextROI.w <<
"\n";
1174 std::cerr <<
" m_nextROI.h = " <<
m_nextROI.h <<
"\n";
1175 std::cerr <<
" m_nextROI.bin_x = " <<
m_nextROI.bin_x <<
"\n";
1176 std::cerr <<
" m_nextROI.bin_y = " <<
m_nextROI.bin_y <<
"\n";
Pylon::CBaslerUsbInstantCamera Camera_t
The base-class for MagAO-X 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.
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
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 m_serialNumber
The camera's identifying serial number.
std::vector< int > m_incXs
The allowed increment in X for each X-binning.
int powerOnDefaults()
Set defaults for a power on state.
std::vector< int > m_binYs
The allowed values of binning in Y (vertical)
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.
int appShutdown()
Shuts down the framegrabber thread.
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
std::string m_shmimName
The name of the shared memory image, is used in /tmp/<shmimName>.im.shm. Derived classes should set a...
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.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
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_default_x
Power-on ROI center x coordinate.
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 m_default_bin_x
Power-on ROI x binning.
int m_default_w
Power-on ROI width.
int recordCamera(bool force=false)
int m_default_h
Power-on ROI height.
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.
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
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.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
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.
int appShutdown()
Application shutdown.
float m_default_y
Power-on ROI center y coordinate.
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.
int m_default_bin_y
Power-on ROI y binning.
@ 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)
A device base class which saves telemetry.
int appShutdown()
Perform telemeter application shutdown.
int loadConfig(appConfigurator &config)
Load the device section from an application configurator.
int setupConfig(appConfigurator &config)
Setup an application configurator for the device section.
Software CRITICAL log entry.
Log entry recording stdcam stage specific status.