MIT-SPARK / Kimera-RPGO

Robust Pose Graph Optimization
BSD 2-Clause "Simplified" License
474 stars 133 forks source link

Exported RobustPGO access rights for protected members #20

Closed marcusabate closed 5 years ago

marcusabate commented 5 years ago

When using RobustPGO in Spark VIO I fail to compile with the following errors:

error: ‘isSpecialSymbol’ was not declared in this scope
         if (isSpecialSymbol(symb.chr())) {

error: ‘addAndCheckIfOptimize’ was not declared in this scope
               addAndCheckIfOptimize(new_factors, new_values);

and similar in other locations around the RobustSolver.cpp module. These don't pop up when I make and then ctest the RobustPGO project, so it might be worth it to try to replicate in a test or to at least figure out why the package compiles without error from the RobustPGO repo.

These failures are all inside of RobustSolver::update_batch(gtsam::NonlinearFactorGraph, const gtsam::Values&, const gtsam::Key&)

These members are protected members of the GenericSolver class, of which RobustSolver is a derived class. I don't see any reason why they shouldn't be accessible to the RobustSolver class.

Worth noting that I'm currently failing testLandmark, testLoadGraph, and testMultiRobot. I'm using feature/multirobot after the CMakeLists fix merge from fix/cmake_issues.

yunzc commented 5 years ago

Interesting. Could you copy the test failure messages for the tests that you are failing so I can see them here? I'm not getting these failures for some reason. Also, are you directly using update_batch?

marcusabate commented 5 years ago

I never call update_batch() directly. I only call update. But it doesn't even get that far because these are compile errors on the RobustPGO::RobustSolver.h file itself, not any specific function in my code.

When I run make check in the build folder:

Test project /home/marcus/code/RobustPGO/build
    Start 1: testLandmark
1/9 Test #1: testLandmark .....................***Failed    0.01 sec
    Start 2: testLoadGraph
2/9 Test #2: testLoadGraph ....................***Failed    0.18 sec
    Start 3: testMultiRobot
3/9 Test #3: testMultiRobot ...................***Failed    0.02 sec
    Start 4: testPcm
4/9 Test #4: testPcm ..........................   Passed    0.03 sec
    Start 5: testPcmDoOptimize
5/9 Test #5: testPcmDoOptimize ................   Passed    0.01 sec
    Start 6: testPcmSimple
6/9 Test #6: testPcmSimple ....................   Passed    0.03 sec
    Start 7: testPoseWithCovariance
7/9 Test #7: testPoseWithCovariance ...........   Passed    1.16 sec
    Start 8: testPoseWithNode
8/9 Test #8: testPoseWithNode .................   Passed    0.00 sec
    Start 9: testTrajectory
9/9 Test #9: testTrajectory ...................   Passed   12.21 sec

67% tests passed, 3 tests failed out of 9

Total Test time (real) =  13.66 sec

The following tests FAILED:
      1 - testLandmark (Failed)
      2 - testLoadGraph (Failed)
      3 - testMultiRobot (Failed)
Errors while running CTest
CMakeFiles/check.dir/build.make:57: recipe for target 'CMakeFiles/check' failed
make[3]: *** [CMakeFiles/check] Error 8
CMakeFiles/Makefile2:221: recipe for target 'CMakeFiles/check.dir/all' failed
make[2]: *** [CMakeFiles/check.dir/all] Error 2
CMakeFiles/Makefile2:228: recipe for target 'CMakeFiles/check.dir/rule' failed
make[1]: *** [CMakeFiles/check.dir/rule] Error 2
Makefile:181: recipe for target 'check' failed
make: *** [check] Error 2
marcusabate commented 5 years ago

For make testLandmark.run:

/home/marcus/code/RobustPGO/tests/testLandmark.cpp:19: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLandmark.cpp:173: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLandmark.cpp:327: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
There were 3 failures
tests/CMakeFiles/testLandmark.run.dir/build.make:57: recipe for target 'tests/CMakeFiles/testLandmark.run' failed
make[3]: *** [tests/CMakeFiles/testLandmark.run] Error 3
CMakeFiles/Makefile2:407: recipe for target 'tests/CMakeFiles/testLandmark.run.dir/all' failed
make[2]: *** [tests/CMakeFiles/testLandmark.run.dir/all] Error 2
CMakeFiles/Makefile2:414: recipe for target 'tests/CMakeFiles/testLandmark.run.dir/rule' failed
make[1]: *** [tests/CMakeFiles/testLandmark.run.dir/rule] Error 2
Makefile:171: recipe for target 'tests/CMakeFiles/testLandmark.run.dir/rule' failed
make: *** [tests/CMakeFiles/testLandmark.run.dir/rule] Error 2

For make testLoadGraph.run:

/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:19: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:52: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:111: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:146: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
RobustSolver::addOdometry expects single factor and single value.
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:207: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:235: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:268: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:329: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:362: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:424: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:457: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
RobustSolver::addOdometry expects single factor and single value.
/home/marcus/code/RobustPGO/tests/testLoadGraph.cpp:518: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
There were 12 failures
tests/CMakeFiles/testLoadGraph.run.dir/build.make:57: recipe for target 'tests/CMakeFiles/testLoadGraph.run' failed
make[3]: *** [tests/CMakeFiles/testLoadGraph.run] Error 12
CMakeFiles/Makefile2:439: recipe for target 'tests/CMakeFiles/testLoadGraph.run.dir/all' failed
make[2]: *** [tests/CMakeFiles/testLoadGraph.run.dir/all] Error 2
CMakeFiles/Makefile2:446: recipe for target 'tests/CMakeFiles/testLoadGraph.run.dir/rule' failed
make[1]: *** [tests/CMakeFiles/testLoadGraph.run.dir/rule] Error 2
Makefile:186: recipe for target 'tests/CMakeFiles/testLoadGraph.run.dir/rule' failed
make: *** [tests/CMakeFiles/testLoadGraph.run.dir/rule] Error 2

For make testMultiRobot.run:

/home/marcus/code/RobustPGO/tests/testMultiRobot.cpp:19: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
/home/marcus/code/RobustPGO/tests/testMultiRobot.cpp:188: Failure: "Exception: Rot3::CayleyChart::Local Derivative" 
There were 2 failures
tests/CMakeFiles/testMultiRobot.run.dir/build.make:57: recipe for target 'tests/CMakeFiles/testMultiRobot.run' failed
make[3]: *** [tests/CMakeFiles/testMultiRobot.run] Error 2
CMakeFiles/Makefile2:309: recipe for target 'tests/CMakeFiles/testMultiRobot.run.dir/all' failed
make[2]: *** [tests/CMakeFiles/testMultiRobot.run.dir/all] Error 2
CMakeFiles/Makefile2:316: recipe for target 'tests/CMakeFiles/testMultiRobot.run.dir/rule' failed
make[1]: *** [tests/CMakeFiles/testMultiRobot.run.dir/rule] Error 2
Makefile:126: recipe for target 'tests/CMakeFiles/testMultiRobot.run.dir/rule' failed
make: *** [tests/CMakeFiles/testMultiRobot.run.dir/rule] Error 2
marcusabate commented 5 years ago

Passing all tests after I enabled the two gtsam options mentioned in the Readme.

However, the compiler issues are still there.

yunzc commented 5 years ago

Can you also post the compiler error messages here when you get the chance?

marcusabate commented 5 years ago

Still haven't figured out why this is happening, but I managed to fix it simply by moving the definition of update_batch() to the .cpp file instead of keeping it in the header file. Since this is better form anyway it doesn't seem like a bad thing to pr into the code base.

Came across this interesting link regarding a similar problem when using templated classes. Not the same issue we have but it's still worth a look.

yunzc commented 5 years ago

Ahh I see. Nice, I've been meaning to do that anyways. Thanks!

yunzc commented 5 years ago

Reopen because this is causing runtime errors on my 16.04 machine ./RpgoReadG2o: symbol lookup error: ./RpgoReadG2o: undefined symbol: _ZN9RobustPGO12RobustSolver11updateBatchEN5gtsam20NonlinearFactorGraphERKNS1_6ValuesERKm

But works fine on 18.04

yunzc commented 5 years ago

Solved by making RobustPGO a static library. Keeping an eye out on this in case there are more problems.

yunzc commented 5 years ago

Ahh as I suspected this might cause problems on the LAMP side... have to investigate further

yunzc commented 5 years ago

RobustPGO kept as SHARED library. Still some issues if run on some laptops with Ubuntu 16.04 but generally works fine with 18.04