...
This commit is contained in:
parent
fd8c2c7996
commit
4dd6893674
@ -111,6 +111,11 @@ R convertUIntTo12Bit(uint16_t counts)
|
|||||||
} // namespace details
|
} // namespace details
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************/
|
||||||
|
/* ======= RaptorEagleCCD CLASS IMPLEMENTATION ======= */
|
||||||
|
/***********************************************************/
|
||||||
|
|
||||||
#define DEFAULT_EPIX_VIDEO_FMT_FILE "raptor_eagle-v.fmt"
|
#define DEFAULT_EPIX_VIDEO_FMT_FILE "raptor_eagle-v.fmt"
|
||||||
|
|
||||||
/* CONSTRUCTORS AND DESTRUCTOR */
|
/* CONSTRUCTORS AND DESTRUCTOR */
|
||||||
@ -744,6 +749,51 @@ void RaptorEagleCCD::getFPGAVersion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ACQUISITION PROCESS */
|
||||||
|
|
||||||
|
void RaptorEagleCCD::startAquisition(acq_params_t acq_pars)
|
||||||
|
{
|
||||||
|
acq_pars.startTime = std::chrono::utc_clock::now();
|
||||||
|
std::chrono::milliseconds snap_tm =
|
||||||
|
CAMERA_CAPTURE_TIMEOUT_ADD_CONSTANT +
|
||||||
|
std::chrono::milliseconds(static_cast<std::chrono::milliseconds::rep>(acq_pars.expTime * 1000));
|
||||||
|
|
||||||
|
_doSnapAndCopyFuture = std::async(
|
||||||
|
std::launch::async,
|
||||||
|
[acq_pars = std::move(acq_pars), this](std::chrono::milliseconds timeout) mutable {
|
||||||
|
static char color_space[] = "Grey";
|
||||||
|
std::stringstream st;
|
||||||
|
st << std::this_thread::get_id();
|
||||||
|
|
||||||
|
logDebug("Arm grabber and wait for acquisition start trigger (thread id: {}) ...", st.str());
|
||||||
|
|
||||||
|
xclibApiCall(pxd_doSnap(_cameraUnitmap, 1, timeout.count()),
|
||||||
|
std::format("pxd_doSnap({},1,{})", _cameraUnitmap, timeout.count()));
|
||||||
|
|
||||||
|
logDebug("Capture is finished (thread id: {})!", st.str());
|
||||||
|
|
||||||
|
logDebug("Copy image from grabber to buffer (thread id: {}) ...", st.str());
|
||||||
|
|
||||||
|
size_t npix = acq_pars.roiWidth * acq_pars.roiHeight;
|
||||||
|
|
||||||
|
acq_pars.imageBufferRows = static_cast<size_t>(std::ceil(npix / _dimCCD[0]));
|
||||||
|
size_t sz = acq_pars.imageBufferRows * npix;
|
||||||
|
|
||||||
|
if (acq_pars.imageBufferSize < sz) {
|
||||||
|
acq_pars.imageBufferSize = sz;
|
||||||
|
acq_pars.imageBuffer.reset(new ushort[sz]); // may thow std::bad_alloc here!
|
||||||
|
}
|
||||||
|
|
||||||
|
auto log_str =
|
||||||
|
std::format("pxd_readushort({}, 1, 0, 0, -1, {}, {}, {}, {})", _cameraUnitmap, acq_pars.imageBufferRows,
|
||||||
|
(void*)acq_pars.imageBuffer.get(), acq_pars.imageBufferSize, (void*)color_space);
|
||||||
|
xclibApiCall(pxd_readushort(_cameraUnitmap, 1, 0, 0, -1, acq_pars.imageBufferRows,
|
||||||
|
acq_pars.imageBuffer.get(), acq_pars.imageBufferSize, (char*)color_space),
|
||||||
|
log_str);
|
||||||
|
},
|
||||||
|
std::move(snap_tm));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* CREATE COMMANDS AND ATTRIBUTES */
|
/* CREATE COMMANDS AND ATTRIBUTES */
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <device/adc_device_command.h>
|
#include <device/adc_device_command.h>
|
||||||
|
|
||||||
#include <xcliball.h>
|
#include <xcliball.h>
|
||||||
|
#include <future>
|
||||||
|
|
||||||
#include "raptor_eagle_exception.h"
|
#include "raptor_eagle_exception.h"
|
||||||
|
|
||||||
@ -62,6 +63,10 @@ public:
|
|||||||
std::chrono::milliseconds(1000)};
|
std::chrono::milliseconds(1000)};
|
||||||
|
|
||||||
|
|
||||||
|
// additive constant to timeout for capture process (see pxd_doSnap XCLIB function)
|
||||||
|
// this constant will be added to exposure to compute actual timeout
|
||||||
|
static constexpr std::chrono::milliseconds CAMERA_CAPTURE_TIMEOUT_ADD_CONSTANT{240000}; // 4 mins
|
||||||
|
|
||||||
static constexpr std::string_view CAMERA_ATTR_XBIN{"XBIN"};
|
static constexpr std::string_view CAMERA_ATTR_XBIN{"XBIN"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_YBIN{"YBIN"};
|
static constexpr std::string_view CAMERA_ATTR_YBIN{"YBIN"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_ROI_STARTX{"ROI_STARTX"};
|
static constexpr std::string_view CAMERA_ATTR_ROI_STARTX{"ROI_STARTX"};
|
||||||
@ -138,6 +143,28 @@ public:
|
|||||||
private:
|
private:
|
||||||
typedef std::vector<unsigned char> byte_seq_t;
|
typedef std::vector<unsigned char> byte_seq_t;
|
||||||
|
|
||||||
|
struct acq_params_t {
|
||||||
|
uint16_t ccdDim[2];
|
||||||
|
std::chrono::utc_clock::time_point startTime;
|
||||||
|
double expTime; // in seconds
|
||||||
|
uint16_t roiStartX;
|
||||||
|
uint16_t roiStartY;
|
||||||
|
uint16_t roiWidth;
|
||||||
|
uint16_t roiHeight;
|
||||||
|
uint8_t binX;
|
||||||
|
uint8_t binY;
|
||||||
|
std::string_view readRate;
|
||||||
|
std::string_view readMode;
|
||||||
|
std::string filename;
|
||||||
|
std::string templateFilename;
|
||||||
|
std::vector<std::string> permanentKeywords;
|
||||||
|
std::vector<std::string> currentKeywords;
|
||||||
|
|
||||||
|
std::unique_ptr<ushort> imageBuffer;
|
||||||
|
size_t imageBufferSize;
|
||||||
|
size_t imageBufferRows;
|
||||||
|
};
|
||||||
|
|
||||||
std::string _epixFmtVideoFilename;
|
std::string _epixFmtVideoFilename;
|
||||||
int _cameraUnitmap;
|
int _cameraUnitmap;
|
||||||
|
|
||||||
@ -181,6 +208,12 @@ private:
|
|||||||
// must be interpretated as 2-element array of calibration points [at 0C, at +40C] (4 bytes)
|
// must be interpretated as 2-element array of calibration points [at 0C, at +40C] (4 bytes)
|
||||||
const uint16_t* _dacTECSetPointCalibData{reinterpret_cast<const uint16_t*>(_manufacturerData.data() + 14)};
|
const uint16_t* _dacTECSetPointCalibData{reinterpret_cast<const uint16_t*>(_manufacturerData.data() + 14)};
|
||||||
|
|
||||||
|
|
||||||
|
// acquisition process members
|
||||||
|
std::future<void> _doSnapAndCopyFuture;
|
||||||
|
std::future<void> _saveFitsFile;
|
||||||
|
std::atomic_bool _isAcqInProgress;
|
||||||
|
|
||||||
void initAttrComm();
|
void initAttrComm();
|
||||||
|
|
||||||
bool initCamera(int unitmap = 1);
|
bool initCamera(int unitmap = 1);
|
||||||
@ -236,6 +269,10 @@ private:
|
|||||||
void getMicroVersion();
|
void getMicroVersion();
|
||||||
void getFPGAVersion();
|
void getFPGAVersion();
|
||||||
|
|
||||||
|
// acquisition process methods
|
||||||
|
void startAquisition(acq_params_t);
|
||||||
|
void stopAcquisition();
|
||||||
|
|
||||||
// logging helper methods
|
// logging helper methods
|
||||||
|
|
||||||
template <bool NOEXCEPT = false>
|
template <bool NOEXCEPT = false>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user