feat: enhance camera configuration for Gemini 305 with left and right color stream support

This commit is contained in:
slz
2026-01-13 17:23:08 +08:00
committed by ob-yalian
parent 31a34e2cc2
commit 5b3904f078
3 changed files with 76 additions and 100 deletions
+37 -95
View File
@@ -15,16 +15,6 @@ tf_publish_rate: 0.0
ir_info_url: "" ir_info_url: ""
color_info_url: "" color_info_url: ""
# network
enumerate_net_device: true
net_device_ip: ""
net_device_port: 0
force_ip_enable: false
force_ip_mac: ""
force_ip_address: 192.168.1.10
force_ip_subnet_mask: 255.255.255.0
force_ip_gateway: 192.168.1.1
# device_misc # device_misc
device_access_mode: Default device_access_mode: Default
exposure_range_mode: default exposure_range_mode: default
@@ -57,108 +47,53 @@ interleave_skip_enable: false
interleave_skip_index: 1 interleave_skip_index: 1
show_fps_enable: false show_fps_enable: false
# point_cloud
point_cloud_qos: default
enable_point_cloud: false
point_cloud_decimation_filter_factor: 1
enable_colored_point_cloud: false
cloud_frame_id: ""
ordered_pc: false
# color # color
enable_color: false
color_width: 0 color_width: 0
color_height: 0 color_height: 0
color_fps: 0 color_fps: 0
color_format: ANY color_format: ANY
enable_color: true
enable_left_color: true
enable_right_color: true
color_qos: default color_qos: default
color_camera_info_qos: default color_camera_info_qos: default
enable_color_auto_exposure_priority: false
color_rotation: -1 color_rotation: -1
color_flip: false color_flip: false
color_mirror: false color_mirror: false
color_ae_roi_left: -1
color_ae_roi_right: -1
color_ae_roi_top: -1
color_ae_roi_bottom: -1
color_exposure: -1
color_gain: -1
enable_color_auto_white_balance: true
color_white_balance: -1
enable_color_auto_exposure: true
color_ae_max_exposure: -1
color_brightness: -1
color_sharpness: -1
color_gamma: -1
color_saturation: -1
color_contrast: -1
color_hue: -1
color_backlight_compensation: -1
color_powerline_freq: ""
enable_color_decimation_filter: false
color_decimation_filter_scale: -1
color_denoising_level: -1
enable_color_undistortion: false
# left_color # left_color
color_width: 0 enable_left_color: true
color_height: 0 left_color_width: 0
color_fps: 0 left_color_height: 0
color_format: ANY left_color_fps: 0
enable_color: true left_color_format: ANY
color_qos: default left_color_qos: default
color_camera_info_qos: default left_color_camera_info_qos: default
enable_color_auto_exposure_priority: false left_color_rotation: -1
color_rotation: -1 left_color_flip: false
color_flip: false left_color_mirror: false
color_mirror: false
color_ae_roi_left: -1
color_ae_roi_right: -1
color_ae_roi_top: -1
color_ae_roi_bottom: -1
color_exposure: -1
color_gain: -1
enable_color_auto_white_balance: true
color_white_balance: -1
enable_color_auto_exposure: true
color_ae_max_exposure: -1
color_brightness: -1
color_sharpness: -1
color_gamma: -1
color_saturation: -1
color_contrast: -1
color_hue: -1
color_backlight_compensation: -1
color_powerline_freq: ""
enable_color_decimation_filter: false
color_decimation_filter_scale: -1
color_denoising_level: -1
enable_color_undistortion: false
# right_color # right_color
color_width: 0 enable_right_color: true
color_height: 0 right_color_width: 0
color_fps: 0 right_color_height: 0
color_format: ANY right_color_fps: 0
enable_color: true right_color_format: ANY
color_qos: default right_color_qos: default
color_camera_info_qos: default right_color_camera_info_qos: default
right_color_rotation: -1
right_color_flip: false
right_color_mirror: false
# color_common
enable_color_auto_exposure_priority: false enable_color_auto_exposure_priority: false
color_rotation: -1 enable_color_auto_white_balance: true
color_flip: false enable_color_auto_exposure: true
color_mirror: false
color_ae_roi_left: -1 color_ae_roi_left: -1
color_ae_roi_right: -1 color_ae_roi_right: -1
color_ae_roi_top: -1 color_ae_roi_top: -1
color_ae_roi_bottom: -1 color_ae_roi_bottom: -1
color_exposure: -1 color_exposure: -1
color_gain: -1 color_gain: -1
enable_color_auto_white_balance: true
color_white_balance: -1 color_white_balance: -1
enable_color_auto_exposure: true
color_ae_max_exposure: -1 color_ae_max_exposure: -1
color_brightness: -1 color_brightness: -1
color_sharpness: -1 color_sharpness: -1
@@ -173,14 +108,12 @@ color_decimation_filter_scale: -1
color_denoising_level: -1 color_denoising_level: -1
enable_color_undistortion: false enable_color_undistortion: false
# depth # depth
enable_depth: false
depth_width: 0 depth_width: 0
depth_height: 0 depth_height: 0
depth_fps: 0 depth_fps: 0
depth_format: ANY depth_format: ANY
enable_depth: false
depth_qos: default depth_qos: default
depth_camera_info_qos: default depth_camera_info_qos: default
enable_depth_auto_exposure_priority: false enable_depth_auto_exposure_priority: false
@@ -228,16 +161,25 @@ enable_spatial_moderate_filter: false
spatial_moderate_filter_diff_threshold: -1 spatial_moderate_filter_diff_threshold: -1
spatial_moderate_filter_magnitude: -1 spatial_moderate_filter_magnitude: -1
spatial_moderate_filter_radius: -1 spatial_moderate_filter_radius: -1
# point_cloud
point_cloud_qos: default
enable_point_cloud: false
point_cloud_decimation_filter_factor: 1
enable_colored_point_cloud: false
cloud_frame_id: ""
ordered_pc: false
# ldp # ldp
enable_ldp: true enable_ldp: true
ldp_power_level: -1 ldp_power_level: -1
# left_ir # left_ir
enable_left_ir: false
left_ir_width: 0 left_ir_width: 0
left_ir_height: 0 left_ir_height: 0
left_ir_fps: 0 left_ir_fps: 0
left_ir_format: ANY left_ir_format: ANY
enable_left_ir: false
left_ir_qos: default left_ir_qos: default
left_ir_camera_info_qos: default left_ir_camera_info_qos: default
left_ir_rotation: -1 left_ir_rotation: -1
@@ -247,11 +189,11 @@ enable_left_ir_sequence_id_filter: false
left_ir_sequence_id_filter_id: -1 left_ir_sequence_id_filter_id: -1
# right_ir # right_ir
enable_right_ir: false
right_ir_width: 0 right_ir_width: 0
right_ir_height: 0 right_ir_height: 0
right_ir_fps: 0 right_ir_fps: 0
right_ir_format: ANY right_ir_format: ANY
enable_right_ir: false
right_ir_qos: default right_ir_qos: default
right_ir_camera_info_qos: default right_ir_camera_info_qos: default
right_ir_rotation: -1 right_ir_rotation: -1
+27 -5
View File
@@ -8,17 +8,37 @@ from launch_ros.descriptions import ComposableNode
def load_yaml(file_path): def load_yaml(file_path):
with open(file_path, 'r') as f: try:
return yaml.safe_load(f) with open(file_path, 'r') as f:
return yaml.safe_load(f)
except Exception as e:
print(f"[orbbec_camera] Failed to load yaml '{file_path}': {e}")
return {}
def merge_params(default_params, yaml_params): def merge_params(default_params, yaml_params):
if not isinstance(yaml_params, dict):
print(f"[orbbec_camera] YAML parameters should be a dictionary.")
return default_params
for key, value in yaml_params.items(): for key, value in yaml_params.items():
if key in default_params: default_params[key] = value
default_params[key] = value
return default_params return default_params
def resolve_config_file_path(config_file_path: str) -> str:
if not config_file_path:
return config_file_path
if os.path.isabs(config_file_path) and os.path.exists(config_file_path):
return config_file_path
if os.path.exists(config_file_path):
return config_file_path
config_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'config'))
candidate = os.path.join(config_dir, config_file_path)
if os.path.exists(candidate):
return candidate
return config_file_path
def convert_value(value): def convert_value(value):
if isinstance(value, str): if isinstance(value, str):
try: try:
@@ -38,7 +58,9 @@ def convert_value(value):
def load_parameters(context, args): def load_parameters(context, args):
default_params = {arg.name: LaunchConfiguration(arg.name).perform(context) for arg in args} default_params = {arg.name: LaunchConfiguration(arg.name).perform(context) for arg in args}
config_file_path = LaunchConfiguration('config_file_path').perform(context) config_file_path = resolve_config_file_path(
LaunchConfiguration('config_file_path').perform(context)
)
if config_file_path: if config_file_path:
yaml_params = load_yaml(config_file_path) yaml_params = load_yaml(config_file_path)
default_params = merge_params(default_params, yaml_params) default_params = merge_params(default_params, yaml_params)
+12
View File
@@ -510,6 +510,10 @@ void OBCameraNode::setupDevices() {
mirrorPropertyID = OB_PROP_IR_MIRROR_BOOL; mirrorPropertyID = OB_PROP_IR_MIRROR_BOOL;
} else if (stream_index == INFRA2) { } else if (stream_index == INFRA2) {
mirrorPropertyID = OB_PROP_IR_RIGHT_MIRROR_BOOL; mirrorPropertyID = OB_PROP_IR_RIGHT_MIRROR_BOOL;
} else if (stream_index == COLOR_LEFT) {
mirrorPropertyID = OB_PROP_COLOR_LEFT_MIRROR_BOOL;
} else if (stream_index == COLOR_RIGHT) {
mirrorPropertyID = OB_PROP_COLOR_RIGHT_MIRROR_BOOL;
} }
if (device_->isPropertySupported(mirrorPropertyID, OB_PERMISSION_WRITE)) { if (device_->isPropertySupported(mirrorPropertyID, OB_PERMISSION_WRITE)) {
RCLCPP_INFO_STREAM(logger_, "Setting " << stream_name_[stream_index] << " mirror to " RCLCPP_INFO_STREAM(logger_, "Setting " << stream_name_[stream_index] << " mirror to "
@@ -527,6 +531,10 @@ void OBCameraNode::setupDevices() {
flipPropertyID = OB_PROP_IR_FLIP_BOOL; flipPropertyID = OB_PROP_IR_FLIP_BOOL;
} else if (stream_index == INFRA2) { } else if (stream_index == INFRA2) {
flipPropertyID = OB_PROP_IR_RIGHT_FLIP_BOOL; flipPropertyID = OB_PROP_IR_RIGHT_FLIP_BOOL;
} else if (stream_index == COLOR_LEFT) {
flipPropertyID = OB_PROP_COLOR_LEFT_FLIP_BOOL;
} else if (stream_index == COLOR_RIGHT) {
flipPropertyID = OB_PROP_COLOR_RIGHT_FLIP_BOOL;
} }
if (device_->isPropertySupported(flipPropertyID, OB_PERMISSION_WRITE)) { if (device_->isPropertySupported(flipPropertyID, OB_PERMISSION_WRITE)) {
RCLCPP_INFO_STREAM(logger_, "Setting " << stream_name_[stream_index] << " flip to " RCLCPP_INFO_STREAM(logger_, "Setting " << stream_name_[stream_index] << " flip to "
@@ -544,6 +552,10 @@ void OBCameraNode::setupDevices() {
rotationPropertyID = OB_PROP_IR_ROTATE_INT; rotationPropertyID = OB_PROP_IR_ROTATE_INT;
} else if (stream_index == INFRA2) { } else if (stream_index == INFRA2) {
rotationPropertyID = OB_PROP_IR_RIGHT_ROTATE_INT; rotationPropertyID = OB_PROP_IR_RIGHT_ROTATE_INT;
} else if (stream_index == COLOR_LEFT) {
rotationPropertyID = OB_PROP_COLOR_LEFT_ROTATE_INT;
} else if (stream_index == COLOR_RIGHT) {
rotationPropertyID = OB_PROP_COLOR_RIGHT_ROTATE_INT;
} }
if (rotation_stream_[stream_index] != -1 && if (rotation_stream_[stream_index] != -1 &&
device_->isPropertySupported(rotationPropertyID, OB_PERMISSION_WRITE)) { device_->isPropertySupported(rotationPropertyID, OB_PERMISSION_WRITE)) {