Hey there!
Our team have some cameras that we want to control with TTLs from artiq during an experiment run. We have a python function that we can call as an rpc that will set the cameras up and tell them to wait for a trigger, and save the captured image to a local directory when triggered, but the script gets stuck there waiting for the trigger, and the downstream parts of the code where we are telling artiq to send the TTLs never gets executed.
The code works, however, if I run the setup/wait-for-trigger function in one terminal, and then run the sequence on artiq with a different terminal.
Is there a better way to have the RPC function that has the cameras wait for the trigger run in the background on the host machine while artiq is doing other things, including sending the trigger pulses, preferably without requiring me to open an extra terminal for each camera by hand for each shot of the experiment.
Here's a minimal sample where I try to do this
`from artiq.experiment import *
import alvium
class TTL_Output(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("ttl49")
def prepare(self):
alvium.setup('DEV_1AB22C051761',5000,0) # code gets stuck here
@kernel
def run(self): # and none of this ends up getting run.
self.core.reset()
self.ttl49.output()
delay(1*us)
self.ttl49.pulse(1*s)`
where "alvium.setup()" is the function that tells the camera to wait for the trigger.
Thanks!