Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digitial input on FLIR cameras with AcquisitionTool #13

Open
timsainb opened this issue Sep 23, 2022 · 4 comments
Open

Digitial input on FLIR cameras with AcquisitionTool #13

timsainb opened this issue Sep 23, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@timsainb
Copy link

timsainb commented Sep 23, 2022

Is there any functionality built in to AcquisitionTool to read/save signals from the digital input on FLIR cameras? e.g. for syncing data with other acquisition devices? If so, where is that information saved?

DIO documentation for FLIR cameras here. and here

@timsainb
Copy link
Author

I think this would involve checking LineStatus in recordFrame and saving that info to metadata.csv?

@JARVIS-MoCap JARVIS-MoCap added the enhancement New feature or request label Sep 24, 2022
@JARVIS-MoCap
Copy link
Owner

Currently there is no way to read the GPIO Pins of the FLIR cameras. From having a brief look at it it seems like that might be feature that is pretty quick to add, so I will definitely consider adding it.

We are currently working on adding support for reading the GPIO pins of the trigger microcontroller and logging that to a file though, this should also make it possible to sync the cameras with external devices. As with many features this is not very well documented at the moment I'm afraid, so you might have to dig into the TriggerFirmware a little bit to make it work for your usecase. I'm gonna refer you to @padok again, since he's the one who implemented all this.

Hope this helps,
Timo

@padok padok self-assigned this Sep 25, 2022
@padok
Copy link
Collaborator

padok commented Sep 25, 2022

[1/2] Current method of synchronization

If you use our external trigger, a similar functionality is already supported.
Most of the supported microcontroller boards log the inputs at pins 16-23 in a triggerdata.csv file.

For synchronization, the microcontroller board logs the first inputs at the time the first pulse was sent. This way you can synchronize the first images of the cameras and their internal clock to the internal clock of the external trigger.

                           ┌─────┐     ┌─────┐     ┌─       ─┐
         ...               │     │     │     │     │   ...   │ ...
              ─────────────┘     └─────┘     └─────┘         └───────────
wavestate           0      │  1  │  0  │  1  │  0  │ 1     n │     0
pulse_count     UINT32_MAX │  0  │  0  │  1  │  1  │ 2     n │ UINT32_MAX
pulse_count (cont.) n      │ n+1 │ n+1 │ n+2 │ n+2 │n+3   n+m│    n+m
sync_rising_edge == true   ┴     │
sync_rising_edge == false        ┴

The file contents will look similar to this:

metadata.csv

frame_camera_serial ;frame_camera_name ;frame_id ;frame_timestamp ;frame_image_uid
           19415034 ;Camera_4          ;       0 ;597449368203896 ; 94017979513872
           19415037 ;Camera_3          ;       0 ;163273368203367 ; 94017967892976
           19415033 ;Camera_1          ;       0 ;272583328921019 ; 94017972152896
           21013374 ;Camera_0          ;       0 ;770316960921060 ; 94017962792256
           19415035 ;Camera_2          ;       0 ;855758496921019 ; 94017968796096
           19415037 ;Camera_3          ;       1 ;163273382493569 ; 94017975321952
           19415033 ;Camera_1          ;       1 ;272583343210976 ; 94017978831696
           19415035 ;Camera_2          ;       1 ;855758511211505 ; 94017973880432
           21013374 ;Camera_0          ;       1 ;770316975211505 ; 94017966449648
           19415034 ;Camera_4          ;       1 ;597449382494016 ; 94017981830272
           19415037 ;Camera_3          ;       2 ;163273396783772 ; 94017979597136
           21013374 ;Camera_0          ;       2 ;770316989501708 ; 94017966467888
           19415033 ;Camera_1          ;       2 ;272583357501546 ; 94017995748160
           19415035 ;Camera_2          ;       2 ;855758525501505 ; 94017978237504
           19415034 ;Camera_4          ;       2 ;597449396784219 ; 94017990808464
...

triggerdata.csv

flag_0 ;flag_1 ;flag_2 ;flag_3 ;flag_4 ;flag_5 ;flag_6 ;flag_7 ;pulse_id ;uptime_us
true   ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;       0 ;2508068633
false  ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;   57822 ;3086494592
true   ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  155876 ;4067383774
false  ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  155876 ;4067383785
true   ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  156850 ;4077121115
false  ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  163316 ;4141801073
true   ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  163316 ;4141801084
false  ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  167740 ;4186060281
true   ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  171554 ;4224218818
false  ;true   ;true   ;true   ;true   ;true   ;true   ;true   ;  172716 ;4235837376
...

If your setup is working correctly, pulse_id and frame_id should also align within their time intervals.

Please note that if you rely on the external trigger or the in-camera clocks, you will need to correct them for longer recordings as they will drift away from each other since they are not real-time clocks. Also, unfortunately, the trigger uptime is currently only a 32-bit unsigned integer, which means it overflows every 71 minutes and 35 seconds.

[2/2] Requested method of synchronization

Yes, I would absolutely like to add camera input recording. But unfortunately I don't know yet how the Spinnaker SDK exposes this information to us. I need to take a closer look at this first. I have a feeling LineStatusAll might lead somewhere, but it doesn't look quite right yet.

@timsainb
Copy link
Author

Thanks! The DIO on the external trigger met my needs, but I'll leave this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants