wvu-navLab / PPP-BayesTree

Code release for "Evaluation of Precise Point Positioning Convergence with an Incremental Graph Optimizer".
MIT License
48 stars 23 forks source link

Eigen Bug #1

Open huanhexiao opened 5 years ago

huanhexiao commented 5 years ago

I run the last command:./../build/examples/pppBayesTree -c phastball.conf it shows: Using threads for all processors pppBayesTree: /home/User/WORK/Factor Graph/GNSS/PPP-BayesTree/PPP-BayesTree-trunk/gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h:142: Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Block(XprType&, Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Index, Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Index, Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Index, Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Index) [with XprType = Eigen::Matrix<double, -1, -1>; int BlockRows = -1; int BlockCols = -1; bool InnerPanel = false; Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Index = long int]: Assertion `a_startRow >= 0 && blockRows >= 0 && a_startRow <= xpr.rows() - blockRows && a_startCol >= 0 && blockCols >= 0 && a_startCol <= xpr.cols() - blockCols' failed.

How to fix it?

watsonryan commented 5 years ago

Can you re-run cmake and provide the output? That might help me figure out the issue.

huanhexiao commented 5 years ago

huanhexiao@JIN:~/WORK/FactorGraph/GNSS/PPP-BayesTree/PPP-BayesTree_trunk/build$ cmake .. -- The CXX compiler identification is GNU 5.4.0 -- The C compiler identification is GNU 5.4.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- GTSAM_SOURCE_ROOT_DIR: [/home/huanhexiao/WORK/FactorGraph/GNSS/PPP-BayesTree/PPP-BayesTree_trunk] -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Boost version: 1.58.0 -- Found the following Boost libraries: -- serialization -- system -- filesystem -- thread -- program_options -- date_time -- regex -- timer -- chrono -- atomic Ignoring Boost restriction on optional lvalue assignment from rvalues -- Found Intel TBB -- Could NOT find MKL (missing: MKL_INCLUDE_DIR MKL_LIBRARIES) -- Found OpenMP_C: -fopenmp (found version "4.0") -- Found OpenMP_CXX: -fopenmp (found version "4.0") -- Found OpenMP: TRUE (found version "4.0")
-- Building 3rdparty -- Looking for execinfo.h -- Looking for execinfo.h - found -- Looking for getline -- Looking for getline - found -- checking for thread-local storage - found -- Found GeographicLib: /usr/local/lib
-- Building base -- Building geometry -- Building inference -- Building symbolic -- Building linear -- Building nonlinear -- Building sam -- Building sfm -- Building slam -- Building smart -- Building navigation -- Building gnssNavigation -- Building configReader -- Building robustModels -- Building gpstk -- GTSAM Version: 4.0.0 -- Install prefix: /usr/local -- Building GTSAM - shared CMake Warning at cmake/GtsamTesting.cmake:229 (message): The script exclusion pattern 'DiscreteBayesNet_FG.cpp;UGM_chain.cpp;UGM_small.cpp;elaboratePoint2KalmanFilter.cpp' did not match any files Call Stack (most recent call first): cmake/GtsamTesting.cmake:55 (gtsamAddExesGlob_impl) examples/CMakeLists.txt:8 (gtsamAddExamplesGlob)

-- Wrote /home/huanhexiao/WORK/FactorGraph/GNSS/PPP-BayesTree/PPP-BayesTree_trunk/build/GTSAMConfig.cmake -- Found Doxygen: /usr/bin/doxygen (found version "1.8.11") found components: doxygen dot -- =============================================================== -- ================ Configuration Options ====================== -- CMAKE_CXX_COMPILER_ID type : GNU -- CMAKE_CXX_COMPILER_VERSION : 5.4.0 -- Build flags
-- Build Tests : Enabled -- Build examples with 'make all' : Enabled -- Build timing scripts with 'make all': Disabled -- Build Docs : Enabled -- Build static GTSAM library instead of shared: Disabled -- Put build type in library name : Enabled -- Build type : Release -- C compilation flags : -std=c11 -Wall -- C++ compilation flags : -std=c++11 -Wall -- Use System Eigen : No -- Use Intel TBB : Yes -- Eigen will use MKL : MKL not found -- Eigen will use MKL and OpenMP : OpenMP found but MKL not found -- Default allocator : TBB -- Packaging flags
-- CPack Source Generator : TGZ -- CPack Generator : TGZ -- GTSAM flags
-- Quaternions as default Rot3 : Disabled -- Runtime consistency checking : Disabled -- Rot3 retract is full ExpMap : Disabled -- Pose3 retract is full ExpMap : Disabled -- Deprecated in GTSAM 4 allowed : Enabled -- Point3 is typedef to Vector3 : Disabled -- Metis-based Nested Dissection : Enabled -- Use tangent-space preintegration: Enabled -- MATLAB toolbox flags
-- Install matlab toolbox : Disabled -- Build Wrap : Enabled -- Python module flags
-- Build python module : Disabled -- =============================================================== CMake Warning at CMakeLists.txt:499 (message): MKL was not found - this is ok, but note that MKL yields better performance. Set GTSAM_WITH_EIGEN_MKL to 'Off' to disable this warning.

-- Configuring done -- Generating done -- Build files have been written to: /home/huanhexiao/WORK/FactorGraph/GNSS/PPP-BayesTree/PPP-BayesTree_trunk/build

huanhexiao commented 5 years ago

I set breakpoints and and step into the problem, the steps order:

1.pppBayesTree.cpp: isam.update(graph, initial_values); 2.ISAM2.cpp: GaussianFactorGraph::sharedptr linearFactors = newFactors.linearize(theta); 3.NonlinearFactorGraph.cpp: _LinearizeOneFactor(this, linearizationPoint, linearFG));

Hope that helps

huanhexiao commented 5 years ago

I happened to find sommething: there is no 'set(CMAKE_BUILD_TYPE " ")' in CMakeLists.txt, the issue above occurs without such option or setted as 'set(CMAKE_BUILD_TYPE "Debug")'; if setted as 'set(CMAKE_BUILD_TYPE "Release")',it works well.

shaolinbit commented 5 years ago

At PseudorangeFactor.cpp, change evaluateError as follows, Vector PseudorangeFactor::evaluateError(const nonBiasStates& q, boost::optional<Matrix&> H) const {

    Vector h = obsMap(satXYZ_, nomXYZ_, 1);
    if(H)
    {
       H->resize(1,5);
       *H<<h(0),h(1),h(2),h(3),h(4);
    }
    //if (H) { (*H) = (Matrix(1,5) << h ).finished(); }
    double est = (h.transpose() * q);
    return (Vector(1) << est - measured_ ).finished();

}

At PhaseFactor.cpp, change it as follows. Vector PhaseFactor::evaluateError(const nonBiasStates& q, const phaseBias& g, boost::optional<Matrix&> H1, boost::optional<Matrix&> H2) const {

    Vector h = obsMap(satXYZ_, nomXYZ_, 1);
    Matrix gnssPartials = Z_1x1;

    //if (H1) { (*H1) = (Matrix(1,5) << h).finished(); }
     if(H1)
    {
       H1->resize(1,5);
       *H1<<h(0),h(1),h(2),h(3),h(4);
    }
    if (H2) {
            gnssPartials(0) = 1.0; // phase bias
            (*H2) = gnssPartials;
    }
    double est = (h.transpose() * q) + g[0];
    return (Vector(1) << est - measured_ ).finished();

}

Then, you can debug it. Some verison of Eigen can not deal with the original style.