How to get the diagnostic
The diagnostic information can be simultaneously retrieved using different tools: iVA, ifm3d API, etc. It is also useful to monitor the state of the LEDs, as they indicate the potential presence of errors.
With the ifm Vision Assistant
Diagnosis information can be monitored via the ifm Vision Assistant (iVA) since version 2.6. For an explanation on how to get this information see the iVA documentation.
With ifm3d or ifm3dpy
The ifm3d / ifm3dpy
library provide functions to pull diagnostic data directly from the device.
Diagnostic information can be monitored via two separate ways inside the API:
Via polling the complete diagnostic information JSON
Via listening asynchronously for diagnostic changes
Option 1 gives the full set of information, or a filtered subset as specified by the user:
from ifm3dpy.device import O3R
o3r = O3R()
o3r.get_diagnostic()
o3r.get_diagnostic_filtered({"state":"active"})
#include <ifm3d/device/o3r.h>
auto o3r = std::make_shared<ifm3d::O3R>();
auto diag = o3r->GetDiagnostic();
auto diag = o3r->GetDiagnosticFiltered(ifm3d::JSON::parse("{\"state\":\"active\"}"));
ifm3d ovp8xx diagnostic get
Note
See the O3R
related methods: get_diagnostic
and get_diagnostic_filtered
.
Option 2 provides diagnostic updates asynchronously as they occur. For this purpose, a dedicated PCIC port (50009) is available.
from ifm3dpy.device import O3R
from ifm3dpy.framegrabber import FrameGrabber
o3r = O3R()
fg = FrameGrabber(o3r, 50009)
fg.on_async_error(lambda id, JSON: print(f"Got error {id} with content: {JSON}"))
fg.start([])
#include <iostream>
#include <chrono>
#include <thread>
#include <ifm3d/device/o3r.h>
#include <ifm3d/fg.h>
using namespace ifm3d::literals;
void AsyncDiagCallback(int id, const std::string &message){
std::cout << "Error id: " << id << std::endl
<< "Message: " << message
<< std::endl;
}
int
main()
{
// Declare the device object (one object only, corresponding to the VPU)
auto o3r = std::make_shared<ifm3d::O3R>();
auto fg = std::make_shared<ifm3d::FrameGrabber>(o3r, 50009);
fg->OnAsyncError(&AsyncDiagCallback);
fg->Start({});
std::this_thread::sleep_for (std::chrono::seconds(10));
return 0;
}
Note
See the framegrabber
related methods: on_aync_error
and on_async_notification
.
For a complete example on how to use the diagnostic data, refer to the Python and C++ examples using the ifm3d API.