Warm-up

Allowing the Zivid 3D camera to warm up and reach thermal equilibrium can improve the overall accuracy and success of an application. In this article, we explain why and how to warm up the Zivid 3D camera.

Tip

As of SDK v2.7.0 a Thermal Stabilization mode is available. With this mode enabled the warm-up period is reduced.

Why warm-up is needed

Zivid 3D cameras have active electronic components (e.g. white light projector) that produce heat when being used. The internal heat-up causes components to undergo mechanical variations when their body temperature changes.

These mechanical changes cause tiny displacements in essential optical components which affects the triangulation accuracy when calculating the position of the points in the point cloud. The 3D calibration of the camera is less accurate during a warming or cooling phase because of the many unknown possible temperature states each internal component can be in. We call this phenomenon warm-up drift.

It is recommended to control camera temperature and allow enough time for all components to reach a steady temperature (thermal equilibrium). Consequently, Zivid 3D calibration can recognize and accurately predict the physical state of the camera and produce a correct point cloud.

Warmup

When to perform warm-up

It is recommended to warm-up the camera in the following conditions:

  • The application requires tight tolerances, for example:

    • Picking applications with < 5 mm per meter distance from the camera.

    • Inspection applications with < 0.5% trueness requirements.

  • The application requires moderate capture cycles (faster than once every 10 seconds).

  • Before in-field correction.

  • Before hand-eye calibration.

  • Before running production.

  • When the camera has not been connected to power e.g. after mechanically installing the camera.

  • When the camera has been powered on but has not been capturing point clouds in the last 20 minutes e.g. when starting a production cell in the morning.

How to perform warm-up

To warm up the camera, capture 3D point clouds for 10 minutes with a fixed capture cycle.

Connect

The first step is to connect to the camera.

Zivid::Application zivid;

std::cout << "Connecting to camera" << std::endl;
auto camera = zivid.connectCamera();

Set Capture cycle and settings

During warm-up, the capture cycle should be as similar as possible to the capture cycle in the application (bin-picking, de-palletization, etc.).

If the deployed camera captures, e.g., once every 5 seconds, it should capture with the same interval during the warm-up phase. If the camera does not have a stable capture cycle, the capture cycle during the warm-up phase should be between the extreme values. For example, if it captures once in 5 to 11 seconds in the application, it should capture once in 8 seconds during warm-up. If the delay between the captures in the application is longer than 10 seconds, there is no need to warm up the camera.

Note

Thermal Stabilization mode should be enabled if the application capture cycle has a variable period.

The camera settings used during the warm-up should also be as similar as possible to those in the application (pre-configured or capture assistant).

const auto warmupTime = std::chrono::minutes(10);
const auto captureCycle = std::chrono::seconds(5);
const auto maxCaptureTime = std::chrono::milliseconds(1000);

std::cout << "Getting camera settings" << std::endl;
const auto parameters = Zivid::CaptureAssistant::SuggestSettingsParameters{
    Zivid::CaptureAssistant::SuggestSettingsParameters::AmbientLightFrequency::none,
    Zivid::CaptureAssistant::SuggestSettingsParameters::MaxCaptureTime{ maxCaptureTime }
};
const auto settings = Zivid::CaptureAssistant::suggestSettings(camera, parameters);

Note

This warm-up method uses the white light projector as a heating element to warm up the camera during a steady capture cycle. The ratio of time the projector is turned on compared to the total cycle time is called the duty cycle. The duty cycle affects the rate at which the camera heats up as well as the final, steady-state temperature of the camera after the warm-up phase.

Warm up the camera

To warm up the camera, capture 3D point clouds in a loop for 10 minutes until the temperature stabilizes.

std::cout << "Starting warm up for: " << warmupTime.count() << " minutes" << std::endl;

const auto beforeWarmup = HighResClock::now();

while(HighResClock::now() - beforeWarmup < warmupTime)
{
    const auto beforeCapture = HighResClock::now();
    camera.capture(settings);
    const auto afterCapture = HighResClock::now();
    const auto captureTime = afterCapture - beforeCapture;
    if(captureTime < captureCycle)
    {
        std::this_thread::sleep_for(captureCycle - captureTime);
    }
    else
    {
        std::cout << "Your capture time is longer than your desired capture cycle."
                  << "Please increase the desired capture cycle." << std::endl;
    }

    const auto remainingTime = warmupTime - (HighResClock::now() - beforeWarmup);

    const auto remainingTimeMinutes = std::chrono::duration_cast<std::chrono::minutes>(remainingTime);
    const auto remainingTimeSeconds =
        std::chrono::duration_cast<std::chrono::seconds>(remainingTime - remainingTimeMinutes);
    std::cout << "Remaining time: " << remainingTimeMinutes.count() << " minutes, "
              << remainingTimeSeconds.count() << " seconds." << std::endl;
}
std::cout << "Warm up completed" << std::endl;

For an implementation example, see the complete warm-up code sample below.

/*
Short example of a basic way to warm up the camera with specified time and capture cycle.
*/

#include <Zivid/Zivid.h>

#include <chrono>
#include <iostream>
#include <thread>

using HighResClock = std::chrono::high_resolution_clock;
using Duration = std::chrono::nanoseconds;

int main()
{
    try
    {
        Zivid::Application zivid;

        std::cout << "Connecting to camera" << std::endl;
        auto camera = zivid.connectCamera();
        const auto warmupTime = std::chrono::minutes(10);
        const auto captureCycle = std::chrono::seconds(5);
        const auto maxCaptureTime = std::chrono::milliseconds(1000);

        std::cout << "Getting camera settings" << std::endl;
        const auto parameters = Zivid::CaptureAssistant::SuggestSettingsParameters{
            Zivid::CaptureAssistant::SuggestSettingsParameters::AmbientLightFrequency::none,
            Zivid::CaptureAssistant::SuggestSettingsParameters::MaxCaptureTime{ maxCaptureTime }
        };
        const auto settings = Zivid::CaptureAssistant::suggestSettings(camera, parameters);
        std::cout << "Starting warm up for: " << warmupTime.count() << " minutes" << std::endl;

        const auto beforeWarmup = HighResClock::now();

        while(HighResClock::now() - beforeWarmup < warmupTime)
        {
            const auto beforeCapture = HighResClock::now();
            camera.capture(settings);
            const auto afterCapture = HighResClock::now();
            const auto captureTime = afterCapture - beforeCapture;
            if(captureTime < captureCycle)
            {
                std::this_thread::sleep_for(captureCycle - captureTime);
            }
            else
            {
                std::cout << "Your capture time is longer than your desired capture cycle."
                          << "Please increase the desired capture cycle." << std::endl;
            }

            const auto remainingTime = warmupTime - (HighResClock::now() - beforeWarmup);

            const auto remainingTimeMinutes = std::chrono::duration_cast<std::chrono::minutes>(remainingTime);
            const auto remainingTimeSeconds =
                std::chrono::duration_cast<std::chrono::seconds>(remainingTime - remainingTimeMinutes);
            std::cout << "Remaining time: " << remainingTimeMinutes.count() << " minutes, "
                      << remainingTimeSeconds.count() << " seconds." << std::endl;
        }
        std::cout << "Warm up completed" << std::endl;
    }
    catch(const std::exception &e)
    {
        std::cerr << "Error: " << Zivid::toString(e) << std::endl;
        std::cout << "Press enter to exit." << std::endl;
        std::cin.get();
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}