14#include <ImageStreamIO/ImageStreamIO.h>
16#include <picam_advanced.h>
18#include "../../libMagAOX/libMagAOX.hpp"
19#include "../../magaox_git_version.h"
24#define BREADCRUMB std::cerr << __FILE__ << " " << __LINE__ << "\n";
33 Picam_GetEnumerationString( type, value, &
string );
34 std::string str(
string);
35 Picam_DestroyString(
string );
47 const std::string & rosn
50 if(rosn ==
"ccd_00_1MHz")
52 adcQual = PicamAdcQuality_LowNoise;
55 else if(rosn ==
"ccd_01MHz")
57 adcQual = PicamAdcQuality_LowNoise;
60 else if(rosn ==
"emccd_05MHz")
62 adcQual = PicamAdcQuality_ElectronMultiplied;
65 else if(rosn ==
"emccd_10MHz")
67 adcQual = PicamAdcQuality_ElectronMultiplied;
70 else if(rosn ==
"emccd_20MHz")
72 adcQual = PicamAdcQuality_ElectronMultiplied;
75 else if(rosn ==
"emccd_30MHz")
77 adcQual = PicamAdcQuality_ElectronMultiplied;
89 const std::string & vsn
96 else if(vsn ==
"1_2us")
100 else if(vsn ==
"2_0us")
104 else if(vsn ==
"5_0us")
381 m_readoutSpeedNames = {
"ccd_00_1MHz",
"ccd_01MHz",
"emccd_05MHz",
"emccd_10MHz",
"emccd_20MHz",
"emccd_30MHz"};
382 m_readoutSpeedNameLabels = {
"CCD 0.1 MHz",
"CCD 1 MHz",
"EMCCD 5 MHz",
"EMCCD 10 MHz",
"EMCCD 20 MHz",
"EMCCD 30 MHz"};
418 config.add(
"camera.serialNumber",
"",
"camera.serialNumber", argType::Required,
"camera",
"serialNumber",
false,
"int",
"The identifying serial number of the camera.");
448 indi::addNumberElement<float>(
m_indiP_readouttime,
"value", 0.0, std::numeric_limits<float>::max(), 0.0,
"%0.1f",
"readout time");
577 if(!
lock.owns_lock())
return 0;
752 return log<
text_log,-1>(
"Parameter not committed");
794 return log<
text_log,-1>(
"Parameter not committed");
836 return log<
text_log,-1>(
"Parameter not committed");
1614 std::cerr <<
rois->roi_array[0].x <<
"\n";
1615 std::cerr << (
rois->roi_array[0].x-1) <<
"\n";
1616 std::cerr <<
rois->roi_array[0].width <<
"\n";
1617 std::cerr << 0.5*( (
float) (
rois->roi_array[0].width - 1.0)) <<
"\n";
1622 m_currentROI.x = (1023.0-
rois->roi_array[0].x) - 0.5*( (
float) (
rois->roi_array[0].width - 1.0)) ;
1633 m_currentROI.y = (1023.0-
rois->roi_array[0].y) - 0.5*( (
float) (
rois->roi_array[0].height - 1.0)) ;
1720 std::cerr <<
"Setting exposure time to " <<
m_expTimeSet <<
"\n";
1760 std::cerr <<
"could not get AdcQuality\n";
1763 std::cerr <<
"AdcQuality is: " <<
adcqStr <<
"\n";
1768 std::cerr <<
"could not get VerticalShiftRate\n";
1775 std::cerr <<
"could not get AdcSpeed\n";
1777 std::cerr <<
"AdcSpeed is: " <<
AdcSpeed <<
"\n";
1780 std::cerr <<
"************************************************************\n";
1786 std::cerr <<
"could not get AdcAnalogGain\n";
1789 std::cerr <<
"AdcAnalogGain is: " <<
adcgStr <<
"\n";
1800 std::cerr <<
"could not get AdcEMGain\n";
1838 std::cerr <<
"Clearing\n";
1845 std::cerr <<
"m_acqBuff.memory_size: " <<
m_acqBuff.memory_size <<
"\n";
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.
int powerState()
Returns the current power state.
int m_powerState
Current power state, 1=On, 0=Off, -1=Unk.
int powerStateTarget()
Returns the target power state.
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.
int createROIndiNumber(pcf::IndiProperty &prop, const std::string &propName, const std::string &propLabel="", const std::string &propGroup="")
Create a ReadOnly INDI Number property.
int registerIndiPropertyReadOnly(pcf::IndiProperty &prop)
Register an INDI property which is read only.
std::mutex m_indiMutex
Mutex for locking INDI communications.
MagAO-X Uniblitz DSS Shutter interface.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int appShutdown()
applogic shutdown
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int m_xbinning
The x-binning according to the framegrabber.
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
int m_ybinning
The y-binning according to the framegrabber.
size_t m_typeSize
The size of the type, in bytes. Result of sizeof.
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_maxEMGain
The configurable maximum EM gain. To be enforced in derivedT.
std::vector< std::string > m_readoutSpeedNames
float m_minExpTime
The minimum exposure time, used for INDI attributes.
pcf::IndiProperty m_indiP_roi_y
Property used to set the ROI x center coordinate.
float m_default_x
Power-on ROI center x coordinate.
std::string m_tempControlStatusStr
Camera specific description of temperature control status.
float m_emGain
The camera's current EM gain (if available).
std::vector< std::string > m_readoutSpeedNameLabels
int m_full_w
The full ROI width.
float m_emGainSet
The camera's EM gain, as set by the user.
std::string m_vShiftSpeedNameSet
The user requested vshift speed name, to be set by derived()
std::string m_defaultReadoutSpeed
The default readout speed of the camera.
float m_expTime
The current exposure time, in seconds.
int m_default_w
Power-on ROI width.
int recordCamera(bool force=false)
float m_maxExpTime
The maximum exposure time, used for INDI attributes.
int m_default_h
Power-on ROI height.
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.
std::string m_readoutSpeedName
The current readout speed name.
float m_ccdTempSetpt
The desired temperature, in C.
bool m_tempControlStatus
Whether or not temperature control is active.
pcf::IndiProperty m_indiP_fps
pcf::IndiProperty m_indiP_roi_w
Property used to set the ROI width.
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.
pcf::IndiProperty m_indiP_exptime
std::string m_vShiftSpeedName
The current vshift speed name.
float m_ccdTemp
The current temperature, in C.
std::vector< std::string > m_vShiftSpeedNames
std::string m_defaultVShiftSpeed
The default readout speed of the camera.
pcf::IndiProperty m_indiP_tempcont
bool m_tempControlOnTarget
Whether or not the temperature control system is on its target temperature.
float m_stepExpTime
The maximum exposure time stepsize, used for INDI attributes.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
std::vector< std::string > m_vShiftSpeedNameLabels
pcf::IndiProperty m_indiP_roi_set
Property used to trigger setting the ROI.
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.
bool m_tempControlStatusSet
Desired state of temperature control.
std::string m_readoutSpeedNameSet
The user requested readout speed name, to be set by derived()
int recordTelem(const telem_stdcam *)
int loadImageIntoStream(void *dest)
static constexpr bool c_stdCamera_usesROI
app:dev config to tell stdCamera to expose ROI controls
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
std::string m_cameraModel
std::string m_serialNumber
The camera's identifying serial number.
static constexpr bool c_stdCamera_exptimeCtrl
app::dev config to tell stdCamera to expose exposure time controls
static constexpr bool c_stdCamera_synchro
app::dev config to tell stdCamera to not expose synchro mode controls
int setShutter(int sh)
Sets the shutter state, via call to dssShutter::setShutterState(int) [stdCamera interface].
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
static constexpr bool c_stdCamera_vShiftSpeed
app:dev config to tell stdCamera to expose vertical shift speed control
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
int checkNextROI()
Check the next ROI.
PicamHandle m_cameraHandle
static constexpr bool c_stdCamera_fpsCtrl
app::dev config to tell stdCamera not to expose FPS controls
static constexpr bool c_stdCamera_cropMode
app:dev config to tell stdCamera to expose Crop Mode controls
PicamHandle m_modelHandle
static constexpr bool c_stdCamera_hasShutter
app:dev config to tell stdCamera to expose shutter controls
int acquireAndCheckValid()
static constexpr bool c_stdCamera_tempControl
app::dev config to tell stdCamera to expose temperature controls
static constexpr bool c_stdCamera_temp
app::dev config to tell stdCamera to expose temperature
~picamCtrl() noexcept
Destructor.
static constexpr bool c_stdCamera_emGain
app::dev config to tell stdCamera to expose EM gain controls
pcf::IndiProperty m_indiP_readouttime
virtual int whilePowerOff()
Implementation of the while-powered-off FSM.
int getPicamParameter(piint &value, PicamParameter parameter)
picamCtrl()
Default c'tor.
int setPicamParameter(PicamParameter parameter, pi64s value, bool commit=true)
static constexpr bool c_stdCamera_readoutSpeed
app::dev config to tell stdCamera to expose readout speed controls
virtual int onPowerOff()
Implementation of the on-power-off FSM logic.
piflt m_ReadOutTimeCalculation
static constexpr bool c_stdCamera_usesModes
app:dev config to tell stdCamera not to expose mode controls
static constexpr bool c_stdCamera_usesStateString
app::dev confg to tell stdCamera to expose the state string property
int setPicamParameterOnline(PicamHandle handle, PicamParameter parameter, piflt value)
int getAcquisitionState()
static constexpr bool c_frameGrabber_flippable
app:dev config to tell framegrabber this camera can be flipped
double m_camera_timestamp
PicamAvailableData m_available
static constexpr bool c_stdCamera_fps
app::dev config to tell stdCamera not to expose FPS status
virtual int appStartup()
Startup functions.
int configureAcquisition()
virtual int appLogic()
Implementation of the FSM for the Siglent SDG.
piflt m_FrameRateCalculation
PicamAcquisitionBuffer m_acqBuff
int capExpTime(piflt &exptime)
#define INDI_NEWCALLBACK_DECL(class, prop)
Declare the callback for a new property request, and declare and define the static wrapper.
@ 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.
int readoutParams(int &newa, int &newhss, const std::string &ron)
int vshiftParams(int &newvs, const std::string &vssn, float &vs)
std::unique_lock< std::mutex > lock(m_indiMutex)
static constexpr logPrioT LOG_NOTICE
A normal but significant condition.
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
static constexpr logPrioT LOG_ALERT
This should only be used if some action is required by operators to keep the system safe.
std::string PicamEnum2String(PicamEnumeratedType type, piint value)
A device base class which saves telemetry.
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.
A simple text log, a string-type log.