Output trigger signal from camera to PLC using CVBpy

Hi Everyone
I am using a Teledyne Dalsa Genie Nano- M1920 (GigE, POE) to develop an inspection system that requires a trigger to be sent from the camera to a PLC, to stop a line, when the incorrect part is detected. I have been using successfully CVBPy for the image acquisition and some of the processing. What i need now is to know how to set up a stop trigger signal (e.g 5V) from the camera to a PLC or anything else, I have second I/O cable attached to the camera but do not know where to start, I am using CVBpy… Any help is very much appreciated.
Thank you

Hi,
I have not yet done that but you can enable a trigger mode through Common Vision Blox Management Console on your PC - “Device configuration” section. I am sure you can figure out what to set to fit your needs.


Than you can find the I/O connection diagram in the Genie Nano Manual (download from teledyne web page )and connect it to PLC.

I might be wrong because I have planned how to do it but not yet tested.
Good luck
Piotr

3 Likes

The following setting in the camera ought to get you the functionality you need :slight_smile:

You might run into trouble if you want to toggle this very fast though, but setting this node to do some outputs should be fine if you are not so concerned about real-time.

Output Line Software Command (Cust::outputLineSoftwareCmd)
Writing a value of 1 in the bit field applies the Latch value of the outputLineSoftwareLatchControl and/or executes the PulseOnSoftwareCmd for any output line programmed for software control. The feature outputLineSoftwareCmd can take any binary value and each bit set to 1 corresponds to a Icommand for an Output. Note that Outputs are numbered from 1 to N, therefore Bit 1 of outputLineSoftwareCmd corresponds to Output1. This is applicable to OutputLineSource = Pulse On: where Software Cmd (for Pulse mode) or OutputLineSource = SoftwareControlled and OutputLineSoftwareLatchControl = Latch (for static states).

Full Name: Cust::outputLineSoftwareCmd
Type: Integer
Access Mode: Read/Write
Visibility: Expert
Caching Mode: Write Through
Streamable: False
2 Likes

Thank you very much for the replies so far. So I can set a trigger signal using the CVB management console. I have set it to accept a “Pulse on: Software Command” and using “output Line Software Command =1” genereates the voltage pulse, the pulse duration can be preset. So far so good, I have measured the output signal with a multimeter. My question is, how can the command be set/send using CVBpy since all my development is in python?

I have tried :
vin_device= cvb.DeviceFactory.open(cvb_driver_path)
vin_device.software_trigger.send_trigger(1)

get a RuntimeError: failed to send software trigger

Again any help is appreciated, thanks

The camera doesn’t look like its using the standard features for software triggering.

You first need to get the node map from the device as shown here:

Also the feature nodes are mapped by their actual name and are not made pythonic. Try something like:

device_node_map = vin_device.node_maps['Device']
sw_trigger = device_node_map.outputLineSoftwareCmd
sw_trigger.execute()

Hi thanks, I’ve tried that and get:

AttributeError: ‘cvb.IntegerNode’ object has no attribute ‘execute’

Also it seems that the CVB management console resets the line to line 1 (the PoE camera) instead of line 3 (a different cable leaving the camera) that I set for trigger output.

Thank you for your time,
GTG

Really interesting node naming…

Ok, then do:

sw_trigger.value = 1

and maybe after a delay

sw_trigger.value = 0

The Management Console doesn’t change anything about these kind of nodes automatically. It just displays updates automatically issued by the camera XML/GenApi.

1 Like

That did the trick. Thank you very much!

Other notes:
In regard to the pulse duration, I could only set it in the CVB management console (in expert/guru mode).
When i tried:
sw_trigger_duration = device_nodes.outputLinePulseDuration
sw_trigger_duration.value = 1000000 # 1 second

I get a “RuntimeError: Node[Cust::outputLinePulseDuration]: Node is not writable.”

Also, if you want to check the status change you can do a:
print(device_nodes.LineStatusAll)
before and after setting the trigger value with sw_trigger.value = 1

Again thank you for your help,

GTG

For reference (to software trigger an output voltage from the camera):
CVB v13.01.003, using a JAI GO 5000 PGE camera

device_node_map = vin_device.node_maps[‘Device’]
sw_trigger = device_node_map.UserOutputValue
sw_trigger.value = True
sw_trigger.value = False