Merge pull request #657 from borglab/fix/compiler-warnings

Fix warnings
release/4.3a0
Varun Agrawal 2021-01-05 17:00:01 -05:00 committed by GitHub
commit 745e2207a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 24 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(METIS)
# Add flags for currect directory and below

View File

@ -12,6 +12,7 @@ endif()
if(WIN32)
set_target_properties(metis-gtsam PROPERTIES
PREFIX ""
COMPILE_FLAGS /w
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/../../../bin")
endif()

View File

@ -106,8 +106,8 @@ Vector6 Pose3::adjointTranspose(const Vector6& xi, const Vector6& y,
}
/* ************************************************************************* */
void Pose3::print(const string& s) const {
cout << (s.empty() ? s : s + " ") << *this << endl;
void Pose3::print(const std::string& s) const {
std::cout << (s.empty() ? s : s + " ") << *this << std::endl;
}
/* ************************************************************************* */

View File

@ -22,8 +22,6 @@
#include <iostream>
using namespace std;
namespace gtsam {
// Implementation for N>=5 just uses dynamic version
@ -108,7 +106,7 @@ typename SO<N>::VectorN2 SO<N>::vec(
template <int N>
void SO<N>::print(const std::string& s) const {
cout << s << matrix_ << endl;
std::cout << s << matrix_ << std::endl;
}
} // namespace gtsam

View File

@ -175,10 +175,11 @@ TEST(Values, basic_functions)
{
Values values;
const Values& values_c = values;
values.insert(2, Vector3());
values.insert(4, Vector3());
values.insert(6, Matrix23());
values.insert(8, Matrix23());
Matrix23 M1 = Matrix23::Zero(), M2 = Matrix23::Zero();
values.insert(2, Vector3(0, 0, 0));
values.insert(4, Vector3(0, 0, 0));
values.insert(6, M1);
values.insert(8, M2);
// find
EXPECT_LONGS_EQUAL(4, values.find(4)->key);

View File

@ -354,7 +354,7 @@ class ShonanAveraging2 : public ShonanAveraging<2> {
public:
ShonanAveraging2(const Measurements &measurements,
const Parameters &parameters = Parameters());
explicit ShonanAveraging2(string g2oFile,
explicit ShonanAveraging2(std::string g2oFile,
const Parameters &parameters = Parameters());
};
@ -362,7 +362,7 @@ class ShonanAveraging3 : public ShonanAveraging<3> {
public:
ShonanAveraging3(const Measurements &measurements,
const Parameters &parameters = Parameters());
explicit ShonanAveraging3(string g2oFile,
explicit ShonanAveraging3(std::string g2oFile,
const Parameters &parameters = Parameters());
// TODO(frank): Deprecate after we land pybind wrapper

View File

@ -86,12 +86,15 @@ public:
* @param cameraKey is the index of the camera
* @param landmarkKey is the index of the landmark
*/
GeneralSFMFactor(const Point2& measured, const SharedNoiseModel& model, Key cameraKey, Key landmarkKey) :
Base(model, cameraKey, landmarkKey), measured_(measured) {}
GeneralSFMFactor(const Point2& measured, const SharedNoiseModel& model,
Key cameraKey, Key landmarkKey)
: Base(model, cameraKey, landmarkKey), measured_(measured) {}
GeneralSFMFactor():measured_(0.0,0.0) {} ///< default constructor
GeneralSFMFactor(const Point2 & p):measured_(p) {} ///< constructor that takes a Point2
GeneralSFMFactor(double x, double y):measured_(x,y) {} ///< constructor that takes doubles x,y to make a Point2
GeneralSFMFactor() : measured_(0.0, 0.0) {} ///< default constructor
///< constructor that takes a Point2
GeneralSFMFactor(const Point2& p) : measured_(p) {}
///< constructor that takes doubles x,y to make a Point2
GeneralSFMFactor(double x, double y) : measured_(x, y) {}
virtual ~GeneralSFMFactor() {} ///< destructor
@ -127,7 +130,7 @@ public:
catch( CheiralityException& e) {
if (H1) *H1 = JacobianC::Zero();
if (H2) *H2 = JacobianL::Zero();
// TODO warn if verbose output asked for
//TODO Print the exception via logging
return Z_2x1;
}
}
@ -149,7 +152,7 @@ public:
H1.setZero();
H2.setZero();
b.setZero();
// TODO warn if verbose output asked for
//TODO Print the exception via logging
}
// Whiten the system if needed

View File

@ -303,8 +303,8 @@ struct SfmTrack {
/// print
void print(const std::string& s = "") const {
cout << "Track with " << measurements.size();
cout << " measurements of point " << p << "\n";
std::cout << "Track with " << measurements.size();
std::cout << " measurements of point " << p << std::endl;
}
};
@ -385,8 +385,8 @@ struct SfmData {
/// print
void print(const std::string& s = "") const {
cout << "Number of cameras = " << number_cameras() << "\n";
cout << "Number of tracks = " << number_tracks() << "\n";
std::cout << "Number of cameras = " << number_cameras() << std::endl;
std::cout << "Number of tracks = " << number_tracks() << std::endl;
}
};

View File

@ -188,7 +188,8 @@ int main(int argc, char** argv) {
smartFactors[j]->addRange(i, range);
printf("adding range %g for %d",range,(int)j);
} catch (const invalid_argument& e) {
printf("warning: omitting duplicate range %g for %d",range,(int)j);
printf("warning: omitting duplicate range %g for %d: %s", range,
(int)j, e.what());
}
cout << endl;
}