Skip to content

Commit

Permalink
Fixed LR auto exposure issue IntelRealSense#131
Browse files Browse the repository at this point in the history
LR gain should be set only when LR auto exposure is disabled
  • Loading branch information
reaganlo committed Mar 9, 2017
1 parent 06524a9 commit 14fdccf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions realsense_camera/cfg/r200_params.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ gen.add("color_sharpness", int_t, 0, "Sharpnes
# Must be set only if color_enable_auto_white_balance is disabled
gen.add("color_white_balance", int_t, 0, "White Balance", 6500, 2000, 8000)

gen.add("color_enable_auto_white_balance", int_t, 0, "Enable Auto White Balance", 1, 0, 1)
gen.add("r200_lr_auto_exposure_enabled", int_t, 0, "LR Auto Exposure Enabled", 0, 0, 1)
gen.add("r200_lr_gain", int_t, 0, "LR Gain", 400, 100, 6399)

# Must be set only if r200_lr_auto_exposure_enabled is disabled
gen.add("r200_lr_gain", int_t, 0, "LR Gain", 400, 100, 6399)
gen.add("r200_lr_exposure", int_t, 0, "LR Exposure", 164, 1, 164)

gen.add("r200_emitter_enabled", int_t, 0, "Emitter Enabled", 1, 0, 1)
gen.add("color_enable_auto_white_balance", int_t, 0, "Enable Auto White Balance", 1, 0, 1)
gen.add("r200_lr_auto_exposure_enabled", int_t, 0, "Enable LR Auto Exposure", 0, 0, 1)

# The following edge parameters must be set only if r200_lr_auto_exposure_enabled is enabled
gen.add("r200_auto_exposure_top_edge", int_t, 0, "Auto Exposure Top Edge", 0, 0, 479)
gen.add("r200_auto_exposure_bottom_edge", int_t, 0, "Auto Exposure Bottom Edge", 479, 0, 479)
gen.add("r200_auto_exposure_left_edge", int_t, 0, "Auto Exposure Left Edge", 0, 0, 639)
gen.add("r200_auto_exposure_right_edge", int_t, 0, "Auto Exposure Right Edge", 639, 0, 639)

gen.add("r200_emitter_enabled", int_t, 0, "Emitter Enabled", 1, 0, 1)

# Depth Control Grouping
r200_depth_control = gen.add_group("R200 Depth Control")
r200_dc_preset_enum = gen.enum(
Expand Down
10 changes: 5 additions & 5 deletions realsense_camera/cfg/zr300_params.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ gen.add("color_sharpness", int_t, 0, "Sha
# Must be set only if color_enable_auto_white_balance is disabled
gen.add("color_white_balance", int_t, 0, "White Balance", 4600, 2000, 8000)

gen.add("color_enable_auto_exposure", int_t, 0, "Enable Auto Exposure", 1, 0, 1)
gen.add("color_enable_auto_white_balance", int_t, 0, "Enable Auto White Balance", 1, 0, 1)
gen.add("r200_lr_auto_exposure_enabled", int_t, 0, "LR Auto Exposure Enabled", 0, 0, 1)
gen.add("r200_lr_gain", int_t, 0, "LR Gain", 400, 100, 6399)

# Must be set only if r200_lr_auto_exposure_enabled is disabled
gen.add("r200_lr_gain", int_t, 0, "LR Gain", 400, 100, 6399)
gen.add("r200_lr_exposure", int_t, 0, "LR Exposure", 164, 1, 164)

gen.add("color_enable_auto_exposure", int_t, 0, "Enable Auto Exposure", 1, 0, 1)
gen.add("color_enable_auto_white_balance", int_t, 0, "Enable Auto White Balance", 1, 0, 1)
gen.add("r200_lr_auto_exposure_enabled", int_t, 0, "Enable LR Auto Exposure", 0, 0, 1)

gen.add("r200_emitter_enabled", int_t, 0, "Emitter Enabled", 1, 0, 1)
gen.add("r200_depth_clamp_min", int_t, 0, "Depth Clamp Min", 0, 0, 65535)
gen.add("r200_depth_clamp_max", int_t, 0, "Depth Clamp Max", 65535, 0, 65535)
Expand Down
8 changes: 5 additions & 3 deletions realsense_camera/src/r200_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
Copyright (c) 2016, Intel Corporation
Copyright (c) 2017, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -284,10 +284,10 @@ namespace realsense_camera
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED, config.r200_lr_auto_exposure_enabled, 0);
if (config.r200_lr_auto_exposure_enabled == 0)
{
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_GAIN, config.r200_lr_gain, 0);
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_EXPOSURE, config.r200_lr_exposure, 0);
}
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_GAIN, config.r200_lr_gain, 0);
rs_set_device_option(rs_device_, RS_OPTION_R200_EMITTER_ENABLED, config.r200_emitter_enabled, 0);

if (config.r200_lr_auto_exposure_enabled == 1)
{
if (config.r200_auto_exposure_top_edge >= height_[RS_STREAM_DEPTH])
Expand All @@ -314,6 +314,8 @@ namespace realsense_camera
rs_set_device_options(rs_device_, edge_options_, 4, edge_values_, 0);
}

rs_set_device_option(rs_device_, RS_OPTION_R200_EMITTER_ENABLED, config.r200_emitter_enabled, 0);

// Depth Control Group Settings
// NOTE: do NOT use the config.groups values as they are zero the first time called
if (bit_level.test(5)) // 2^5 = 32 : Individual Depth Control settings
Expand Down
5 changes: 3 additions & 2 deletions realsense_camera/src/zr300_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
Copyright (c) 2016, Intel Corporation
Copyright (c) 2017, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -386,9 +386,10 @@ namespace realsense_camera
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED, config.r200_lr_auto_exposure_enabled, 0);
if (config.r200_lr_auto_exposure_enabled == 0)
{
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_GAIN, config.r200_lr_gain, 0);
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_EXPOSURE, config.r200_lr_exposure, 0);
}
rs_set_device_option(rs_device_, RS_OPTION_R200_LR_GAIN, config.r200_lr_gain, 0);

rs_set_device_option(rs_device_, RS_OPTION_R200_EMITTER_ENABLED, config.r200_emitter_enabled, 0);
rs_set_device_option(rs_device_, RS_OPTION_R200_DEPTH_CLAMP_MIN, config.r200_depth_clamp_min, 0);
rs_set_device_option(rs_device_, RS_OPTION_R200_DEPTH_CLAMP_MAX, config.r200_depth_clamp_max, 0);
Expand Down

0 comments on commit 14fdccf

Please sign in to comment.