alejocb / dpptam

DPPTAM: Dense Piecewise Planar Tracking and Mapping from a Monocular Sequence
GNU General Public License v3.0
219 stars 82 forks source link

how to run the program #16

Open yangailin opened 8 years ago

yangailin commented 8 years ago

Dear @alejocb,

I am trying to run the demo, but there has a problem: Segmentation fault (core dumped). Can you tell me how to slove it ? * DPPTAM is working *

* Launch the example sequences or use your own sequence / live camera and update the file 'data.yml' with the corresponding camera_path and calibration parameters * frames_processed -> 8.33333 % Segmentation fault (core dumped)

Thanks in advance~ Ailin

alejocb commented 8 years ago

Hi @yangailin ,

Did you have this segmentation fault with any of the provided sequences? Which sequence did you use?

Best, Alejo.

yangailin commented 8 years ago

For the provided two bag files, I have the same problem "Segmentation fault (core dumped)."

在 2016-05-06 22:23:04,"Alejo Concha" notifications@github.com 写道:

Hi @yangailin ,

Did you have this segmentation fault with any of the provided sequences? Which sequence did you use?

Best, Alejo.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

alejocb commented 8 years ago

Maybe the problem could be that the code only works with the openCV version of ROS. I have to fix this issue...

If it is the problem you could try this: https://github.com/alejocb/dpptam/issues/9

sunghoon031 commented 8 years ago

Actually this might be a bigger issue than we think. Today I also ran the current master version on ROS, I got this segmentation fault. I ran the same code yesterday and it worked just fine. I re-cloned the master and it worked again.

I suspect that it's caused by the threading and copying of the pointer and accessing it while the source is deleted... I'm not too sure so I need to investigate it. Maybe the use of shared pointer could be the solution? I have a sequential implementation of DPPTAM (without any threading) and it's working fine without such issues.

sunghoon031 commented 8 years ago

@yangailin For the time being, try to completely remove the ros DPPTAM workspace and reclone the project again. If changing the openCV version didn't work, this might solve the segmentation fault issue (temporarily)

Sanghoon94 commented 8 years ago

Any solution for this problem? I haven't experience this problem when running on my desktop, but I am now trying it on NVIDIA TX1, and showing Segementation Fault same as Yangailin. Tried multiple times removing and cloning the project. Any suggestions? Thanks

Sanghoon94 commented 8 years ago

I am trying on debugging the segmentation fault issue. I figured out that segmentation fault issue shows up at 299th line of SemiDenseTracking.cpp file which is "cv::Mat image_frame_aux = (*semidense_tracker->image_frame).clone();". So I've changed this into element-wise copy using

for(int i = 0; i < (_semidense_tracker->image_frame).rows; i++) for(int j = 0; j < (_semidense_tracker->image_frame).cols; j++) image_frame_aux.at(i, j) = (*semidense_tracker->image_frame).at(i, j);

And also the element-wise copy show segmentation fault, too. But the odd thing is it doesn't show error at the first index of the loop (i.e i=0, j=0). It kills itself with segmentation fault at random index of the loop. The index of error is different for every execution. So I am assuming somethings going wrong withe the shared access on the instance "semidense_tracker->image_frame" from different threads. I am trying to solve it using boost's mutex, but it's not working quite well. If anyone got any suggestions, I'd be really thankful.

Thank you.

Sanghoon94 commented 8 years ago

Solved the problem.

During "cv::Mat image_frame_aux = (semidense_tracker->image_frame).clone();" is being processed by the semidense tracker, main thread's vo_system::imgcb function changes the content in semidense_tracker->image_frame .

So while semidense_tracker thread is reading the memory, main thread changes the same memory. That is where the segmentation fault was coming from. By locking the image fetching of imgcb when cloning the image in semidense_tracker, I was able to solve the problem.

DunFenTiao commented 7 years ago

i have the same problem of "Segmentation fault (core dumped)" with a live camera as input. what can i try to fix the problem?

yangailin commented 7 years ago

Dear Sanghoon94, Can you tell me how to locking the image fetching of imgcb when cloning the image in semidense_tracker?

Sanghoon94 commented 7 years ago

I can't find the code I've wrote before, but I can briefly explain how I've solved it. The conflicting part was which caused seg fault in my case was:

  1. "cv::Mat image_frame_aux = (*semidense_tracker->image_frame).clone(); " in SemidenseTracker
  2. "vo_system::imgcb" in the main thread

So what you have to do is to skip or halt 1 while 2 is on process, and also skip or halt 2 while 1 is on process. I've tried using mutex locking in boost library, but it wasn't working well. So, I've naively implemented blocking using simple 'if' statements.

I think this is architecture (intel / arm) and machine-by-machine dependent problem, so I am quite not sure if this could solve your problem. Any way, good luck!

DunFenTiao commented 7 years ago

@Sanghoon94 i have the same problem on Segmentation fault (core dumped). thank you for your answer, but i am not familiar with multi-thread programming, how to implemented blocking using simple 'if' statements? would you explain more , provide any example that i can follow?^ ^ that will be a great help

rnunziata commented 7 years ago

I am also very interested in finding a solution to this I get fault. I tried a this solution and it did not work for me. On a upbeat note as this code seem to be unsupported is that ethzasl_ptam works .