Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the auto shutter range properties to the configuration. #206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/pointgrey_camera_driver/cmake-build-debug/

# JetBrains IDE
/pointgrey_camera_driver/.idea/
4 changes: 4 additions & 0 deletions pointgrey_camera_driver/cfg/PointGrey.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ gen.add("white_balance_blue", int_t, SensorLevels.RECONFIGURE_RUNNING, "W

gen.add("white_balance_red", int_t, SensorLevels.RECONFIGURE_RUNNING, "White balance red component.", 550, 0, 1023)

gen.add("auto_shutter_range_min", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto Shutter Range Minimum", 1, 1, 4095)

gen.add("auto_shutter_range_max", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto Shutter Range Maximum", 4095, 1, 4095)

# Format7-specific parameters
gen.add("format7_roi_width", int_t, SensorLevels.RECONFIGURE_STOP, "Width of Format7 Region of Interest in unbinned pixels, full width if zero.", 0, 0, 65535)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,18 @@ class PointGreyCamera
*/
bool setWhiteBalance(bool& auto_white_balance, uint16_t &blue, uint16_t &red);

/*!
* \brief Sets the auto shutter range property
*
* This function will set the auto shutter range for the camera.. If value is outside the range of min and max,
* it will return false.
* \param min_value Minimum value for the auto shutter range setting.
* \param max_value Maximum value for the auto shutter range setting.
*
* \return Returns true when the configuration could be applied without modification.
*/
bool setAutoShutterRange(uint32_t min_value, uint32_t max_value);

/*!
* \brief Gets the current frame rate.
*
Expand Down
32 changes: 32 additions & 0 deletions pointgrey_camera_driver/src/PointGreyCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ bool PointGreyCamera::setNewConfiguration(pointgrey_camera_driver::PointGreyConf
config.white_balance_blue = blue;
config.white_balance_red = red;

// Set auto shutter range
retVal &= PointGreyCamera::setAutoShutterRange(config.auto_shutter_range_min, config.auto_shutter_range_max);

// Set trigger
switch (config.trigger_polarity)
{
Expand Down Expand Up @@ -624,6 +627,35 @@ bool PointGreyCamera::setWhiteBalance(bool &auto_white_balance, uint16_t &blue,
return true;
}

bool PointGreyCamera::setAutoShutterRange(uint32_t min_value, uint32_t max_value)
{
if (min_value > max_value || min_value > 4095 || max_value > 4095 || min_value == 0) {
return false;
}

// Get camera info to check if color or black and white chameleon
CameraInfo cInfo;
Error error = cam_.GetCameraInfo(&cInfo);
handleError("PointGreyCamera::setAutoShutterRange Failed to get camera info.", error);

unsigned auto_shutter_range_addr = 0x1098;
unsigned enable = 1 << 31;

const uint16_t mask = 0b111111111111;

min_value &= mask;
max_value &= mask;

uint32_t register_value = enable | (min_value << 12) | max_value;

error = cam_.WriteRegister(auto_shutter_range_addr, enable);
handleError("PointGreyCamera::setAutoShutterRange Failed to write to register.", error);

error = cam_.WriteRegister(auto_shutter_range_addr, register_value);
handleError("PointGreyCamera::setAutoShutterRange Failed to write to register.", error);
return true;
}

void PointGreyCamera::setTimeout(const double &timeout)
{
FC2Config pConfig;
Expand Down