diff --git a/Auxiliary_utils/bash_scripts/park_tel.sh b/Auxiliary_utils/bash_scripts/park_tel.sh new file mode 100755 index 0000000..33488dd --- /dev/null +++ b/Auxiliary_utils/bash_scripts/park_tel.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +export http_proxy="" + +A="-5:00:00" +H="2:00:00" + +function sendcmd(){ + echo $1 | nc localhost 10001 -q10 +} + +#lower limit is 0 +sendcmd ":So0#" +sendcmd ":Sz${A}#" +sendcmd ":Sa${H}#" +sendcmd ":MA#" + +#while true; do +# ANS=$(sendcmd ":Gstat#") +# echo $ANS +# [ $ANS == "0#" ] && break +# sleep 2 +#done + diff --git a/Auxiliary_utils/bash_scripts/point_AH.sh b/Auxiliary_utils/bash_scripts/point_AH.sh new file mode 100755 index 0000000..2875f39 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/point_AH.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +A="$1" # azimuth in sexagesimal notation, e.g. 10:00:00 +H="$2" # altitude, same format as form azimuth + +function sendcmd(){ + echo $1 | nc localhost 10001 -q10 +} + +sendcmd ":Sz${A}#" +sendcmd ":Sa${H}#" +# not slew +sendcmd ":MA#" +# slew +# sendcmd ":MS#" +while true; do + ANS=$(sendcmd ":Gstat#") + echo $ANS + [ $ANS == "7#" ] && break + sleep 2 +done diff --git a/Auxiliary_utils/bash_scripts/point_get_flat.sh b/Auxiliary_utils/bash_scripts/point_get_flat.sh new file mode 100755 index 0000000..7550c74 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/point_get_flat.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +#A="00:00:00" +#H="85:00:00" + +A="$1" # azimuth in sexagesimal notation, e.g. 10:00:00 +H="$2" # altitude, same format as form azimuth + +filename="$3" # basename for result file (see fli_control -h) +exptime="$4" # exposure time in milliseconds + +function sendcmd(){ + echo $1 | nc localhost 10001 -q10 +} + +preflash > /dev/null & + +#for x in $(seq 1 10); do +sendcmd ":Sz${A}#" +sendcmd ":Sa${H}#" +sendcmd ":MS#" +while true; do + ANS=$(sendcmd ":Gstat#") + echo $ANS + [ $ANS == "0#" ] && break + sleep 2 +done +#sendcmd ":FLIP#" + +sleep 1s +echo "Waiting for preflash finishing ..." +wait + +#sleep 5 +#./preflash +#/usr/bin/fli_control -r /tmp/10micron.fitsheader -x $2 -O sunsky -Y flat $1 +/usr/bin/fli_control -r /tmp/10micron.fitsheader -x ${exptime} -O sunsky -Y flat ${filename} +#done + +# to prevent "bad" image after the exposition? +fli_control -v32 -h32 -x1 -d diff --git a/Auxiliary_utils/bash_scripts/run b/Auxiliary_utils/bash_scripts/run index 08328a2..cff87c1 100755 --- a/Auxiliary_utils/bash_scripts/run +++ b/Auxiliary_utils/bash_scripts/run @@ -4,7 +4,19 @@ DEC="50:25:21" OBJ="EGGR381" OBS="Emelianov E.V." -last=$(date -d "Oct 23 05:30" +%s) +function sendcmd(){ + echo $1 | nc localhost 10001 -q10 +} + +function point_tel(){ + touch lastpointing + send_coords -r $1 -d $2 +} + +# set lower limit to 0 +send_command2mount ":So0#" + +last=$(date -d "Nov 30 05:45" +%s) echo "Time diff: $(($last-$(date +%s)))" if [ $(($last-$(date +%s))) -lt 3600 ]; then echo "There's less an hour for observation!" @@ -16,18 +28,30 @@ echo "GoTo object: ${RA} ${DEC}" send_coords -r${RA} -d${DEC} echo "Start taking object" -badweatger=0 +badweather=0 while true; do now=$(date +%s) + ANS=$(curl localhost:55555/status 2>/dev/null) + echo "Dome status: $ANS" + if [ $ANS != "opened" ]; then + echo "Closed" + curl localhost:55555/weather 2>/dev/null > DomeClosed + break; + fi chkweather -r -d /dev/ttyS3 > lastweather && badweather=0 || badweather=$((badweather+1)) - #echo "badweather: $badweather" [ $badweather -gt 5 ] && break - #continue if [ "$now" -lt "$last" ]; then + est=$(sendcmd ":Gmte#"|sed -e 's/^0*//' -e 's/#//') + echo -e "\n\n\n\n\nEstimated time to flip: $est minutes" + if [[ ("x$est" == "x") || ($est -lt 3) ]]; then + point_tel "${RA}" "${DEC}" + continue + fi ST=$(send_coords | awk '{print $4}') + [ "x$ST" == "x" ] && break if [ $ST -ne "0" ]; then - touch lastpointing - send_coords -r${RA} -d${DEC} + point_tel "${RA}" "${DEC}" + continue else preflash /usr/bin/fli_control -r /tmp/10micron.fitsheader -x 60000 -N "${OBS}" -O "${OBJ}" "$OBJ" @@ -36,11 +60,12 @@ while true; do break fi done -#exit 0 -echo "closed" > closed + curl localhost:4444/close curl localhost:55555/close +echo "closed" > closed +../../park_tel.sh for x in $(seq 1 10); do preflash