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

“Segmentation fault (core dumped)”when run the g2o::EdgeSim3* setMeasurement() #493

Open
ZulunZhu opened this issue Dec 27, 2017 · 5 comments · May be fixed by #844
Open

“Segmentation fault (core dumped)”when run the g2o::EdgeSim3* setMeasurement() #493

ZulunZhu opened this issue Dec 27, 2017 · 5 comments · May be fixed by #844

Comments

@ZulunZhu
Copy link

Hi
I met the Segmentation fault when I use the g2o imitating the ORB-SLAM2 to optimize my pose graph.

Eigen::Matrix<double,3,3> Rcw;
Eigen::Matrix<double,3,1> tcw;
Rcw<<0.999991,-0.00307419,-0.00307221,
0.00307749,0.999995,0.00106957,
0.00306891,-0.00107902,0.999995;
tcw<<-0.00634032,
-0.0152401,
0.849042;
g2o::Sim3 S_test(Rcw,tcw,1.0);
cout<<"S_test:"<<S_test<<endl;
g2o::EdgeSim3* e = new g2o::EdgeSim3();
cout << "e.nIDj " << nIDj << " e.nIDi " << nIDi << endl;
e->setVertex(1, dynamic_castg2o::OptimizableGraph::Vertex*(optimizer.vertex(nIDj)));
e->setVertex(0, dynamic_castg2o::OptimizableGraph::Vertex*(optimizer.vertex(nIDi)));
e->setMeasurement(S_test);

I tried a lot of value of setMeasurement(),but every time my code will go core dumping at this function.
It is very confusing that ORB-SLAM2 will not go down in that function.

Does anyone have the same problem? Appreciating if there is any help.

@chaiein
Copy link

chaiein commented Dec 27, 2017

I think you should give proper path of eigen files for EIGEN directory variable in cmake_gui

@ZulunZhu
Copy link
Author

@chaiein
Thank you for your reply!
I found when I add the "set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")” in the cmakelist my code can run normally .But I really don't know why .
The problem is that when I add this to the cmakelist the other code will go core dumping,so do you have any advice to run g2o without the "-Wall -O3"?

@hmchung
Copy link

hmchung commented May 14, 2018

@ZulunZhu Thank you for your sharing! Works for me too! Amazing... How did you even think of this...?

@alibenD
Copy link

alibenD commented Dec 27, 2018

@ZulunZhu Thank you for your answer, it solves the problem I met(On MacOS10.14.2). I guess -march=native is the key. The problem has confused me very long time.

@JunaidCS032
Copy link

JunaidCS032 commented Jan 9, 2019

@ZulunZhu Thanks for the solution. Phew.. after a long time, finally I get the solution.

Thanks a lot.
PS: @chaiein Thanks for the pointer.

@adrienkaiser adrienkaiser linked a pull request Nov 29, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

5 participants