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

add support for triggering parameters #58

Open
wants to merge 1 commit into
base: devel
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
16 changes: 16 additions & 0 deletions camera_aravis2/include/camera_aravis2/config_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ struct AcquisitionControl
/// Number of frames to acquire when 'MultiFrame' is selected as acquisition mode.
int frame_count = 0;

/// Setting the mode for the selected trigger.
std::string trigger_mode = "n/a";

/// Setting the signal source for the selected trigger.
std::string trigger_source = "n/a";

/// Selects the I/O line to configure. Once a line has been selected, all changes to the line
/// settings will be applied to the selected line.
std::string line_selector = "n/a";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just realised that LineSelector, LineMode and LineSource are under DigitalIOControl and not under AcquisitionControl.
however, this works just fine since the grouping is completely ignored by aravis when setting the parameters (see #59). i don't have the time to implement this, but i think implementing #57 might be the wiser approach compared to adding yet another struct here for DigitalIOControl.
WDYT?

Copy link
Collaborator

@boitumeloruf boitumeloruf Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to #57 (comment) on the choice of grouping.


/// Sets the mode for the selected line.
std::string line_mode = "n/a";

/// Sets the source signal for the selected line (if the selected line is an output).
std::string line_source = "n/a";

/// Exposure mode used for acquisition.
std::string exposure_mode = "n/a";

Expand Down
75 changes: 75 additions & 0 deletions camera_aravis2/src/camera_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,71 @@ bool CameraDriver::setupCameraStreamStructs()
//--- For bounded feature values (e.g. frame rate), use function that will also get
//--- the bounds and truncate the value accordingly

//--- Trigger Mode
tmp_feature_name = "TriggerMode";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
tmp_feature_name.c_str(), i);
is_parameter_set = getAcquisitionControlParameter(tmp_feature_name, tmp_param_value);
if (is_parameter_set)
setFeatureValueFromParameter<std::string>(tmp_feature_name, tmp_param_value, i);
getFeatureValue<std::string>(tmp_feature_name, acq_ctrl.trigger_mode);
if (is_parameter_set &&
!isParameterValueEqualTo<std::string>(tmp_param_value, acq_ctrl.trigger_mode, i))
config_warn_msgs_.push_back("Stream " + std::to_string(i) + ": " +
"'" + tmp_feature_name + "' is not as specified.");

//--- Trigger Source
tmp_feature_name = "TriggerSource";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
tmp_feature_name.c_str(), i);
is_parameter_set = getAcquisitionControlParameter(tmp_feature_name, tmp_param_value);
if (is_parameter_set)
setFeatureValueFromParameter<std::string>(tmp_feature_name, tmp_param_value, i);
getFeatureValue<std::string>(tmp_feature_name, acq_ctrl.trigger_source);
if (is_parameter_set &&
!isParameterValueEqualTo<std::string>(tmp_param_value, acq_ctrl.trigger_source, i))
config_warn_msgs_.push_back("Stream " + std::to_string(i) + ": " +
"'" + tmp_feature_name + "' is not as specified.");

//--- Line Selector
tmp_feature_name = "LineSelector";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
tmp_feature_name.c_str(), i);
is_parameter_set = getAcquisitionControlParameter(tmp_feature_name, tmp_param_value);
if (is_parameter_set)
setFeatureValueFromParameter<std::string>(tmp_feature_name, tmp_param_value, i);
getFeatureValue<std::string>(tmp_feature_name, acq_ctrl.line_selector);
if (is_parameter_set &&
!isParameterValueEqualTo<std::string>(tmp_param_value, acq_ctrl.line_selector, i))
config_warn_msgs_.push_back("Stream " + std::to_string(i) + ": " +
"'" + tmp_feature_name + "' is not as specified.");

//--- Line Mode
tmp_feature_name = "LineMode";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
tmp_feature_name.c_str(), i);
is_parameter_set = getAcquisitionControlParameter(tmp_feature_name, tmp_param_value);
if (is_parameter_set)
setFeatureValueFromParameter<std::string>(tmp_feature_name, tmp_param_value, i);
getFeatureValue<std::string>(tmp_feature_name, acq_ctrl.line_mode);
if (is_parameter_set &&
!isParameterValueEqualTo<std::string>(tmp_param_value, acq_ctrl.line_mode, i))
config_warn_msgs_.push_back("Stream " + std::to_string(i) + ": " +
"'" + tmp_feature_name + "' is not as specified.");

//--- Line Source
tmp_feature_name = "LineSource";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
tmp_feature_name.c_str(), i);
is_parameter_set = getAcquisitionControlParameter(tmp_feature_name, tmp_param_value);
if (is_parameter_set)
setFeatureValueFromParameter<std::string>(tmp_feature_name, tmp_param_value, i);
getFeatureValue<std::string>(tmp_feature_name, acq_ctrl.line_source);
if (is_parameter_set &&
!isParameterValueEqualTo<std::string>(tmp_param_value, acq_ctrl.line_source, i))
config_warn_msgs_.push_back("Stream " + std::to_string(i) + ": " +
"'" + tmp_feature_name + "' is not as specified.");

//--- Acquisition Mode
tmp_feature_name = "AcquisitionMode";
RCLCPP_DEBUG(logger_, "Evaluating 'AcquisitionControl.%s' for stream %i.",
Expand Down Expand Up @@ -1979,6 +2044,16 @@ void CameraDriver::printCameraConfiguration() const
RCLCPP_INFO(logger_, " Image Height Bound: [%i,%i]",
ROI.height_min, ROI.height_max);

RCLCPP_INFO(logger_, " Trigger Mode: %s", ACQ_CTRL.trigger_mode.c_str());

RCLCPP_INFO(logger_, " Trigger Source: %s", ACQ_CTRL.trigger_source.c_str());

RCLCPP_INFO(logger_, " Line Selector: %s", ACQ_CTRL.line_selector.c_str());

RCLCPP_INFO(logger_, " Line Mode: %s", ACQ_CTRL.line_mode.c_str());

RCLCPP_INFO(logger_, " Line Source: %s", ACQ_CTRL.line_source.c_str());

RCLCPP_INFO(logger_, " Acquisition Mode: %s", ACQ_CTRL.acquisition_mode.c_str());

if (getAcquisitionControlParameter("AcquisitionFrameCount", tmp_param_value) ||
Expand Down
Loading