1
0
Fork 0

Automatic launch of capture process on the different capture devices

pull/5/head
fmederos 2017-08-25 11:33:10 -03:00
parent 941b426891
commit 580638ffdc
3 changed files with 16 additions and 11 deletions

View File

@ -34,8 +34,8 @@ Run notes
`ST_DATADIR` path to sattools directory
`ST_TLEDIR` path to TLE directory
`ST_OBSDIR` path to observations directory
* You will need to add a /etc/udev/rules.d/99-server.rules file to add symlinks and use them to
address a particular camera.
* If you have multiple capture devices you will need to add a /etc/udev/rules.d/99-server.rules file to add symlinks and use them to
address a particular camera. Sattools will automatically select the camera that is scheduled for each observation.
You may use a command such as 'udevadm info -a -n /dev/video0' to get your capture device attributes and
use that to create the rules file.
A sample rules file is available as guide in data/

View File

@ -3,14 +3,15 @@
# Settings
PGMDIR=/dev/shm
N=250
# If no images are found during thisperiod, relaunch capture process
# If no images are found during this period (seconds), relaunch capture process
WAIT=20
COUNT=0
# Start automatically capture process or not
AUTOSTART=0
# Default camera to start imaging if no schedule is available
CAMERA="S25H"
CAMERADEV="/dev/video0"
CAPTUREPID=0
# if autostart force a restart
if [ $AUTOSTART == 1 ]; then
@ -21,7 +22,7 @@ else
STATE="stop"
fi
export CAMERA=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((1))}'`
export CAMERADEV=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((7))}'`
# For ever loop
while true; do
@ -43,7 +44,7 @@ while true; do
cp $ST_OBSDIR/control/position.txt .
# cp $ST_OBSDIR/control/scale.txt .
cp $ST_OBSDIR/control/camera.txt .
export CAMERA=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((1))}'`
export CAMERADEV=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((7))}'`
fi
# Process only if not stopped
@ -61,8 +62,10 @@ while true; do
viewer `ls -1 2*.fits | tail -n1`
cp avg.pgm $ST_OBSDIR
else
kill -9 $CAPTUREPID
CAPTUREPID=0
if [ $(($CAPTUREPID)) != 0 ]; then
kill -9 $CAPTUREPID
CAPTUREPID=0
fi
fi
# Remove files
@ -81,13 +84,15 @@ while true; do
if [ $COUNT -ge $WAIT ]; then
COUNT=0
echo "No images found, restarting capture script"
sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA &
# sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA &
sh $ST_DATADIR/scripts/st_capture.sh $CAMERADEV &
sleep 1
CAPTUREPID=`pgrep -o -x ffmpeg`
fi
if [ $STATE == "restart" ]; then
if [ $(($CAPTUREPID)) == 0 ]; then
sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA &
# sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA &
sh $ST_DATADIR/scripts/st_capture.sh $CAMERADEV &
sleep 1
CAPTUREPID=`pgrep -o -x ffmpeg`
fi

View File

@ -128,7 +128,7 @@ void usage()
printf("R R.A.\n");
printf("D Decl.\n");
printf("A Azimuth\n");
printf("E Elecation\n");
printf("E Elevation\n");
printf("S All night\n");
printf("h this help\n");
printf("s site (COSPAR)\n");