Skip to content

Commit

Permalink
PR #7074 from Eran: New AC limiters & handling per VAL request
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel authored Aug 11, 2020
2 parents 91e9429 + 7f5c425 commit 158a2f4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
23 changes: 13 additions & 10 deletions src/algo/depth-to-rgb-calibration/valid-results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,22 +417,25 @@ void librealsense::algo::depth_to_rgb_calibration::validate_dsm_params(
for h/vFactor and divide the suggested h/vOffset range by 10.
Update ww30: +/-1.5% limiter both H/V [0.985..1.015] until AC3.
Update ww33: vFactor for all 60 cocktail 1500h units is in the range
of 1.000-1.015; changing to [0.995-1.015]
*/
std::string error;

if( dsm_params.model != RS2_DSM_CORRECTION_AOT )
throw invalid_value_exception( "non-AoT (1) mode is currently unsupported" );
error += to_string() << " {mode}" << +dsm_params.model << " must be AOT";

if( dsm_params.h_scale < 0.985 || dsm_params.h_scale > 1.015 )
throw invalid_value_exception( to_string() << "H scale (" << dsm_params.h_scale
<< ") exceeds 1.5% change in FOV" );
if( dsm_params.v_scale < 0.985 || dsm_params.v_scale > 1.015 )
throw invalid_value_exception( to_string() << "V scale (" << dsm_params.v_scale
<< ") exceeds 1.5% change in FOV" );
error += to_string() << " {H-scale}" << dsm_params.h_scale << " exceeds 1.5% change";
if( dsm_params.v_scale < 0.995 || dsm_params.v_scale > 1.015 )
error += to_string() << " {V-scale}" << dsm_params.v_scale << " exceeds [-0.5%-1.5%]";

if( dsm_params.h_offset < -2. || dsm_params.h_offset > 2. )
throw invalid_value_exception( to_string() << "H offset (" << dsm_params.h_offset
<< ") is limited to 2deg FOV tilt" );
error += to_string() << " {H-offset}" << dsm_params.h_offset << " is limited to 2 degrees";
if( dsm_params.v_offset < -2. || dsm_params.v_offset > 2. )
throw invalid_value_exception( to_string() << "V offset (" << dsm_params.v_offset
<< ") is limited to 2deg FOV tilt" );
error += to_string() << " {V-offset}" << dsm_params.v_offset << " is limited to 2 degrees";

if( ! error.empty() )
throw invalid_value_exception( "invalid DSM:" + error + " [LIMIT]" );
}

11 changes: 10 additions & 1 deletion src/l500/l500-depth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,16 @@ namespace librealsense

void l500_depth_sensor::override_dsm_params( rs2_dsm_params const & dsm_params )
{
algo::depth_to_rgb_calibration::validate_dsm_params( dsm_params ); // throws!
try
{
algo::depth_to_rgb_calibration::validate_dsm_params( dsm_params ); // throws!
}
catch( invalid_value_exception const & e )
{
if( ! getenv( "RS2_AC_IGNORE_LIMITERS" ))
throw;
AC_LOG( ERROR, "Ignoring (RS2_AC_IGNORE_LIMITERS) " << e.what() );
}

ac_depth_results table( dsm_params );
// table.params.timestamp = std::chrono::system_clock::now().time_since_epoch().count();
Expand Down
25 changes: 23 additions & 2 deletions unit-tests/algo/d2rgb/test-reproduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int main( int argc, char * argv[] )
{
// The build number is only available within Jenkins and so we have to hard-
// code it ><
std::cout << RS2_API_VERSION_STR << ".2082" << std::endl;
std::cout << RS2_API_VERSION_STR << ".2158" << std::endl;
continue;
}
if( ! strcmp( dir, "--debug" ) || ! strcmp( dir, "-d" ) )
Expand Down Expand Up @@ -183,6 +183,14 @@ int main( int argc, char * argv[] )
read_binary_file( dir, "cal.registers", &camera.cal_regs );
read_binary_file( dir, "dsm.params", &camera.dsm_params );

if( camera.cal_regs.EXTLdsmXoffset < 0. || camera.cal_regs.EXTLdsmXoffset > 100000.
|| camera.cal_regs.EXTLdsmXscale < 0. || camera.cal_regs.EXTLdsmXscale > 100000.
|| camera.cal_regs.EXTLdsmYoffset < 0 || camera.cal_regs.EXTLdsmYoffset > 100000.
|| camera.cal_regs.EXTLdsmYscale < 0 || camera.cal_regs.EXTLdsmYscale > 100000. )
{
throw std::invalid_argument( "cal.registers file is malformed! (hexdump -v -e '4/ \"%f \"')" );
}

algo::optimizer::settings settings;
try
{
Expand Down Expand Up @@ -254,7 +262,7 @@ int main( int argc, char * argv[] )
status += results;
}

TRACE( "\n___\nRESULTS: (" << RS2_API_VERSION_STR << " build 2082)" );
TRACE( "\n___\nRESULTS: (" << RS2_API_VERSION_STR << " build 2158)" );

auto intr = cal.get_calibration().get_intrinsics();
auto extr = cal.get_calibration().get_extrinsics();
Expand All @@ -268,6 +276,19 @@ int main( int argc, char * argv[] )
AC_LOG( DEBUG, AC_D_PREC << "extr" << (rs2_extrinsics) extr );
AC_LOG( DEBUG, AC_D_PREC << "dsm" << cal.get_dsm_params() );

try
{
algo::validate_dsm_params( cal.get_dsm_params() );
}
catch( librealsense::invalid_value_exception const & e )
{
AC_LOG( ERROR, "Exception: " << e.what() );
if( ! status.empty() )
status += ' ';
status += logger.get_codes();
logger.reset();
}

TRACE( "\n___\nVS:" );
AC_LOG( DEBUG, AC_D_PREC << "dsm" << camera.dsm_params );

Expand Down

0 comments on commit 158a2f4

Please sign in to comment.