Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #657

Merged
merged 7 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gtsam/3rdparty/metis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't make changes inside metis. Licensing and upgrade difficulties.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I saw the git-blame for this CMake file and this file has been updated before, hence I went ahead. Does this new information change anything?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, maybe the Makefile is what we added, and we should not make changes in the library itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the library is unchanged. 🙂 Guess we'll keep this update.

cmake_minimum_required(VERSION 3.0)
project(METIS)

# Add flags for currect directory and below
Expand Down
1 change: 1 addition & 0 deletions gtsam/3rdparty/metis/libmetis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions gtsam/geometry/Pose3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/* ************************************************************************* */
Expand Down
4 changes: 1 addition & 3 deletions gtsam/geometry/SOn-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include <iostream>

using namespace std;

namespace gtsam {

// Implementation for N>=5 just uses dynamic version
Expand Down Expand Up @@ -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
11 changes: 7 additions & 4 deletions gtsam/nonlinear/tests/testValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,13 @@ 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, M2;
M1 << 0, 0, 0, 0, 0, 0;
M2 << 0, 0, 0, 0, 0, 0;
values.insert(2, Vector3(0, 0, 0));
values.insert(4, Vector3(0, 0, 0));
values.insert(6, M1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Z_2x3 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Z_2x3 isn't defined but I see what you mean.

values.insert(8, M2);

// find
EXPECT_LONGS_EQUAL(4, values.find(4)->key);
Expand Down
4 changes: 2 additions & 2 deletions gtsam/sfm/ShonanAveraging.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,15 @@ 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());
};

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
Expand Down
26 changes: 18 additions & 8 deletions gtsam/slam/GeneralSFMFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class GeneralSFMFactor: public NoiseModelFactor2<CAMERA, LANDMARK> {
protected:

Point2 measured_; ///< the 2D measurement
bool verbose_; ///< Flag for print verbosity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a boolean flag for 100k factors in an SFM problem. Problematic. Propose to leave this out of this PR and discuss a better strategy

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. Should I leave the exception printing in? Ideally that should be part of a logging framework. I'll already looked up some options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no printing. Let's leave for when we have logging, which would be great. I do like glog :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah glog and CodeCov (for unit test code coverage) are two things on my radar. I'll create an issue for it that someone else can tackle.


public:

Expand All @@ -86,12 +87,17 @@ class GeneralSFMFactor: public NoiseModelFactor2<CAMERA, LANDMARK> {
* @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():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(const Point2& measured, const SharedNoiseModel& model,
Key cameraKey, Key landmarkKey, bool verbose = false)
: Base(model, cameraKey, landmarkKey),
measured_(measured),
verbose_(verbose) {}

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

Expand Down Expand Up @@ -127,7 +133,9 @@ class GeneralSFMFactor: public NoiseModelFactor2<CAMERA, LANDMARK> {
catch( CheiralityException& e) {
if (H1) *H1 = JacobianC::Zero();
if (H2) *H2 = JacobianL::Zero();
// TODO warn if verbose output asked for
if (verbose_) {
std::cout << e.what() << std::endl;
}
return Z_2x1;
}
}
Expand All @@ -149,7 +157,9 @@ class GeneralSFMFactor: public NoiseModelFactor2<CAMERA, LANDMARK> {
H1.setZero();
H2.setZero();
b.setZero();
// TODO warn if verbose output asked for
if (verbose_) {
std::cout << e.what() << std::endl;
}
}

// Whiten the system if needed
Expand Down
8 changes: 4 additions & 4 deletions gtsam/slam/dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -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;
}
};

Expand Down
3 changes: 2 additions & 1 deletion gtsam_unstable/examples/SmartRangeExample_plaza1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down