From cf7e1b423b57d7ffcf20b096642f2b662b11d1a0 Mon Sep 17 00:00:00 2001 From: Joel Waite Ziemann Date: Fri, 11 Aug 2023 12:03:50 -0600 Subject: [PATCH] Issue 42 - compiler warnings --- gridfastslam/gfs2log.cpp | 7 +------ gridfastslam/gfs2rec.cpp | 5 ----- include/gmapping/grid/map.h | 2 +- scanmatcher/scanmatch_test.cpp | 4 ++++ scanmatcher/scanmatcher.cpp | 6 +++--- sensor/sensor_range/rangereading.cpp | 5 +++-- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/gridfastslam/gfs2log.cpp b/gridfastslam/gfs2log.cpp index e688e77..f0066c3 100644 --- a/gridfastslam/gfs2log.cpp +++ b/gridfastslam/gfs2log.cpp @@ -15,12 +15,11 @@ using namespace GMapping::GFSReader; int main (int argc, const char * const * argv){ if (argc<3){ - cout << "usage gfs2log [-err] [-neff] [-part] [-odom] " << endl; + cout << "usage gfs2log [-err] [-part] [-odom] " << endl; cout << " -odom : dump raw odometry in ODOM message instead of inpolated corrected one" << endl; return -1; } bool err=0; - bool neff=0; bool part=0; bool odom=0; // int particle_num; @@ -29,10 +28,6 @@ int main (int argc, const char * const * argv){ err=true; c++; } - if (!strcmp(argv[c],"-neff")){ - neff=true; - c++; - } if (!strcmp(argv[c],"-part")){ part=true; c++; diff --git a/gridfastslam/gfs2rec.cpp b/gridfastslam/gfs2rec.cpp index 5eb65fa..fb0ccda 100644 --- a/gridfastslam/gfs2rec.cpp +++ b/gridfastslam/gfs2rec.cpp @@ -375,16 +375,11 @@ int main (int argc, const char * const * argv){ return -1; } bool err=0; - bool neff=0; unsigned int c=1; if (!strcmp(argv[c],"-err")){ err=true; c++; } - if (!strcmp(argv[c],"-neff")){ - neff=true; - c++; - } ifstream is(argv[c]); if (!is){ cout << "could read file "<< endl; diff --git a/include/gmapping/grid/map.h b/include/gmapping/grid/map.h index 1d91248..1efa370 100644 --- a/include/gmapping/grid/map.h +++ b/include/gmapping/grid/map.h @@ -190,7 +190,7 @@ Point Map::map2world(const IntPoint& p) const{ template Cell& Map::cell(const IntPoint& p) { AccessibilityState s=m_storage.cellState(p); - if (! s&Inside) + if ( !(s&Inside) ) assert(0); //if (s&Allocated) return m_storage.cell(p); assert(0); diff --git a/scanmatcher/scanmatch_test.cpp b/scanmatcher/scanmatch_test.cpp index a2fc94a..e7bdb78 100644 --- a/scanmatcher/scanmatch_test.cpp +++ b/scanmatcher/scanmatch_test.cpp @@ -165,6 +165,10 @@ int main(int argc, const char * const * argv){ } const RangeSensor* rs=dynamic_cast(rr->getSensor()); assert (rs && rs->beams().size()==rr->size()); + if (!rs || rs->beams().size() != rr->size()){ + cout << "Invalid RangeSensor." << endl; + return -1; + } odopathStream << rr->getPose().x << " " << rr->getPose().y << endl; scanmatcher.processScan(*rr); OrientedPoint p=scanmatcher.getPose(); diff --git a/scanmatcher/scanmatcher.cpp b/scanmatcher/scanmatcher.cpp index f7fb885..3a82af3 100644 --- a/scanmatcher/scanmatcher.cpp +++ b/scanmatcher/scanmatcher.cpp @@ -170,7 +170,7 @@ void ScanMatcher::computeActiveArea(ScanMatcherMap& map, const OrientedPoint& p, if (d>m_usableRange) d=m_usableRange; Point phit=lp+Point(d*cos(lp.theta+*angle),d*sin(lp.theta+*angle)); - IntPoint p0=map.world2map(lp); + p0=map.world2map(lp); IntPoint p1=map.world2map(phit); //IntPoint linePoints[20000] ; @@ -432,7 +432,7 @@ double ScanMatcher::optimize(OrientedPoint& _mean, ScanMatcher::CovarianceMatrix double bestScore=-1; OrientedPoint currentPose=init; ScoredMove sm={currentPose,0,0}; - unsigned int matched=likelihoodAndScore(sm.score, sm.likelihood, map, currentPose, readings); + (void)likelihoodAndScore(sm.score, sm.likelihood, map, currentPose, readings); double currentScore=sm.score; moveList.push_back(sm); double adelta=m_optAngularDelta, ldelta=m_optLinearDelta; @@ -497,7 +497,7 @@ double ScanMatcher::optimize(OrientedPoint& _mean, ScanMatcher::CovarianceMatrix localScore=odo_gain*score(map, localPose, readings); //update the score count++; - matched=likelihoodAndScore(localScore, localLikelihood, map, localPose, readings); + (void)likelihoodAndScore(localScore, localLikelihood, map, localPose, readings); if (localScore>currentScore){ currentScore=localScore; bestLocalPose=localPose; diff --git a/sensor/sensor_range/rangereading.cpp b/sensor/sensor_range/rangereading.cpp index a95e3c7..c1ee376 100644 --- a/sensor/sensor_range/rangereading.cpp +++ b/sensor/sensor_range/rangereading.cpp @@ -58,9 +58,10 @@ unsigned int RangeReading::rawView(double* v, double density) const{ }; unsigned int RangeReading::activeBeams(double density) const{ - if (density==0.) + if (density==0.){ return size(); - int ab=0; + } + int ab=0; Point lastPoint(0,0); uint suppressed=0; for (unsigned int i=0; i