Skip to content

Commit 1505c96

Browse files
jmackay2jmackay2
andauthored
Fix uninitialized build warnings (#6283)
* Fix some build warnings * clang format * Add PCL_ERROR message if the SVD fails --------- Co-authored-by: jmackay2 <jmackay2> Co-authored-by: jmackay2 <jmackay2@gmail.com>
1 parent 46f15a6 commit 1505c96

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

io/include/pcl/io/impl/vtk_lib_io.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pcl::io::vtkPolyDataToPointCloud (vtkPolyData* const polydata, pcl::PointCloud<P
122122
{
123123
for (std::size_t i = 0; i < cloud.size (); ++i)
124124
{
125-
float normal[3];
125+
float normal[3] = {0.0f, 0.0f, 0.0f};
126126
normals->GetTupleValue (i, normal);
127127
pcl::setFieldValue<PointT, float> (cloud[i], normal_x_idx, normal[0]);
128128
pcl::setFieldValue<PointT, float> (cloud[i], normal_y_idx, normal[1]);

recognition/src/ransac_based/obj_rec_ransac.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ pcl::recognition::ObjRecRANSAC::groupHypotheses(std::list<HypothesisBase>& hypot
296296
#endif
297297

298298
// Compute the bounds for the positional discretization
299-
float b[6]; scene_octree_.getBounds (b);
299+
float b[6] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
300+
scene_octree_.getBounds (b);
300301
float enlr = scene_bounds_enlargement_factor_*std::max (std::max (b[1]-b[0], b[3]-b[2]), b[5]-b[4]);
301302
b[0] -= enlr; b[1] += enlr;
302303
b[2] -= enlr; b[3] += enlr;

registration/include/pcl/registration/impl/ndt.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ NormalDistributionsTransform<PointSource, PointTarget, Scalar>::computeTransform
121121
// 2009]
122122
Eigen::JacobiSVD<Eigen::Matrix<double, 6, 6>> sv(
123123
hessian, Eigen::ComputeFullU | Eigen::ComputeFullV);
124+
#if EIGEN_VERSION_AT_LEAST(3, 4, 0)
125+
if (sv.info() != Eigen::ComputationInfo::Success) {
126+
trans_likelihood_ = score / static_cast<double>(input_->size());
127+
converged_ = 0;
128+
PCL_ERROR("[%s::computeTransformation] JacobiSVD on hessian failed!\n",
129+
getClassName().c_str());
130+
return;
131+
}
132+
#endif
124133
// Negative for maximization as opposed to minimization
125134
Eigen::Matrix<double, 6, 1> delta = sv.solve(-score_gradient);
126135

0 commit comments

Comments
 (0)