Skip to content
Snippets Groups Projects
Commit 024d3436 authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Merge branch 'fix-FactorDist3D' into devel

parents 0b5aa500 739a52e6
No related branches found
No related tags found
No related merge requests found
Pipeline #3381 passed
......@@ -50,7 +50,12 @@ class FactorAutodiffDistance3D : public FactorAutodiff<FactorAutodiffDistance3D,
Map<const Matrix<T,3,1>> pos2(_pos2);
Map<Matrix<T,1,1>> res(_residual);
Matrix<T,1,1> dist_exp ( sqrt( ( pos2 - pos1 ).squaredNorm() ) );
// If pos2 and pos1 are the same, undefined behavior when computing the jacobian
T norm_squared = ( pos2 - pos1 ).squaredNorm();
if (norm_squared < (T)1e-8){
norm_squared += (T)1e-8;
}
Matrix<T,1,1> dist_exp ( sqrt(norm_squared) );
Matrix<T,1,1> dist_meas (getMeasurement().cast<T>() );
Matrix<T,1,1> sqrt_info_upper = getMeasurementSquareRootInformationUpper().cast<T>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment