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

Eigen Bug #1

Open
huanhexiao opened this issue Jan 2, 2019 · 5 comments
Open

Eigen Bug #1

huanhexiao opened this issue Jan 2, 2019 · 5 comments

Comments

@huanhexiao
Copy link

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
Copy link
Contributor

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

@huanhexiao
Copy link
Author

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
Copy link
Author

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

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

Hope that helps

@huanhexiao
Copy link
Author

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants