I had a project to get data from an IFM O3D302 3D Sensor into Ignition, and I figured I would share my solution so others can use it or provide feedback on how I might improve it.
I needed the camera to do two things: measure the height, width, and depth of a part, and compare the distance between two ROIs.
Getting the data into Ignition was the easy part. I simply set up a TCP Device with a Character-Based Delimiter, which allowed me to read the output string. The output string can be built in the IFM Vision Software. Mine includes the application number, a keyword, and the measurement values. I used a tag change script to take the current value of the tag and write out the values to their own tags.
Raw data tag example:
star;APP_NUM:2;TOP;0.000;0.924;0.819;stop
The hard part (for me, anyway) was triggering the camera and changing programs in it using Ignition. Luckily, IFM provides a Python package to interact with the camera. I just grabbed the part of the code I needed to send the trigger message, which was just the pcic client library that I added to my Project Library. I Then wrote a simple script to trigger both programs.
Example Script for switch application and triggering the sensor.
def trigger():
print('Processing')
system.tag.writeBlocking('[Testing]o3d3xx/Status', 'PROCESSING')
pcic = o3d3xx.client.PCICV3Client("192.168.0.209", 50010)
app1 = pcic.sendCommand("a01") #Send Command to switch to Application 1
answer1 = pcic.sendCommand("T?") #Send Trigger Command
print(answer1) #Print answer
app2 = pcic.sendCommand("a02") #Send Command to switch to Application 2
answer2 = pcic.sendCommand("T?") #Send Trigger Command
print(answer2)
pcic.close()
system.tag.writeBlocking('[Testing]o3d3xx/Status', 'READY')
print('Completed')
IFM Device Ignition setup