I have been working on a script to store and share images directly to and from a GPU ring buffer in C++ and noticed that the output was always being limited to 30fps.
My setup:
- Single ZED X on AGX Orin 64 GB (maxn power mode)
- ZED Link Quad with driver v1.2.2
- ZED SDK v4.2
To be sure its not my code post grab causing the issue, I commented out all the processing after zed.grab()
(That processing only took ~0.05ms) and only timed the grab
call and it was always waiting for 33ms even when I explicitly request 60 fps.
I tried RESOLUTION::SVGA
, DEPTH_MODE::PERFORMANCE
, DEPTH_MODE::NONE
and saw no difference. This makes no sense as I’m sure I saw 60 fps output was using ZED SDK in python before this. I was using setFromStream()
instead of setFromSerialNumber()
. Would that cause this issue?
I am not sure what mistake I am making. I would really appreciate any help.
FYI : I also used jetson_clocks
but it made no difference.
[2025-05-07 09:12:55 UTC][ZED][INFO] Logging level INFO
[2025-05-07 09:12:56 UTC][ZED][INFO] Logging level INFO
[2025-05-07 09:12:56 UTC][ZED][INFO] [Init] Depth mode: NEURAL
[2025-05-07 09:12:59 UTC][ZED][INFO] [Init] Camera FW version: 2001
[2025-05-07 09:12:59 UTC][ZED][INFO] [Init] Video mode: HD1080@60
[2025-05-07 09:12:59 UTC][ZED][INFO] [Init] Serial Number: S/N 47900332
[2025-05-07 09:13:00 UTC][ZED][WARNING] [Init] Self-calibration failed. Point the camera towards a more textured and brighter area. Avoid objects closer than 1 meter (Error code: 0x01)
[Producer] Camera opened
[04:13:00.459] LOOP TOOK 37.05 ms (frame 0)
[04:13:00.464] LOOP TOOK 5.291 ms (frame 1)
[04:13:00.489] LOOP TOOK 24.513 ms (frame 2)
[04:13:00.522] LOOP TOOK 32.467 ms (frame 3)
[04:13:00.555] LOOP TOOK 33.552 ms (frame 4)
[04:13:00.588] LOOP TOOK 32.431 ms (frame 5)
[04:13:00.621] LOOP TOOK 33.321 ms (frame 6)
[04:13:00.655] LOOP TOOK 33.603 ms (frame 7)
[04:13:00.687] LOOP TOOK 32.1 ms (frame 8)
[04:13:00.721] LOOP TOOK 33.201 ms (frame 9)
[04:13:00.755] LOOP TOOK 33.89 ms (frame 10)
This is the code I used :
void FrameProducer::run() {
cudaSetDevice(0);
// Init ZED
sl::InitParameters params;
params.camera_resolution = sl::RESOLUTION::HD1080;
params.camera_fps = 60.0;
params.depth_mode = sl::DEPTH_MODE::NEURAL;
params.depth_stabilization = 0;
params.depth_minimum_distance = 1.2f;
params.depth_maximum_distance = 40.0f;
params.coordinate_units = sl::UNIT::METER;
params.coordinate_system = sl::COORDINATE_SYSTEM::RIGHT_HANDED_Z_UP_X_FWD;
params.sdk_verbose = 1;
params.input.setFromSerialNumber(zed_serial_);
params.open_timeout_sec = -1.0f;
params.async_grab_camera_recovery = true;
if (zed_.open(params) != sl::ERROR_CODE::SUCCESS) {
std::cerr << "[" << timestamp() << "][Producer] Failed to open ZED camera\n";
return;
}
std::cout << "[Producer] Camera opened\n";
// Capture loop
while (running_.load()) {
auto loop_start = std::chrono::high_resolution_clock::now();
if (zed_.grab() != sl::ERROR_CODE::SUCCESS) {
continue;
}
/*
Contained code to save retrieved image and depth data to GPU buffer that took <<1ms to run.
Was also commented out during testing the FPS issue.
*/
auto loop_end = std::chrono::high_resolution_clock::now();
auto loop_time = std::chrono::duration_cast<std::chrono::microseconds>(loop_end - loop_start).count();
std::cerr << "[" << timestamp() << "] LOOP TOOK " << loop_time / 1000.0 << " ms (frame " << fn << ")\n";
}
zed_.close();
}
auto cam_info = zed_.getCameraInformation();
std::cerr << "[" << timestamp() << "] [Producer] SDK reported FPS: " << cam_info.camera_configuration.fps << "\n";
This always returns reported fps as 60.