Cognex In-Sight Vision Systems
Information Sheet
Compatible Devices
Cognex In-Sight Vision Systems with spreadsheet support.
Verified Device
Cognex In-Sight 1400.
Overview
This note describes 2 drivers, a Camera Data Driver and a Camera Image driver, for use with Cognex In-Sight systems. The camera can support up to a maximum of three connections simultaneously, using any combination of data and image drivers.
Device Configuration
The Camera Image Driver
The image driver should be configured with the IP address of the camera and the TCP port number for the Telnet port of the camera. A username and password must be supplied in order to connect to the camera. If a user has no password, then the password field should be left blank.
Note that the user used to log onto the camera should have an access level of either "Protected" or "Full". Users with an access level of "Locked" will not be able to view the image.
The Camera Data Driver
The data driver should be configured with the IP address of the camera and the TCP port number for the Telnet port of the camera. A username and password must also be provided to connect to the camera. If a user has no password, then the password field should be left blank.
A user with "Locked" access will be able to view live data, but will not be able to view or change the online status of the camera or change, save, or delete jobs on the camera. A user with "Protected" access is able to view and change live data, change the online status of the camera and change jobs, but will be unable to save or delete jobs. Users with "Full" access will be able to perform all actions provided by the data driver.
Accessing the Image
In order to view the live image from the camera, a camera primitive should be added to a display page and associated with the configured camera device from the camera primitive’s properties. Note that the camera primitive must be at least as large as the image to be displayed. If the image is larger than the camera primitive, then the image will not be displayed and an ‘X’ will be rendered on the primitive.
Accessing Data
Various types of data can be retrieved from the camera through tags using the Cognex In-Sight Data driver.
Reading and Writing Data via Tags
Numeric data can be retrieved by mapping a numeric tag to a "Spreadsheet Cell" value. Using the drop down box in the address selection dialog, the tag can be set to Word for integral types and Real for floating-point types. The corresponding cell in the camera’s spreadsheet should contain a numeric value in order to retrieve data from the cell.
To write to a numeric tag, the corresponding cell in the camera’s spreadsheet must have either an EditInt or EditFloat control in it. In the event that the new value is outside the range set by EditInt or EditFloat, the value will be unchanged. Consult the Cognex In-Sight Explorer documentation for more information regarding the spreadsheet as well as the EditInt and EditFloat controls.
String data can be retrieved by mapping a string tag to a "User String". The string tag must have its packing set to ASCII Big-Endian and the extent should be set to one item. There are a total of ten User Strings are available for use. Note that arrays of strings are not supported at this time.
In order to write to a string value, the corresponding cell in the camera’s spreadsheet should contain an EditString control. Consult the Cognex In-Sight Explorer documentation for more information regarding the spreadsheet and the EditString control.
Get File
Get File returns the name of the job that is currently loaded on the camera. If the camera is online, then it is effectively the name of the job currently running on the camera. Get File should be mapped to a string tag, with the packing set to ASCII Big-Endian, the access set to read only, and the extent set to one item.
Online Status
Online Status gives the current status of the camera. It will have a value of 1 if the camera is online and 0 if the camera is offline. Writing a 1 to this tag will cause the camera to go online if it is offline, and writing a 0 will cause the camera to go offline if the camera is currently online. Online Status should be mapped to a numeric tag with read and write access. Note that camera users with "Locked" access will be unable to read or write to Online Status.
Set Event
Set Event is used to trigger an event in the camera. It should be mapped to a numeric tag with read and write access. When the Set Event tag is written to, it will trigger the corresponding event in the camera. Writing a value of 1-7 will trigger the corresponding soft event in the camera. Writing a value of 8 will cause the camera to acquire a new image.
Managing Image Processing Jobs
Managing Camera Jobs using DevCtrl
DevCtrl is a function used to send device-specific commands. The Cognex data driver uses calls to DevCtrl to change, delete, or save image processing jobs on the Cognex camera.
Value = DevCtrl(Device Number, Function Number, string Job)
The number to be placed in the Device Number argument to identify the device can be viewed in the status bar when the device name is highlighted. In the examples given below, 1 will be used as the device number. More information about the DevCtrl function can be found in the documentation.
The return value from DevCtrl is used to indicate if the command succeeded or failed. The following return values are common for all supported commands:
1: The command executed successfully.
0: Unrecognized command.
-1: The filename is missing.
-6: User does not have Full Access to execute the command.
Note that the string identifying the Job may either be a hardcoded string literal or a string tag. The camera must be offline in order to execute these commands.
Function Number 1 -- Loading a Job
Value = DevCtrl(1, 1, "MyJobToLoad.job")
Command Specific Return Values:
-2: The job failed to load, the sensor is Online, or the file was not found.
-4: The job to be loaded was not found, or the sensor is out of memory.
Function Number 2 -- Saving a Job
Value = DevCtrl(1, 2, "MyJobToSave.job")
Command Specific Return Values:
-2: The job failed to save, the sensor is Online or the file was not found.
Function Number 3 -- Deleting a Job
Value = DevCtrl(1, 3, "MyJobToDelete.job")
Command Specific Return Values:
-2: The file could not be deleted, the sensor is Online, a file does not exist with the given name, or the job data is invalid.
Cable Information
Ethernet cable as supplied with device.
Revision History
9/18/2012 – Created