EasyManua.ls Logo

SICK Ranger E

SICK Ranger E
124 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Reference Manual Chapter 8
Ranger E/D
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved 95
iCon API
// Loop through the scans
unsigned char *myProfile;
for (int i = 0; i < numberOfProfiles; i++)
{
// Get a pointer to the scan
myProfile = myBuffer->getReadPointer(i);
// Move the pointer to the first value of the range profile
// from the Hi3D component
unsigned char *myRangeProfile = myProfile + rangeOffset;
//Loop through the values
double myValue;
for (int j = 0; j < numberOfValues; j++)
{
if (byteValues) myValue = *(myRangeProfile + j);
else myValue = *((WORD *)(myRangeProfile) + j);
// Process the measurement value
myProcessValue(myValue);
}
};
8.2.3 Polling and Call-back
Your application can retrieve the buffers with the measurement data in two different ways:
By polling, using the getNextIconBuffer() method.
By using a call-back routine, which is specified when setting up the frame grabber
object.
Before polling for measurement data, your application can use the FrameGrabber object’s
availableBuffers()to see whether there is any data to retrieve. If the property has a
non-zero value, there is at least one buffer of data to retrieve.
If you poll for data when there are no buffers available for retrieving, the method will time
out after a period of time that is specified by the timeout. If timeout is 0 the method
will return immediately when there is no buffer available. If timeout is -1, the method
will never time out – that is, the thread will be halted until there is data in the buffer.
If you are using a call-back routine, the frame grabber will call this routine as soon as there
is a full buffer available. The frame grabber will however not call the routine again before it
has returned.
8.2.4 Handling Buffers
The frame grabber will create the IconBuffer objects and allocate memory for them. When
you are done with the IconBuffer, you can either let the frame grabber release the object
(AUTO_RELEASE), or have your application releasing and destroying the object
(MANUAL_RELEASE). You specify which method to use when initializing the frame grab-
ber, by using the FrameGrabberParameter object’s setRelease() method.
When using AUTO_RELEASE, there will be only one IconBuffer in use at a time. The buffer
will be released when you call getNextIconBuffer(), or when your call-back routine
returns.
If you do not retrieve measurement data quickly enough, or if your call-back routine does
not return quickly enough, the internal queue of buffers will eventually become full, and
the frame grabber will run out of memory for creating buffers. You can detect such over-
flows by using the getOverflowStatus of the FrameGrabberStatus object returned by the
callback or getNextIconBuffer. This object is only available if you use the version of getNex-
tIconBuffer which supports FrameGrabberStatus objects or the callback type named
CallbackWithStatusType
If this should happen, it means that scans have been lost as the queue was full, and it is
recommended to stop the camera and restart it.

Table of Contents

Related product manuals