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:

https://forum.commonvisionblox.com/t/cvb-py-set-node/294/2?u=parsd

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
1 Like

Could you maybe elaborate on how to execute the trigger?

img_stream.start()
sw_trigger.value = True
software_trigger.execute()
img, status = img_stream.wait()

(or other combinations of wait() and setting the value)

does not work for me …

Hi
I use a function e.g:

     def plc_stop_trigger(self):
            device_node_map = self.vin_device.node_maps["Device"]
            self.sw_trigger = device_node_map.outputLineSoftwareCmd
            self.sw_trigger.value = 1

and call it when need to send the signal.

But probably the problem you have comes from not setting in the CVB management application the correct IO, i.e output1 or output2 and set it to be controlled by software command. Your camera manual can guide you on this.
If you find a different working implementation, don’t forget to leave it here for the benefit of all.

2 Likes

Thank you!
your remark brought be onto the right track.
the nodes were set correctly but
dev_node_map.save_settings(save_file)
for some reason overwrites the IO and some other nodes.

2 Likes