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

D415: pyrealsense2 is giving out stale frames or repeated frames #5885

Closed
redM0nk opened this issue Feb 19, 2020 · 6 comments
Closed

D415: pyrealsense2 is giving out stale frames or repeated frames #5885

redM0nk opened this issue Feb 19, 2020 · 6 comments

Comments

@redM0nk
Copy link

redM0nk commented Feb 19, 2020

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Camera Model D415
Firmware Version 05.12.02.100
Operating System & Version Linux (Ubuntu 16)
Kernel Version (Linux Only) 4.15.0-88-generic
Platform PC
SDK Version 2.32.1
Language python
Segment Robot

Issue Description

Hello realsense community

I'm facing an issue where a D415 realsense camera is giving out stale frames (frames with an old timestamp).

The following code captures the frames in 5 seconds and prints the summary on the terminal:

pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.color, 1280, 720, rs.format.rgb8, 30)
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
pipeline.start(config)
start_time = time.time()
num_frames_captured, num_stale_frames = 0, 0
color_ts, depth_ts = None, None
while (time.time() - start_time) < 5:
    frames = pipeline.wait_for_frames()
    color_frame, depth_frame = frames.get_color_frame(), frames.get_depth_frame()
    if color_ts == color_frame.timestamp or depth_ts == depth_frame.timestamp:
        num_stale_frames += 1
    num_frames_captured += 1
    color_ts, depth_ts = color_frame.timestamp, depth_frame.timestamp

print('Summary:\n# Total frames: {}'.format(num_frames_captured))
print('# Stale frames: {}'.format(num_stale_frames))

Output:

Summary:
# Total frames: 115
# Stale frames: 51

Any help is appreciated.

@redM0nk redM0nk changed the title realsense is giving our stale frames or repeated frames D415: pyrealsense2 is giving our stale frames or repeated frames Feb 19, 2020
@redM0nk redM0nk changed the title D415: pyrealsense2 is giving our stale frames or repeated frames D415: pyrealsense2 is giving out stale frames or repeated frames Feb 19, 2020
@dorodnic
Copy link
Contributor

Hi @redM0nk

There could be two possible reasons for this:

  1. The RGB camera by default is controlled by auto-exposure algorithm and can decide to reduce its FPS (when the environment is sufficiently dark). You can enforce the FPS you requested by setting RS2_OPTION_AUTO_EXPOSURE_PRIORITY to 0 on the second sensor.
p = pipe.start(cfg)
p.get_device().query_sensors()[1].set_option(rs.option.auto_exposure_priority, 0.0)
  1. If RGB FPS is fixed, pipeline will provide stale frames in case of frame drops. This can sometimes happen due to high CPU load, but should not be widespread

@RealSenseCustomerSupport
Copy link
Collaborator


@redM0nk Any other questions about this with the reply from dorodnic? Looking forward to your update. Thanks!

@redM0nk
Copy link
Author

redM0nk commented Mar 9, 2020

@dorodnic Thank you for the reponse.
I tried the above mentioned solution and it is giving me some error:
RuntimeError: object doesn't support option #30

The current camera configuration is as follows:

Resolution: 1280x720
Fps: 30
RGB Exposure: 32ms
Depth Exposure: auto

Upgrading the camera to the latest firmware 5.12.3.000 and installing pyrealsense2 using the source code definitely helps.

At present, I'm noticing another issue with timestamp delta (system timestamp - frame timestamp) of 40-70 ms.
Any help with the issue is appreciated.

@RealSenseCustomerSupport
Copy link
Collaborator


@redM0nk The error "RuntimeError: object doesn't support option #30" is due to the sensor you queried is not RGB sensor. Please add the query for RGB sensor.
And please create another one to track the timestamp issue, logs will be appreciated. Thanks!

@RealSenseCustomerSupport
Copy link
Collaborator


@redM0nk Any other question about this? Looking forward to your update. Thanks!

@redM0nk
Copy link
Author

redM0nk commented Mar 17, 2020

thanks. i was able to set the RS2_OPTION_AUTO_EXPOSURE_PRIORITY option on the RGB sensor.
as of now I'm not noticing any more issues with stale frames.
summary:

  1. move to the latest firmware,
  2. compile realsense library from source code,
  3. use appropriate settings (mentioned above)

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