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.

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. Run the camera with the capture cycle as similar as possible to the one in your application and use the same Zivid camera settings (pre-configured or capture assistant). For implementation, see the code sample below.

#include <Zivid/Zivid.h>

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

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

namespace
{
    Zivid::Frame assistedCapture(Zivid::Camera &camera)
    {
        const auto parameters = Zivid::CaptureAssistant::SuggestSettingsParameters{
            Zivid::CaptureAssistant::SuggestSettingsParameters::AmbientLightFrequency::none,
            Zivid::CaptureAssistant::SuggestSettingsParameters::MaxCaptureTime{ std::chrono::milliseconds{ 1000 } }
        };
        const auto settings = Zivid::CaptureAssistant::suggestSettings(camera, parameters);
        return camera.capture(settings);
    }
} // namespace

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

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

        auto warmupTime = std::chrono::minutes(10);
        auto captureCycle = std::chrono::seconds(5);

        std::cout << "Warm-up time: " << warmupTime.count() << " minutes" << std::endl;

        const auto beforeWarmup = HighResClock::now();

        while(HighResClock::now() - beforeWarmup < warmupTime)
        {
            const auto beforeCapture = HighResClock::now();
            assistedCapture(camera);
            const auto afterCapture = HighResClock::now();
            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;
            }

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

            auto remainingTimeMinutes = std::chrono::duration_cast<std::chrono::minutes>(remainingTime);
            auto remainingTimeSeconds =
                std::chrono::duration_cast<std::chrono::seconds>(remainingTime - remainingTimeMinutes);
            std::cout << "Remaining time: " << remainingTimeMinutes.count() << " minutes, "
                      << remainingTimeSeconds.count() << " seconds" << 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;
    }
}