Chapter 8 Reference Manual
Ranger E/D
90 ©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
iCon API
<ProgramFiles>\SICK\3D Cameras\icon\lib
When using the iCon C API, make sure that the program is linked with the icon_c.lib or
icon_c_x64.lib library.
This chapter describes the iCon C++ API, and the examples are written in C++. However,
the iCon C API contains the same functions having the same names.
More detailed information on the iCon APIs is found in the online help for the APIs, which
can be opened from the Start menu. You can also explore some example programs and
their source code, which are installed with the development software.
8.1 Connecting to an Ethernet Camera
To set up your application, do the following:
Create a Camera object, using the EthernetCamera sub-class.
Create a FrameGrabber object, using the FGEthernetFast sub-class.
Set the communication parameters for the camera with the setComParameters()
method:
- The IP address of the camera,
- The port used by the frame grabber. This port number can be retrieved from the
FrameGrabber object.
- The redundancy data port used by the framegrabber. This port number can be re-
trieved from the FrameGrabber object.
Call the camera object’s init() method. The camera will then enter the Stopped
state, which means that it is connected but not measuring.
Configure the camera with the fileLoadParameters() method, and passing the
path to the parameter file to use. The parameter file contains the configuration that the
camera should use. Parameter files are created with Ranger Studio.
Set frame grabber parameters – such as the IP address and the port used by the
camera for sending data – using the FrameGrabberParameter object retrieved
from the frame grabber. Note that the class of the retrieved FrameGrabberParame-
ter object depends on the type of camera used.
When setting up the frame grabber, you should also retrieve the data format and net-
work packet size from the camera and pass that to the frame grabber using the set-
DataFormat() method. The data format is further described in the next section.
Call setBufferHeight() in the camera with the same height that is to be used in
the framegrabber (FrameGrabberParameters::setNoScans()).
Connect to the frame grabber with the connect() method.
// Call camera factory to create a EthernetCamera camera
EthernetCamera* myCamera =
static_cast<EthernetCamera*>(createCamera("EthernetCamera", "MyCamera"));
// Create a framegrabber object.
FrameGrabber *myFramegrabber = createFrameGrabber("FGEthernetFast",
"MyGrabber");
// Set basic camera parameters.
// The port number and redundancy port number used by the frame grabber
// can be retrieved from the
// framegrabber object, (or rather the FrameGrabberParameters which can
// be retrieved from the framegrabber object.)
FGEthernetFastParameters* myFGParameters =
dynamic_cast<FGEthernetFastParameters*>(myFramegrabber->getParameters());
int framegrabberPort = myFGParameters->getFrameGrabberPort();
int redundancyPort = myFGParameters->getRedundancyPort();
string cameraIP = "192.168.0.12";
myCamera->setComParameters(cameraIp, framegrabberPort, redundancyPort,
EthernetCamera::HIGH_PERFORMANCE_DATA_CHANNEL);
// Initialize the camera.
myCamera->init();