Camera Health Check
Introduction
The camera health check runs a set of diagnostics on a connected camera and returns a report (Camera::checkHealth()).
Each individual check has a status (severity) and the underlying value it was derived from, and an overall status aggregates the worst severity across all checks.
This is useful for verifying that the camera is operating within its specified range, and for catching issues such as a stopped fan, or a slow host connection before they affect production.
The same report is available in Zivid Studio, see Health Check.
Note
The camera must be connected to run a health check.
Calling checkHealth() on a camera that is not connected throws an exception.
Status values
Each check reports one of the following severities:
Status |
Meaning |
|---|---|
OK |
Optimal. |
Suboptimal |
Degraded but functional. |
Error |
Faulty or out of spec. |
Unknown |
Check was not performed, or its outcome could not be determined. |
Individual checks
Check |
Description |
Value |
|---|---|---|
Max transfer speed |
The maximum end-to-end transfer speed between the camera and the host computer (the minimum of the camera’s port link speed and the host PC’s network adapter link speed). |
Transfer speed in Mbps. |
Temperature (DMD, LED, Lens) |
The status of the camera’s component temperatures. |
Temperature of the component in degrees Celsius. |
Fan |
Whether the camera’s fan is operating as expected. |
Whether the fan is running or stopped unexpectedly. |
Memory |
The result of the camera’s memory test. |
Number of memory errors detected. |
Infield verification |
The status of the camera’s most recent infield verification. |
Time of the most recent infield verification. |
Each check carries both a status and the underlying value it was derived from. The value is optional and may be unset (for example when the check could not be performed).
Note
The health check is a one-shot diagnostic. To continuously monitor the raw component temperatures in degrees Celsius, see Monitoring Camera Temperature.
Polling the health check
The following sample polls the health check from a separate thread, printing the overall status and each individual status and value every second, while the main thread keeps capturing. This shows how the health check can be monitored in the background of a running capture loop:
const auto pollInterval = std::chrono::seconds(1);
std::promise<void> stop;
auto stopRequested = stop.get_future();
auto polling = std::async(std::launch::async, [&] {
do
{
printHealthcheck(camera.checkHealth());
std::cout << std::endl;
} while(stopRequested.wait_for(pollInterval) == std::future_status::timeout);
});
const auto settings = Zivid::Settings{ Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} } };
const auto captureCycle = std::chrono::seconds(5);
const size_t numberOfCaptures = 5;
for(size_t i = 1; i <= numberOfCaptures; ++i)
{
const auto frame = camera.capture3D(settings);
std::cout << "Captured frame " << i << " of " << numberOfCaptures << std::endl;
if(i < numberOfCaptures)
{
std::this_thread::sleep_for(captureCycle);
}
}
stop.set_value();
polling.get();
var pollInterval = TimeSpan.FromSeconds(1);
var stop = new ManualResetEventSlim(false);
var pollingTask = Task.Run(() =>
{
while (!stop.IsSet)
{
PrintHealthcheck(camera.CheckHealth());
Console.WriteLine();
stop.Wait(pollInterval);
}
});
var settings = new Zivid.NET.Settings { Acquisitions = { new Zivid.NET.Settings.Acquisition { } } };
var captureCycle = TimeSpan.FromSeconds(5);
const int numberOfCaptures = 5;
for (int i = 1; i <= numberOfCaptures; ++i)
{
using (camera.Capture3D(settings)) { }
Console.WriteLine("Captured frame {0} of {1}", i, numberOfCaptures);
if (i < numberOfCaptures)
{
Thread.Sleep(captureCycle);
}
}
stop.Set();
pollingTask.Wait();
poll_interval = 1
stop = threading.Event()
def poll() -> None:
while not stop.is_set():
_print_healthcheck(camera.check_health())
print()
stop.wait(poll_interval)
polling_thread = threading.Thread(target=poll)
polling_thread.start()
settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])
capture_cycle = 5
number_of_captures = 5
for i in range(1, number_of_captures + 1):
camera.capture_3d(settings)
print(f"Captured frame {i} of {number_of_captures}")
if i < number_of_captures:
time.sleep(capture_cycle)
stop.set()
polling_thread.join()
Version History
SDK |
Changes |
|---|---|
2.18.0 |
Camera health check is added. |