Why does FPS gradually increase after several hours using ZED X with ZED Box (Orin NX 16GB) and ROS 2?

Hi

I’m using ZED X camera on a Jetson Orin NX 16gb.
In my C++ application (using rclcpp), I measure the frame rate by counting successful grab() calls and retrieving both the left image and depth (retrieveImage, retrieveMeasure) every frame.

Initially, the system runs at around 30 FPS, but after 2–3 hours of continuous operation, the FPS increases to around 40.

What could be causing this gradual increase in frame rate over time?

Equipment

  • ZED X
  • ZED Link Mono
  • ZED Box Orin NX 16gb (25W)

SDK version

  • jetpack version : 6.0
  • zed sdk : 4.2.5
  • cuda : 12.2
  • zed Mono sdk : 1.3.0

Excerpt from my code

InitParameters init_params;
init_params.input.setFromCameraID(0);
init_params.camera_resolution = RESOLUTION::HD1080;
init_params.camera_fps = 60;
init_params.depth_mode = DEPTH_MODE::PERFORMANCE;
init_params.coordinate_units = UNIT::MILLIMETER;
init_params.depth_minimum_distance = 0.2 * 1000;
init_params.depth_maximum_distance = 60 * 1000;
init_params.svo_real_time_mode = false;
init_params.async_image_retrieval = false;
init_params.enable_image_enhancement = false;
init_params.camera_image_flip = sl::FLIP_MODE::OFF;
init_params.sdk_verbose = false;
init_params.enable_image_validity_check = false;
init_params.sensors_required = false;
init_params.sdk_gpu_id = 0;

RuntimeParameters runtimeparameters;
runtimeparameters.enable_fill_mode = false;
runtimeparameters.confidence_threshold = 95;

int frame_count = 0;
auto frame_start = std::chrono::steady_clock::now();

while(thread_running == true && rclcpp::ok())
{
  if(zed.grab(runtimeparameters) == ERROR_CODE::SUCCESS)
  { 
    // zed raw data
    zed.retrieveImage(left_img, VIEW::LEFT);
    // depth
    zed.retrieveMeasure(depth_img, sl::MEASURE::DEPTH);
    
    // cout << zed.getCurrentFPS() << "\n"<< endl;
    
    auto frame_end = std::chrono::steady_clock::now();

    if (std::chrono::duration_cast<std::chrono::milliseconds>(frame_end - frame_start).count() > 1000)
    { 
      RCLCPP_INFO(this->get_logger(), "[zed grab check] 1000ms = %d frame [%d]\n", frame_count, std::chrono::duration_cast<std::chrono::milliseconds>(frame_end - frame_start).count());
      frame_count = 0;
      frame_start = frame_end;           
    }
    else
    {
      frame_count++;
    }    
  }
}

Ros2 start

Ros2 2hour after

Hi @yunjik
Welcome to the Stereolabs community.

Normally, other users complain of the contrary :wink:

It’s unusual. What’s the grab frame rate setting?
I guess it’s something related to the DDS communication.
What DDS middleware are you using? Have you set up the system by following our guide?

Hi @Myzhar.

Thanks for your reply!

  • The grab frame rate setting is 60.

  • I’m using Ros2 humble default middleware, Fast DDS.

I’m publishing the left image as JPEG-compressed data, and the depth image is resized from (1920x1080) to (960x540) before being published.

Would it make sense to try switching to Cyclone DDS and test again to see if the behavior changes?

The best thing to do is to apply the recommended settings:

Hi @Myzhar .

Here are the test results after switching to Cyclone DDS.

The ZED Box and the Linux PC are currently connected directly.

If you’re interested, I can share the full configuration scripts and XML files.

After switching from Fast DDS to Cyclone DDS, I noticed the FPS still gradually increases over time. Would you have any advice on how to maintain a stable 40 FPS or higher from the beginning of the program?


Test Results


Additional Observation

In the Power section at the bottom left of jtop, I noticed that the frame rate increased when the CPU, GPU, and CV exceeded 4W. So I ran the test with the command “sudo jetson_clocks” and the results were the same.

What power mode are you using? I cannot find this information in your screenshots.

Hi @Myzhar .

I’m currently using 25W Power mode.

Is the behavior present also in MAXN mode with jetson_clocks.sh active?

Hi @Myzhar.

I switched to MAXN mode, enabled sudo jetson_clocks, and I’m running ROS 2 with Cyclone DDS.
However, I’m only getting around 29 to 33 FPS.

Please remove your code to check the frequency and use the Diagnostic information as explained in the documentation.