The Retrieve command runs into a timeout (after 5s) while waiting for the stereo images
It now starts waits for the color image (“Wating for Images” in the “/Execute/Temporary” slot in the pink frame)
The Retrieve command continues and runs into a timeout (after 10s, end of pink frame) while waiting for the color image
The Retrieve command is now executed again which cancels the FlexView capture
The images (orange frames) are triggered a few seconds later by the hardware trigger, but at this point the FlexView capture is not ready
Since the color images are waited for by the Retrieve command, but the stereo images are waited for in the FlexView capture block, only the color images are received
We have to make sure that the PiezoCaptureThread is running the FlexView capture while we are waiting for the hardware trigger. In your code you are checking for “CaptureTimeout”, after which you are executing the Retrieve again. Can you try to also execute the Trigger command again at that point?
to Q1:
You can always record a log file and inspect it visually with NxProfiler. Note, that threads are listed alphabetically. In order to move a thread to the top, you can pin it (icon on the right side) and then unpin it again.
to Q2:
Yes, this it what I had in mind. The code you inserted before re-executing Retrieve looks like the same lines of code you use to trigger the first time. So this should work.
Thank you for your polite responses every time.
I really appreciate it.
The code above that I created based on your suggestion worked fine.
I tried various conditions,
such as running a trigger after leaving it for a long time,
but the result of the retrieve command is true.
(For both the 3D camera and the color camera)
However, one thing I’m concerned about is the time
it takes to issue a retrieve command again after a retrieve timeout occurs.
(The time it takes from issuing the trigger command to completion.)
If unfortunately the trigger switch turns on during that time,
the image will not be captured.
So, along with the related questions,
could you please tell me the following:
Q1.Is it possible to set the retrieve command timeout parameter to infinite?
If possible, what value should I set?
Q2.If the retrieve command timeout cannot be set to infinite,
what is the maximum value that can be set?
Q3.I want to trigger the color camera and 3D camera at the same time.
Currently, the TriggerMode of the 3D camera is “FallingEdge”
and the color camera is “internal”.
Should the color camera also be set to “FallingEdge” like the 3D camera?
Q4. Is there an explanation somewhere
about how to analyze logs with nxPlofiler?
(For example, an explanation
that FlexViewCapture runs on PiezoCaprureThread, etc.)
Or, since it’s difficult to explain everything,
would it be better to ask a question on the community
if any strange behavior occurs
and have the contents of the LOG explained to me?
When I was setting the conditions,
I left it in trigger waiting mode for about 30 seconds,
and then when I input the trigger,
it didn’t recognize the first trigger ON.
(The projector LED was glowing blue,
so maybe Retrieve just wasn’t working properly?)
However, if I turned it ON as is,
the Retrieve was successful.
In other words, the second trigger ON worked properly.
If the wait time was around 20 minutes,
the first time was also recognized properly.
Below is the log.
(After leaving it for 20 minutes, I started LOG,
then turned the trigger ON
and after a while, turned the trigger ON again.) tmp_NxTreeEdit20250318(wait30min-aftTrig2times-missFirstTrg)-wait3.zip (52.2 MB)
By the way,
The purpose of my code is to capture images with both the 3D camera and the color camera
when the trigger switch is ON, and to obtain almost simultaneous 3D and color images.
In reality, the 3D camera image is used to analyze the object,
and the color image is used as an auxiliary
to detect erroneous analysis by AI processing.
Could you please confirm it?
Thank you in advance.
K.N.
to Q1/Q2:
You can try setting the timeout value to a negative value, e.g. -1. According to the code this should then internally be treated as an infinite timeout.
to Q3:
As explained in the C-Series Camera Operation Guide, the special TriggerMode Internal can be used to synchronize the stereo and color camera triggering while respecting the different light settings. Since the camera has only one hardware trigger input, I think setting the color camera’s TriggerMode also to “FallingEdge” would make it capture the color image while the stereo camera’s projector is lighting the scene, which would be the case with FlexView enabled. Please refer to the guide, which explains this in detail.
to Q4:
Right now there is no detailed explanation on how to analyze the log files with NxProfiler, because it is mainly used by the IDS and Ensenso support team for debugging.
Missing trigger edges:
It depends on your complete hardware setup, but you could consider using some kind of external device that takes care of detecting the hardware trigger signal and communicates with the computer. This way you could monitor the trigger state in your program and issue a software trigger to the camera.
Unfortunately,
an external device cannot be used due to issues with
the installation location and variations in imaging timing due to communication delays.
What is the cause of the missing trigger edges problem?
Looking at the LOG, the 3D image and color image arrived
after the 3D image timeout of the Retrieve command,
so it looked like the if statement in the Retrieve completion condition in the code
was not satisfied and the trigger was issued again.
Wouldn’t it be possible to solve this
by tweaking the retrieve completion condition in the code?
At the placement location,
the FrontLight is disabled because even with Brightness set to 1,
the light is too strong and affects surrounding devices.
Therefore, images are captured only by the projector on the 3D camera side.
I immediately tried changing the TriggerMode on the color camera to FallingEdge,
but the behavior became unstable.
I couldn’t capture an image unless I pressed the trigger switch several times,
and the projector LED would light up three times or just once
depending on when I pressed the trigger switch.
I think this is probably happening because the camera image it is waiting
for in Retrieve varies depending on the timing.
Since I cannot use the FrontLight,
I think the only option is to use the color camera internally.
What do you think?
What is the cause of the missing trigger edges problem?
As described in the Capturing Images with Hardware Trigger guide, we “need to make sure that the camera is continuously armed and waiting for a new trigger signal in order to not miss any trigger edges.”
[…] the FrontLight is disabled because even with Brightness set to 1, the light is too strong and affects surrounding devices.
With the Brightness set to 1.0 this is expected, because it operates the LED at full power. The value range here is 0 to 1.0.
Could you try the following, in which I separated the retrieval of the stereo images and the color image. It also makes use of the infinite timeout. So while waiting for stereo images to arrive, we can check for the interrupt. If no trigger occurs, the stereo images will be retrieved after the hardware trigger. Afterwards, the color image is retrieved separately.
{
NxLibCommand trigger(cmdTrigger);
trigger.parameters()[itmSubset] = valAll;
trigger.execute();
NxLibCommand retrieve(cmdRetrieve);
retrieve.parameters()[itmTimeout] = -1;
retrieve.parameters()[itmCameras] = m_serial;
retrieve.execute(false);
// Wait for the stereo images.
// With the ability to abort on an external interrupt.
while(true) {
if (retrieve.finished() && retrieve.result()[m_serial][itmRetrieved].asBool()) {
break;
}
// Abort on external interrupt.
if (!pThread->m_Valid) {
retrieve.cancel();
while (true) {
if (retrieve.finished()) {
return 1;
}
}
}
}
// Retrieve the color image after the stereo images have been
// successfully received.
retrieve.parameters()[itmTimeout] = 1000;
retrieve.parameters()[itmCameras] = m_serial_C;
retrieve.execute();
}
Note that we did not trigger the camera again directly after the retrieval of the stereo images in the while-loop. However, if we know that the hardware trigger occurs every 10 seconds and the transfer of the images is fast enough, it might be sufficient to arm the trigger again after the retrieval of the color image.
I am glad to hear that the infinite timeout works for you. And no, I don’t think that there will be any problems with your simple method. Until future proves me wrong
Currently, the device is unavailable,
so we plan to try the code you suggested in 8 hours.
Actually, there is something that bothers me about the log above.
When the first trigger is turned ON,
it appears that three sets of images are captured by the PiezoCaptureThread,
but the left image that normally comes first appears to be missing.
When the second trigger is turned ON,
the left image comes first in the PiezoCaptureThread as usual.
Is it possible that one of the left images captured
with the first trigger was taken before the trigger was turned ON?
The profile block at this point is not complete. The title is “N/A” and the block does not start with the usual “GenICam Set Register …” blocks. It starts with a “Decode image block”, which indicates that an image has been received and your FlexView sequence is complete although the log does not show it.
In one of the “parallaxCnv.exe” threads extensive polling is happening, which probably causes the debug buffers to overflow. Hence the missing information in the block.
During the first 5 seconds of the Retrieve command (waiting for StereoImage), no image was received, but during the next 5 seconds (waiting for ColorImage), a StereoImage and a ColorImage were received.
(Orange Box in the above image)
As a result,
retrieve.finished() is true
retrieve.result()[m_serial][itmRetrieved].asBool() is false
retrieve.result()[m_serial_C][itmRetrieved].asBool() is true
retrieve.result()[itmErrorSymbol].asString() is “CaptureTimeout”
Based on the above, it is determined that the retrieval is incomplete.
A timeout is checked and if a timeout occurs, trigger.execute() is executed again.
If this prediction is correct, should I have done the following in step 2 above?
If there is a Triggered camera, issue a Retrieve to the other side.
If there is no Triggered camera, issue a Trigger again.
Code with the above in mind
{
NxLibCommand trigger(cmdTrigger);
trigger.parameters()[itmSubset] = valAll;
trigger.execute();
NxLibCommand retrieve(cmdRetrieve);
retrieve.parameters()[itmTimeout] = 5000;
retrieve.parameters()[itmCameras][0] = m_serial;
retrieve.parameters()[itmCameras][1] = m_serial_C;
retrieve.execute(false);
// Wait for the stereo images.
// With the ability to abort on an external interrupt.
while(true) {
if (retrieve.finished()) {
bool rc1 = retrieve.result()[m_serial][itmRetrieved].asBool();
bool rc2 = retrieve.result()[m_serial_C][itmRetrieved].asBool();
bool rc12 = root[itmCameras][m_serial][itmParameters][itmCapture][itmTriggered].asBool();
bool rc22 = root[itmCameras][m_serial_C][itmParameters][itmCapture][itmTriggered].asBool();
if (rc1 && rc2) {
break;
}
else if (rc1 && rc22){
retrieve.parameters()[itmTimeout] = 5000;
retrieve.parameters()[itmCameras] = m_serial_C;
retrieve.execute(static_cast<bool>(false));
}
else if(rc2 && rc12){
retrieve.parameters()[itmTimeout] = 5000;
retrieve.parameters()[itmCameras] = m_serial;
retrieve.execute(static_cast<bool>(false));
}
else{
trigger.parameters()[itmSubset] = valAll;
trigger.execute();
}
}
// Abort on external interrupt.
if (!pThread->m_Valid) {
retrieve.cancel();
while (true) {
if (retrieve.finished()) {
return 1;
}
}
}
}
}
Could you please give me some advice?
Thank you in advance.
K.N.
I understand the details.
From what you have said,
Is it correct to understand that “the LOG is incomplete,
but FlexView has completed normally, so there is no problem”?
Also, is there a way to increase the debug buffer?
Thanks for your support and
With kind regards
K.N.
I think the querying of the Triggered flags is redundant at this point, because you know that you have triggered both the stereo and the color camera with the Trigger command. The only interesting thing is whether the stereo camera ran into the Retrieve timeout, because the trigger has to be armed again as fast as possible, which is not done while the Retrieve command waits another e.g. 5s for the color image.
In my last code suggestion I intentionally separated the retrieval of the stereo images and the color images to show that the hardware trigger is primarily only affecting the stereo camera, which then in turn triggers the color camera after the FlexView sequence has been captured. So there is actually no need to check what the color camera does as long as you are waiting for a hardware trigger on the stereo camera and want to be able to abort it.
Yes, there is. You can find it in the tree under Debug/BacklogSize. The complete debug node contains useful information on how the logging of debug information is done by the NxLib. Please also refer to the Exporting Debug Information Guide.
, I think a RetrieveTimeout occurs at the blue diagonal line area. Is that correct?
Since there was a Capture Timeout Exception 5 seconds after the Retrieve run, I thought that “the stereo camera ran into the Retrieve timeout” was occurring.
I have an additional question.
To measure the time difference(or a value close to it)
between the start of exposure on the Stereo Camera and the Color Camera
from the LOG, what interval should I measure?
Thanks for your support and
With kind regards
K.N.
if you call Retrieve with two or more cameras and a Timeout of 5s, then the command waits 5s for each camera. So it is correct, that after 5s a timeout occurs for the stereo camera. However, the PiezoCaptureThread still gets triggered by your hardware signal while Retrieve waits the 5s for the color image. Which then is captured within the given timeout and retrieves successfully.
Could you please record the log file again with log level Trace. This way, you get more information with which you can probably determine the time between the stereo and color exposure.
I understand the above.
If the stereo camera times out and then receives a stereo image
while waiting for a color image for 5 seconds,
will the Retrieve command result in ”CaptureTimeOut Exception”?
Also, what will happen to the asBool() for each camera?
I apologize for not explaining the above in detail.
What I wanted to know was the timing difference between the stereo image and the color image when the trigger was turned on in the latest state where the retrieve was set to wait infinitely.
The following is the LOG when the latest Retrieve infinite wait setting software (logic proposed by Benjamin) is triggered ON. tmp_NxTreeEdit20250319-release.zip (26.9 MB)
Thanks for your support and
With kind regards
K.N.