Commit ab45f6a8 authored by Laurent Claustre's avatar Laurent Claustre

first attempt to manage latency_time within the SyncObj

parent 5d68dc47
......@@ -115,12 +115,9 @@ namespace lima
void setExpTime(double exp_time);
void getExpTime(double& exp_time);
void setLatTime(double lat_time);
void getLatTime(double& lat_time);
void getExposureTimeRange(double& min_expo, double& max_expo) const;
void getLatTimeRange(double& min_lat, double& max_lat) const;
void setNbFrames(int nb_frames);
void getNbFrames(int& nb_frames);
void getNbHwAcquiredFrames(int &nb_acq_frames);
......@@ -191,6 +188,7 @@ namespace lima
// -- some readonly attributes :
void getBytesPerPixel(double &o_value) const;
void getFirmwareVersion(std::string &o_fwv) const;
void setFrameRate(double i_frame_rate);
void getFrameRate(double &o_frame_rate) const;
void getFrameRateRange(double& o_min_lat, double& o_max_lat) const;
void getFullRoiControl(bool &o_fullROIcontrol) const;
......
......@@ -62,10 +62,16 @@ namespace lima
virtual void getNbHwFrames(int& nb_frames);
virtual void getValidRanges(ValidRangesType& valid_ranges);
virtual void updateValidRanges();
virtual void updateValidRanges();
private:
Camera& m_cam;
double m_exp_time;
double m_lat_time;
double m_readout_time;
double m_max_acq_period;
ValidRangesType m_valid_ranges;
void adjustFrameRate();
};
} // namespace Andor3
......
......@@ -63,11 +63,7 @@ namespace Andor3
void setExpTime(double exp_time /In/ );
void getExpTime(double& exp_time /Out/ );
void setLatTime(double lat_time /In/ );
void getLatTime(double& lat_time /Out/ );
void getExposureTimeRange(double& min_expo /Out/, double& max_expo /Out/) const;
void getLatTimeRange(double& min_lat /Out/, double& max_lat /Out/) const;
void setNbFrames(int nb_frames /In/ );
void getNbFrames(int& nb_frames /Out/ );
......@@ -139,6 +135,7 @@ namespace Andor3
void getBytesPerPixel(double &o_value /Out/ ) const;
void getFirmwareVersion(std::string &o_fwv /Out/ ) const;
void getFrameRate(double &o_frame_rate /Out/ ) const;
void setFrameRate(double i_frame_rate);
void getFrameRateRange(double& o_min_lat /Out/, double& o_max_lat /Out/) const;
void getFullRoiControl(bool &o_fullROIcontrol /Out/ ) const;
void getImageSize(int &o_frame_size /Out/ ) const;
......
......@@ -328,7 +328,6 @@ lima::Andor3::Camera::~Camera()
<< "to rise above 5C before conitnuing the shutdown.";
// setTemperatureSP(6.0);
double the_sensor_temperature;
size_t the_sensor_temp_wait = 0;
DEB_TRACE() << "While leaving the camera, the temperature provided by the cooler is " << the_sensor_temperature;
getTemperature(the_sensor_temperature);
......@@ -698,6 +697,7 @@ void
lima::Andor3::Camera::setExpTime(double exp_time)
{
DEB_MEMBER_FUNCT();
setFloat(andor3::ExposureTime, exp_time);
}
......@@ -710,37 +710,6 @@ lima::Andor3::Camera::getExpTime(double& exp_time)
exp_time = the_exp_time;
}
void
lima::Andor3::Camera::setLatTime(double lat_time)
{
DEB_MEMBER_FUNCT();
double the_exp_time;
double the_rate;
// double the_readout_time;
getFloat(andor3::ExposureTime, &the_exp_time);
// getFloat(andor3::ReadoutTime, &the_readout_time);
// lat_time = ( lat_time > the_readout_time ) ? lat_time : the_readout_time;
// if ( lat_time < the_readout_time ) {
// lat_time = the_readout_time;
// THROW_HW_ERROR(Error) << "You have requested a latency "
// }
the_rate = 1.0 / (the_exp_time + lat_time);
setFloat(andor3::FrameRate, the_rate);
}
void
lima::Andor3::Camera::getLatTime(double& lat_time)
{
DEB_MEMBER_FUNCT();
double the_exp_time;
double the_rate;
getFloat(andor3::ExposureTime, &the_exp_time);
getFloat(andor3::FrameRate, &the_rate);
lat_time = (1.0 / the_rate) - the_exp_time;
}
void
lima::Andor3::Camera::getExposureTimeRange(double& min_expo, double& max_expo) const
......@@ -755,20 +724,6 @@ lima::Andor3::Camera::getExposureTimeRange(double& min_expo, double& max_expo) c
max_expo = the_max;
}
void
lima::Andor3::Camera::getLatTimeRange(double& min_lat, double& max_lat) const
{
DEB_MEMBER_FUNCT();
double the_exp_time;
double the_rate_min, the_rate_max;
getFloat(andor3::ExposureTime, &the_exp_time);
getFloatMin(andor3::FrameRate, &the_rate_min);
getFloatMax(andor3::FrameRate, &the_rate_max);
min_lat = (1.0 / the_rate_max) - the_exp_time;
max_lat = (1.0 / the_rate_min) - the_exp_time;
}
void
lima::Andor3::Camera::setNbFrames(int nb_frames)
......@@ -1814,6 +1769,13 @@ lima::Andor3::Camera::getFirmwareVersion(std::string &o_fwv) const
}
void
lima::Andor3::Camera::setFrameRate(double i_frame_rate)
{
DEB_MEMBER_FUNCT();
setFloat(andor3::FrameRate, i_frame_rate);
}
void
lima::Andor3::Camera::getFrameRate(double &o_frame_rate) const
{
......
......@@ -42,6 +42,26 @@ lima::Andor3::SyncCtrlObj::SyncCtrlObj(lima::Andor3::Camera& cam) :
m_cam(cam)
{
DEB_CONSTRUCTOR();
double min_exp_time, max_exp_time;
double min_frame_rate, max_frame_rate;
m_cam.getExpTime(m_exp_time);
m_cam.getExposureTimeRange(min_exp_time, max_exp_time);
m_cam.getFrameRateRange(min_frame_rate, max_frame_rate);
m_cam.getReadoutTime(m_readout_time);
m_lat_time = 0;
m_max_acq_period = 1.0/ min_frame_rate;
m_valid_ranges.min_exp_time = min_exp_time;
m_valid_ranges.max_exp_time = max_exp_time;
// Latency is a total elpased time between two exposure, which
// include the readout time + a delay time.
// So the minimum latency is equal to the readout time
m_valid_ranges.min_lat_time = m_readout_time;
m_valid_ranges.max_lat_time = m_max_acq_period - m_exp_time + m_readout_time;
}
//---------------------------
......@@ -80,14 +100,19 @@ void
lima::Andor3::SyncCtrlObj::setExpTime(double exp_time)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(exp_time);
m_exp_time = exp_time;
m_cam.setExpTime(exp_time);
adjustFrameRate();
updateValidRanges();
}
void
lima::Andor3::SyncCtrlObj::getExpTime(double& exp_time)
{
DEB_MEMBER_FUNCT();
m_cam.getExpTime(exp_time);
exp_time = m_exp_time;
}
#pragma mark -
......@@ -96,14 +121,50 @@ void
lima::Andor3::SyncCtrlObj::setLatTime(double lat_time)
{
DEB_MEMBER_FUNCT();
m_cam.setLatTime(lat_time);
updateValidRanges();
DEB_PARAM() << DEB_VAR1(lat_time);
m_lat_time = lat_time;
}
void
lima::Andor3::SyncCtrlObj::getLatTime(double& lat_time)
{
DEB_MEMBER_FUNCT();
m_cam.getLatTime(lat_time);
lat_time = m_lat_time;
}
void
lima::Andor3::SyncCtrlObj::adjustFrameRate()
{
DEB_MEMBER_FUNCT();
double min_frame_rate, max_frame_rate;
double frame_rate;
// If the exposure_time is less than readout_time the SDK
// set the frame rate to the maximum which is 1.0/readout_time,
// so in that case the latency_time is null and cannot be ajusted
// readout_time can evolve according to ADC speed and hw roi/bin.
m_cam.getReadoutTime(m_readout_time);
m_cam.getFrameRateRange(min_frame_rate, max_frame_rate);
// update the min latency_time it can change with other hw parameters.
m_valid_ranges.min_lat_time = m_readout_time;
m_max_acq_period = 1.0/min_frame_rate;
// here the latency_time is disabled
if (m_exp_time < m_readout_time*1.001) {
m_lat_time = 0;
} else {
frame_rate = 1.0/(m_exp_time + m_lat_time - m_readout_time);
if (frame_rate > max_frame_rate) frame_rate = max_frame_rate;
m_cam.setFrameRate(frame_rate);
m_valid_ranges.max_lat_time = m_max_acq_period - m_exp_time - m_readout_time;
}
}
#pragma mark -
......@@ -125,15 +186,9 @@ void
lima::Andor3::SyncCtrlObj::getValidRanges(ValidRangesType& valid_ranges)
{
DEB_MEMBER_FUNCT();
double min_time;
double max_time;
m_cam.getExposureTimeRange(min_time, max_time);
valid_ranges.min_exp_time = min_time;
valid_ranges.max_exp_time = max_time;
m_cam.getLatTimeRange(min_time, max_time);
valid_ranges.min_lat_time = min_time;
valid_ranges.max_lat_time = max_time;
valid_ranges = m_valid_ranges;
DEB_RETURN() << DEB_VAR2(valid_ranges.min_exp_time, valid_ranges.max_exp_time);
DEB_RETURN() << DEB_VAR2(valid_ranges.min_lat_time, valid_ranges.max_lat_time);
......@@ -146,7 +201,7 @@ void
lima::Andor3::SyncCtrlObj::updateValidRanges()
{
DEB_MEMBER_FUNCT();
DEB_ALWAYS() << "about to update the valid range for exposure and latency times...";
ValidRangesType the_v_range;
getValidRanges(the_v_range);
validRangesChanged(the_v_range);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment