start acquisition tunning (wait for STATUS_ARMED status before trigger
snapshot)
This commit is contained in:
parent
7497b72b32
commit
a6f15e234f
@ -76,10 +76,10 @@ void RaptorEagleCCD::AcquisitionProcess::start(const std::shared_ptr<acq_params_
|
|||||||
std::stringstream st;
|
std::stringstream st;
|
||||||
st << std::this_thread::get_id();
|
st << std::this_thread::get_id();
|
||||||
|
|
||||||
_status = STATUS_ARMED;
|
|
||||||
|
|
||||||
serverPtr->logDebug("Arm grabber and wait for acquisition starting trigger (thread id: {}) ...", st.str());
|
serverPtr->logDebug("Arm grabber and wait for acquisition starting trigger (thread id: {}) ...", st.str());
|
||||||
|
|
||||||
|
_status = STATUS_ARMED; // change to STATUS_ACQ will be made in RaptorEagleCCD::startAcquisition!!!
|
||||||
|
|
||||||
serverPtr->xclibApiCall(pxd_doSnap(serverPtr->_cameraUnitmap, 1, timeout.count()),
|
serverPtr->xclibApiCall(pxd_doSnap(serverPtr->_cameraUnitmap, 1, timeout.count()),
|
||||||
std::format("pxd_doSnap({}, 1, {})", serverPtr->_cameraUnitmap, timeout.count()));
|
std::format("pxd_doSnap({}, 1, {})", serverPtr->_cameraUnitmap, timeout.count()));
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ void RaptorEagleCCD::AcquisitionProcess::start(const std::shared_ptr<acq_params_
|
|||||||
} else {
|
} else {
|
||||||
serverPtr->logDebug("There is no one permanent keyword! Skip!");
|
serverPtr->logDebug("There is no one permanent keyword! Skip!");
|
||||||
}
|
}
|
||||||
for (auto & s : kwd_list) {
|
for (auto& s : kwd_list) {
|
||||||
fits_parse_template(s.data(), card, &k_type, &status);
|
fits_parse_template(s.data(), card, &k_type, &status);
|
||||||
if (status) { // ignore possible errors
|
if (status) { // ignore possible errors
|
||||||
fits_get_errstatus(status, err_str);
|
fits_get_errstatus(status, err_str);
|
||||||
@ -380,7 +380,6 @@ void RaptorEagleCCD::AcquisitionProcess::start(const std::shared_ptr<acq_params_
|
|||||||
serverPtr->logDebug("Return buffer address {} to queue of free", (void*)_acqParams->imageBufferPtr);
|
serverPtr->logDebug("Return buffer address {} to queue of free", (void*)_acqParams->imageBufferPtr);
|
||||||
|
|
||||||
acqProcSptr.erase(self);
|
acqProcSptr.erase(self);
|
||||||
|
|
||||||
}).detach();
|
}).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,8 @@ RaptorEagleCCD::~RaptorEagleCCD()
|
|||||||
|
|
||||||
// wait for detached acquisition threads?
|
// wait for detached acquisition threads?
|
||||||
if (AcquisitionProcess::acqProcSptr.size()) {
|
if (AcquisitionProcess::acqProcSptr.size()) {
|
||||||
logInfo("DTOR: waiting for the end of the acquisition process {} ...", AcquisitionProcess::acqProcSptr.size() > 1 ? "threads" : "thread");
|
logInfo("DTOR: waiting for the end of the acquisition process {} ...",
|
||||||
|
AcquisitionProcess::acqProcSptr.size() > 1 ? "threads" : "thread");
|
||||||
|
|
||||||
auto start = std::chrono::utc_clock::now();
|
auto start = std::chrono::utc_clock::now();
|
||||||
while (AcquisitionProcess::acqProcSptr.size()) {
|
while (AcquisitionProcess::acqProcSptr.size()) {
|
||||||
@ -1107,10 +1108,20 @@ void RaptorEagleCCD::startAquisition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::make_shared<AcquisitionProcess>()->start(acq_pars);
|
auto sptr = std::make_shared<AcquisitionProcess>();
|
||||||
|
sptr->start(acq_pars); // asynchronous call!!!
|
||||||
|
|
||||||
// start acquisition here
|
// start acquisition here
|
||||||
|
auto start = std::chrono::utc_clock::now();
|
||||||
|
while (sptr->_status != AcquisitionProcess::STATUS_ARMED) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
|
if ((std::chrono::utc_clock::now() - start) > CAMERA_START_ACQ_TIMEOUT) {
|
||||||
|
logError("CANNOT START ACQUIRING!!!");
|
||||||
|
throw RaptorEagleCCDError::ERROR_CANNOT_START_ACQUISITION;
|
||||||
|
}
|
||||||
|
}
|
||||||
acq_pars->startTime = setTriggerRegisterBit(CL_TRIGGER_MODE_SNAPSHOT_BIT);
|
acq_pars->startTime = setTriggerRegisterBit(CL_TRIGGER_MODE_SNAPSHOT_BIT);
|
||||||
|
sptr->_status = AcquisitionProcess::STATUS_ACQ;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
xclibApiCall(status = pxd_goneLive(_cameraUnitmap, 0), std::format("pxd_goneLive({}, 0)", _cameraUnitmap));
|
xclibApiCall(status = pxd_goneLive(_cameraUnitmap, 0), std::format("pxd_goneLive({}, 0)", _cameraUnitmap));
|
||||||
|
|||||||
@ -71,6 +71,9 @@ public:
|
|||||||
std::chrono::milliseconds(1000)};
|
std::chrono::milliseconds(1000)};
|
||||||
|
|
||||||
|
|
||||||
|
// wait timeout to start acquisition (deadlock?!!)
|
||||||
|
static constexpr std::chrono::milliseconds CAMERA_START_ACQ_TIMEOUT{1000}; // 1 second
|
||||||
|
|
||||||
// additive constant to timeout for capture process (see pxd_doSnap XCLIB function)
|
// additive constant to timeout for capture process (see pxd_doSnap XCLIB function)
|
||||||
// this constant will be added to exposure to compute actual timeout
|
// 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::chrono::milliseconds CAMERA_CAPTURE_TIMEOUT_ADD_CONSTANT{240000}; // 4 mins
|
||||||
|
|||||||
@ -16,6 +16,7 @@ enum class RaptorEagleCCDError : int {
|
|||||||
ERROR_CANNOT_RESET_FPGA,
|
ERROR_CANNOT_RESET_FPGA,
|
||||||
ERROR_EXT_TRIGGER_MODE,
|
ERROR_EXT_TRIGGER_MODE,
|
||||||
ERROR_ACQUISITION_IN_PROGRESS,
|
ERROR_ACQUISITION_IN_PROGRESS,
|
||||||
|
ERROR_CANNOT_START_ACQUISITION,
|
||||||
ERROR_INVALID_PATH,
|
ERROR_INVALID_PATH,
|
||||||
ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS,
|
ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS,
|
||||||
ERROR_NO_FREE_BUFFER
|
ERROR_NO_FREE_BUFFER
|
||||||
@ -65,6 +66,8 @@ struct RaptorEagleCCDErrorCategory : std::error_category {
|
|||||||
return "try to use software trigger while external trigger mode is enabled";
|
return "try to use software trigger while external trigger mode is enabled";
|
||||||
case RaptorEagleCCDError::ERROR_ACQUISITION_IN_PROGRESS:
|
case RaptorEagleCCDError::ERROR_ACQUISITION_IN_PROGRESS:
|
||||||
return "acquisition is in progress";
|
return "acquisition is in progress";
|
||||||
|
case RaptorEagleCCDError::ERROR_CANNOT_START_ACQUISITION:
|
||||||
|
return "cannot start acquisition";
|
||||||
case RaptorEagleCCDError::ERROR_INVALID_PATH:
|
case RaptorEagleCCDError::ERROR_INVALID_PATH:
|
||||||
return "invalid filesystem path";
|
return "invalid filesystem path";
|
||||||
case RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS:
|
case RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user