Hi @Josh ,
Yeah, we've used the IR LED method in the past too, but I'd like to get away from it. You need to make sure it is in the frame (which is hard if you add more cameras) and it can change the illumination of the animal. Also, it takes some amount of time for the LED to turn on, which I've always worried might throw things off. (Though, I haven't verified that this is a problem.) We've got all the cameras hooked up to the computer, so we should be able to do it electronically! We might have to back to it if I can't find a good solution.
Regarding TTL triggering, that is a possibility. However, as far as I've been able to find in the camera documentation, I think I'd need to trigger every frame. Would there be an easy way to send out well timed TTLs from the bpod 30 times a second?
Based on this suggestion (https://teledynevisionsolutions.zendesk.com/hc/en-us/community/posts/29794044048269-How-to-align-Chameleon-3-TTLs-with-Matlab-recording), I was able to find a way to start image capture with the matlab call to start image acquisition by putting the camera into trigger mode using FlyCapture2. This method seems a bit janky. (I'm basically making the camera wait for a voltage trigger, then having matlab change its mode when image acquisition starts). Furthermore, when I tried it out, extra TTLs were arriving from the camera that weren't recorded in the video. (For instance, 6 extra TTLs over a 1500 frame video.) So, there is some slop in frames being acquired (and producing TTLs) and actually being recorded by matlab at the start, end or both of the video. Also, the frame rate can get messed up in ways I can't really explain (TTLs arriving at 90 Hz, but images acquired at 30 Hz, and only sometimes). So, though this looked promising a few hours ago, I don't think this method will work well.
I was able to make some progress using the FrameAcquiredFcn method. I found here (https://www.mathworks.com/help/imaq/retrieving-timing-information.html) about how to record the absolute time of the frame grabs in Matlab. Unfortunately, this has led to a new error, which I posted here (https://www.mathworks.com/matlabcentral/answers/2150864-sporadic-error-with-framesacquiredfcn-and-getdata). As I mention in that post, there's a janky work around for this problem, but I'm hoping someone has a good answer.
Assuming I can get that to work and I am able to obtain absolute time recordings for each frame, I can make this method work if I can get an absolute time for the bpod clock. Is there a way to find the absolute time for when the bpod clock starts running, or is there some other way to relate the event times recorded by the bpod to the absolute time?
As always, thanks for all your help!
Nick