0

I am working on a script which grabs frames from a c-arm camera using a PCIe-1433 frame grabber. The frames must be grabbed when a pedal is pressed down; pressing and holding the pedal results in a repeated rising voltage edge at a consistent rate until the pedal is no longer pressed. In other words, the frame grabber must be synchronized with the camera capture. I also have a working LabView block diagram which provides me the correct trigger parameters, so I know my configure_trigger_in method is set up correctly.

The issue that I keep coming up against is that the read_trigger method is not asserting when I press down the external trigger pedal. I want to make 100% sure that I am correctly setting up my trigger line code, so I can turn my attention to the hardware itself if necessary.

Here is a script which first opens the frame grabber connected to the camera, then configures the input trigger, then continuously reads the trigger line for a rising edge. When there is a rising edge, it prints "asserted". I have also set up a timer which cancels the while loop after 30 seconds.

from pylablib.devices import IMAQ
import time

# identify frame grabber
cam = IMAQ.IMAQCamera('FPD::0')

# configure trigger in with corretc parameters
cam.configure_trigger_in('ext', trig_line=0, trig_pol='high', trig_action='buffer', timeout=1000.0)

# set 30 sec timer for while loop
timeout = time.time() + 30

# while loop continuously reads trigger line
while True:
    
    # checks trigger line value: 
        # if 0, then unasserted -> continue
        # if not 0, then asserted -> print "asserted" then continue
    while cam.read_trigger('ext', trig_line=0, trig_pol='high') == 0:
        
        # checks timer
        if time.time() > timeout:
            print('timeout')
            break
    
    else:
        print('asserted')
        
        # checks timer
        if time.time() > timeout:
            print('timeout')
            break
        
        continue
    
    break

cam.close()

A successful read_trigger line would print multiple "asserted" whenever the external trigger pedal is pressed. However, I get no "asserted" for the entire 30 sec timer when I am pressing the pedal.

Is there something wrong with my script's trigger setup?

0 Answers0