Add color_powerline_freq param in gemini_330_series.launch.py

This commit is contained in:
jj
2025-04-23 18:19:11 +08:00
parent d25ae121c8
commit 6a7e388221
3 changed files with 16 additions and 2 deletions
@@ -534,6 +534,7 @@ class OBCameraNode {
int color_constrast_ = -1;
int color_hue_ = -1;
bool enable_color_backlight_compenstation_ = false;
std::string color_powerline_freq_;
bool enable_color_decimation_filter_ = false;
int color_decimation_filter_scale_ = -1;
// depth ae roi
@@ -91,6 +91,7 @@ def generate_launch_description():
DeclareLaunchArgument('color_constrast', default_value='-1'),
DeclareLaunchArgument('color_hue', default_value='-1'),
DeclareLaunchArgument('enable_color_backlight_compenstation', default_value='false'),
DeclareLaunchArgument('color_powerline_freq', default_value=''),#disable ,50hz ,60hz ,auto
DeclareLaunchArgument('enable_color_decimation_filter', default_value='false'),
DeclareLaunchArgument('color_decimation_filter_scale', default_value='-1'),
DeclareLaunchArgument('depth_width', default_value='0'),
+14 -2
View File
@@ -486,6 +486,19 @@ void OBCameraNode::setupDevices() {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT,
set_enable_color_backlight_compenstation);
}
if (!color_powerline_freq_.empty() &&
device_->isPropertySupported(OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT, OB_PERMISSION_WRITE)) {
if (color_powerline_freq_ == "disable") {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT, 2);
} else if (color_powerline_freq_ == "50hz") {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT, 0);
} else if (color_powerline_freq_ == "60hz") {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT, 1);
} else if (color_powerline_freq_ == "auto") {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT, 3);
}
RCLCPP_INFO_STREAM(logger_, "Setting color powerline freq to " << color_powerline_freq_);
}
if (device_->isPropertySupported(OB_PROP_DEPTH_AUTO_EXPOSURE_PRIORITY_INT, OB_PERMISSION_WRITE)) {
int set_enable_depth_auto_exposure_priority = enable_depth_auto_exposure_priority_ ? 1 : 0;
RCLCPP_INFO_STREAM(logger_, "Setting depth auto exposure priority to "
@@ -1520,6 +1533,7 @@ void OBCameraNode::getParameters() {
setAndGetNodeParameter<int>(color_hue_, "color_hue", -1);
setAndGetNodeParameter<bool>(enable_color_backlight_compenstation_,
"enable_color_backlight_compenstation", false);
setAndGetNodeParameter<std::string>(color_powerline_freq_, "color_powerline_freq", "");
setAndGetNodeParameter<bool>(enable_color_decimation_filter_, "enable_color_decimation_filter",
false);
setAndGetNodeParameter<int>(color_decimation_filter_scale_, "color_decimation_filter_scale", -1);
@@ -2335,13 +2349,11 @@ void OBCameraNode::setDepthAutoExposureROI() {
config.x1_right = (depth_ae_roi_right_ < 0) ? 0 : depth_ae_roi_right_;
config.x1_right =
(depth_ae_roi_right_ > width_[DEPTH] - 1) ? width_[DEPTH] - 1 : config.x1_right;
}
if (depth_ae_roi_bottom_ != -1) {
config.y1_bottom = (depth_ae_roi_bottom_ < 0) ? 0 : depth_ae_roi_bottom_;
config.y1_bottom =
(depth_ae_roi_bottom_ > height_[DEPTH] - 1) ? height_[DEPTH] - 1 : config.y1_bottom;
}
device_->setStructuredData(OB_STRUCT_DEPTH_AE_ROI, reinterpret_cast<const uint8_t *>(&config),
sizeof(config));