jbehley / SuMa

Surfel-based Mapping for 3d Laser Range Data (SuMa)
MIT License
532 stars 166 forks source link

Is it possible to add a ros wrapper? #18

Closed LiShuaixin closed 4 years ago

LiShuaixin commented 4 years ago

HI @jbehley , thanks a lot for sharing this great work! I tested it using KITTI. The visualization of point cloud result is good.

Then I tried to write a ros warper for SuMa, so as to test it on real robots/cars with a 3D lidar. Just like what is used in the qt wrapper /visualizer/VisualizerWindow.cpp and implementation /visualizer/visualizer.cpp, I create a class SuMaRosWarper with a member of std::shared_ptr<SurfelMapping> fusion_, then created a std::shared_ptr<SurfelMapping> pointer to initialize it. However, a segment fault was thrown in the construction of SurfelMapping. I backtraced the code and found the error occurred when called glGenBuffers(1, &id_);:

2019-09-27 16-34-35屏幕截图

BUT I can run your qt version smoothly. What's wrong with this? any suggestion?

jbehley commented 4 years ago

Since SuMa uses OpenGL for computation, you always need a opengl context in the same (!) thread. Updates and everything must also happen in this thread.

With ROS you have to take into account that nodes might not run on the same thread.

See for instance glow::X11OffscreenContext for a headless/windowless context.

But with this you still need a X server running. A true X free context you could get with EGL.

LiShuaixin commented 4 years ago

Thanks a lot!

LiShuaixin commented 4 years ago

Hi, @jbehley Do you think it's possible to use ros rviz to create a opengl context for SuMa?

jbehley commented 4 years ago

If you manage to run it in the same thread, then it could work. But I never tried this. So no guarantees.

MohamedAfifii commented 4 years ago

@LiShuaixin Were you able to use rviz with suma?