Self timer on Jetson TX2

Hi!

I had a quick question. I just finished following the steps for the TX2 interface download found on

But I was wondering is there a way to get just one of the Leopard Cameras to take images on a self timer and then store them in a file? It does not have to classify the objects yet.

Please let me know because I can not find much on the subject.

what is self timer?
do you mean something like cron?

No, I dont know if Cron is what I am looking for.

I am just trying to figure out a way to set some sort of automatic timer where the Leopard camera can capture and store an image every 5-10 seconds.

Thank you!

Native Unix way to schedule recurring events is cron, in my opinion. However, it rather uses minutes as minimum interval.
You may use for reference threads : cron - How to run scripts every 5 seconds? - Ask Ubuntu
ubuntu - Running a cron every 30 seconds - Stack Overflow
and create a task.
For for capturing image to a file you may use as reference threads:
[url]USB camera image capture - Jetson TX1 - NVIDIA Developer Forums
TX1 nvgstcapture-1.0 capture single image - Jetson TX1 - NVIDIA Developer Forums
Once you schedule the image capturing with “sleep 5” or whatever scheduler you will reach the objectives, in my opinion.

Hey Audrey!

Thank you for helping me out. Cron ended up working but I ran into a small problem with the JPEG images being captured by the TX2 overriding each other because the names were the same. Could you recommend a way to change the name of each of the images (whether as a time stamp or something)?

Thank you,

You may use as reference the example by DaneLLL from

gst-launch-1.0 v4l2src device="dev/video0" num-buffers=60 ! "video/x-raw, width=1920, height=1080, format=I420" ! nvjpegenc ! multifilesink location=snapshot-%05d.jpg

And extend the value %05d to nanoseconds somehow in a filename like :

touch $(date +%s%N).txt

if you then copy the line above to script.sh like

#!/bin/sh
touch $(date +%s%N).txt

add a loop running from terminal like

while true; do ./script.sh &sleep 5; done

you will see that the filenames are generated unique like:

-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:47 1520218043884188874.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:48 1520218114600677847.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:48 1520218128302991900.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:49 1520218179574164384.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:49 1520218184579681196.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:49 1520218189587543130.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:49 1520218194598047785.txt
-rw-rw-r-- 1 ubuntu ubuntu    0 Mar  5 02:49 1520218199602848913.txt

In the example above I used timestamp based on “Nanoseconds since UNIX epoch”, you may like to use

date +%Y%m%d%H%M%S%N

that will generate something like

20180305025741939669747

Reference:
https://stackoverflow.com/questions/16548528/linux-command-to-get-time-in-milliseconds
https://zxq9.com/archives/795
https://stackoverflow.com/questions/8228047/adding-timestamp-to-a-filename-with-mv-in-bash