-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Problems reading from bag file. #9180
Comments
Hi @brunovollmer If every frame was repeating 2 or 3 times instead of just some of them then it might be related to a Python bag reading issue in the link below that has already had a bug report filed with Intel about it. If only some of the frames are repeating then it may be due to a 'hiccup' during recording where the SDK goes back to the last known good frame and continues onward from that point. If the apperance of repeated frames is dependent on the playback settings that you use though instead of the repeating always occurring then the repeated frames may not be within the bag recording itself. Whilst using poll_for_frames() in combination with a sleep period - as you are doing - is recommended for multiple camera appplications, for the purposes of bag playback I wonder if using wait_for_frames() instead would suffice. This would block until a frame is received, with no need to use a sleep period. More information about the differences between the types of for_frames() instructions can be found in the link below. |
Unfortunately wait_for_frames() does also have the problem of freezing once in a while. With my general experience with intelrealsense I was wondering if the problem might be related to not explicitly deleting something or similar approaches. |
Another problem that came up while setting up testing environment is that once every ~20 runs the same code dies with a segfault. Similar to #8601. I have to admit that I'm quite frustrated with this framework especially when you think it is of a huge company like Intel. |
In regard to the duplicate frames issue, a RealSense team member advises in the link below that use of poll_for_frames() should avoid duplicate frames occurring but it is up to the RealSense user to synchronize the frames. In a related case, a RealSense user solved their repeated frames problem by adding a frames.keep() instruction after their _for_frames() line. There is an example of a Python Keep() script here: |
Regarding the segfault any suggestions? |
Noting that you are using SDK 2.40.0: if your segmentation error takes the form of Segmentation fault (core dumped) and tends to occur when closing a stream or releasing frames, a fix was added in SDK 2.42.0 |
Unfortunately I tried it with the newest version that is available on pip (pyrealsense2==2.45.0.3278) and the error continues. |
Use of break conditions can sometimes cause errors that do not occur if a break is not included. Omitting the break can cause problems in term of an inability to catch errors though unless the error is of a type that can be caught as an exception. |
Not really sure what you want to tell me with this advice. One thing I forgot to add is that the function runs in a separate process. |
I was asking how the program runs if you remove the two uses of the break condition in your script. if not frameset: if len(camera_data) == num_frames: |
This freezes and still segfaults. What I really don't get is where the segfault comes from as it only appears when I run the code inside a pytest unit test. |
I played around a bit more and if I run the code in the main thread than the freeze disappears but I do get a segfault once in a while. |
As mentioned earlier in this discussion, there was a problem with sporadic segfaults in earlier SDK versions on Linux when closing streams or releasing frames that had a fix included in SDK 2.42.0. |
And as mentioned earlier I tested that version and all following ones and the segfault continues. |
Is there any further information I can give you to make it easier to find the problem? |
After some more investigation I think I found so problem. How do you submit bug reports here? Should I just state this here or open a new issue? Anyways if anybody has the same problem: When reading from multiple .bag files after one another the program sometimes results in a segmentation fault. The problem only results if you don't read all the files from each bag file. My solution for now is even if I only want to access a subset I still process all frame sets that are available in the file. For now I think this is a bug that should be fixed and not a problem from my side. |
Thanks very much @brunovollmer for sharing information about your solution with the RealSense community. :) I think that it may be sufficient just to leave the details here for future readers to find, as it is the kind of problem that would be difficult to write a single solution for that fits all projects that use multiple bag files. There was a past Python case in the link below where a RealSense user was experiencing segmentation errors when looping through a list of bag files. Within that discussion, I highlighted a C++ case that experienced segmentation errors sometimes when processing a sequence of bag files. A RealSense team member provided feedback in that discussion about a loop test method that worked for them and allowed them to perform 500+ executions without an error occurring. |
I still think this looks like a bug but your call. If you need further information on this, let me know! |
Issue Description
Hey everybody,
I have two very strange problems reading from a .bag file. The first problem is that if I set
repeat_playback=False
,playback.set_real_time(False)
and usepoll_for_frames()
I receive some frames twice or three times before the next frame arrives. This is covered at the moment by the if clause at the end but if there is a solution to this I would prefer to avoid this.The second problem is more severe and annoying and I can't really explain why. The code below runs inside a function that is called three times for three separate .bag files (we have a camera module containing three cameras). If I remove
time.sleep(1)
the second and third time would work as directly the firstframeset
are non and the break condition would apply. With the sleep time it works roughly 60% of the time. While the other 40% one of the files would just randomly return an emptyframeset
to early.Any suggestions?
The text was updated successfully, but these errors were encountered: