add some scripts

This commit is contained in:
Edward Emelianov 2022-07-19 19:59:28 +03:00
parent 73bdcfb119
commit 3a649661b8
26 changed files with 482 additions and 43 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
A="90:00:00"
H="45:00:00"
function sendcmd(){
echo $1 | nc 192.168.70.33 10001 -q10
}
sendcmd ":Sz${A}#"
sendcmd ":Sa${H}#"
sendcmd ":MS#"
while true; do
ANS=$(sendcmd ":Gstat#")
echo $ANS
[ $ANS == "0#" ] && break
sleep 2
done

View File

@ -0,0 +1,9 @@
#!/bin/bash
TTY=/dev/ttyS1
stty -F $TTY -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo -n "RA: "
echo ":GR#" > /dev/ttyS1 && cat /dev/ttyS1
echo -n "Dec: "
echo ":GD#" > /dev/ttyS1 && cat /dev/ttyS1

View File

@ -0,0 +1,14 @@
#!/bin/bash
TTY=/dev/ttyS1
if [ $# -ne 2 ]; then
echo "USAGE: $0 hh:mm:ss.s +dd:mm:ss.s"
exit 1
fi
stty -F $TTY -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo ":Sr${1}#" > /dev/ttyS1 && cat /dev/ttyS1
echo ":Sd${2}#" > /dev/ttyS1 && cat /dev/ttyS1
echo ":MS#" > /dev/ttyS1 && cat /dev/ttyS1

View File

@ -0,0 +1,9 @@
#!/bin/bash
# start observation: open everything, turn on power etc
export http_proxy=""
echo "Turn OFF mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff
sleep 30
echo "Turn OFF hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweroff

View File

@ -0,0 +1,9 @@
#!/bin/bash
# start observation: open everything, turn on power etc
export http_proxy=""
echo "Turn ON hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweron
sleep 5
echo "Turn ON mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff

View File

@ -0,0 +1,31 @@
#!/bin/bash
# start observation: open everything, turn on power etc
export http_proxy=""
echo "Turn ON hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweron
echo "Open dome"
curl localhost:55555/open
echo "Turn ON mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff
echo "Wait for 5 seconds"
sleep 5
echo "set camera temperature to -40degrC"
fli_control -t-40
echo "run preflash"
preflash
while true; do
ANS=$(curl localhost:55555/status 2>/dev/null)
echo "Status: $ANS"
[ $ANS = "opened" ] && break
sleep 1
done
echo "Open telescope doors"
curl localhost:4444/open
while true; do
ANS=$(curl localhost:4444/status 2>/dev/null)
echo "Status: $ANS"
[ $ANS = "opened" ] && break
sleep 1
done
echo "Please, wait until telescope mount will be ON! (check it by send_coords)"

View File

@ -0,0 +1,26 @@
#!/bin/bash
# stop observation: close everything, turn of power etc
export http_proxy=""
echo "Turn OFF mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff
echo "Turn off camera TEC"
fli_control -t25
echo "Close telescope doors"
curl localhost:4444/close
echo "Close dome"
curl localhost:55555/close
while true; do
ANS=$(curl localhost:55555/status 2>/dev/null)
echo "Status: $ANS"
[ $ANS = "closed" ] && break
sleep 1
done
echo "Dome closed!"
while true; do
ANS=$(curl localhost:4444/status 2>/dev/null)
echo "Status: $ANS"
[ $ANS = "closed" ] && break
sleep 1
done
echo "Turn OFF hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweroff

View File

@ -0,0 +1,22 @@
#!/bin/bash
A="01:48:38"
H="01:13:29"
function sendcmd(){
echo $1 | nc 192.168.70.33 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#" -o "$ANS" == "7#" ] && break
sleep 2
done
# stop tracking
sendcmd ":AL#"

View File

@ -0,0 +1,11 @@
#!/bin/bash
echo "Wait, pre-flashing is in process"
fli_control -c8 >/dev/null
fli_control -s0 >/dev/null
fli_control -x2000 -d -F
fli_control -s8 >/dev/null
fli_control -c0 >/dev/null
fli_control -F -x1 -v32 -h32 -n2 -d >/dev/null
fli_control -x1 -v32 -h32 -d >/dev/null
fli_control -x1 -v2 -h2 -d

View File

@ -1,11 +1,15 @@
#!/bin/bash #!/bin/bash
RA="00:12:15" RA="19:00:10"
DEC="50:25:21" DEC="70:39:51"
OBJ="EGGR381" OBJ="GRW+708247"
EXPTIME=40000
FLATTIME=40000
OBS="Emelianov E.V." OBS="Emelianov E.V."
BADWEATHER=1400
DATEEND=$(sunrise 12)
function sendcmd(){ function sendcmd(){
echo $1 | nc localhost 10001 -q10 echo $1 | nc 192.168.70.33 10001 -q10
} }
function point_tel(){ function point_tel(){
@ -13,16 +17,21 @@ function point_tel(){
send_coords -r $1 -d $2 send_coords -r $1 -d $2
} }
# set lower limit to 0 export http_proxy=""
send_command2mount ":So0#"
last=$(date -d "Nov 30 05:45" +%s) # set lower limit to 5degr
echo "Time diff: $(($last-$(date +%s)))" send_command2mount ":So5#"
if [ $(($last-$(date +%s))) -lt 3600 ]; then
echo "Time diff: $(($DATEEND-$(date +%s)))"
if [ $(($DATEEND-$(date +%s))) -lt 3600 ]; then
echo "There's less an hour for observation!" echo "There's less an hour for observation!"
exit 2 exit 2
fi fi
export http_proxy=""
if [ $(($DATEEND-$(date +%s))) -gt 53200 ]; then
echo "There's more than 12 hours till closing, check script data!"
exit 3
fi
echo "GoTo object: ${RA} ${DEC}" echo "GoTo object: ${RA} ${DEC}"
send_coords -r${RA} -d${DEC} send_coords -r${RA} -d${DEC}
@ -38,9 +47,11 @@ while true; do
curl localhost:55555/weather 2>/dev/null > DomeClosed curl localhost:55555/weather 2>/dev/null > DomeClosed
break; break;
fi fi
chkweather -r -d /dev/ttyS3 > lastweather && badweather=0 || badweather=$((badweather+1)) chkweather ${BADWEATHER} > lastweather && badweather=0 || badweather=$((badweather+1))
[ $badweather -gt 5 ] && break [ $badweather -gt 5 ] && break
if [ "$now" -lt "$last" ]; then [ -f stopobs ] && break
[ -f exitjob ] && exit 0
if [ "$now" -lt "$DATEEND" ]; then
est=$(sendcmd ":Gmte#"|sed -e 's/^0*//' -e 's/#//') est=$(sendcmd ":Gmte#"|sed -e 's/^0*//' -e 's/#//')
echo -e "\n\n\n\n\nEstimated time to flip: $est minutes" echo -e "\n\n\n\n\nEstimated time to flip: $est minutes"
if [[ ("x$est" == "x") || ($est -lt 3) ]]; then if [[ ("x$est" == "x") || ($est -lt 3) ]]; then
@ -54,24 +65,31 @@ while true; do
continue continue
else else
preflash preflash
/usr/bin/fli_control -r /tmp/10micron.fitsheader -x 60000 -N "${OBS}" -O "${OBJ}" "$OBJ" fli_control -r /tmp/10micron.fitsheader -x $EXPTIME -N "${OBS}" -O "${OBJ}" "$OBJ"
fi fi
else else
break break
fi fi
done done
echo "Dome closed @ $(date)" >> closed
curl localhost:4444/close
curl localhost:55555/close curl localhost:55555/close
echo "closed" > closed
../../park_tel.sh relay_manage -s1
park_telescope
for x in $(seq 1 10); do for x in $(seq 1 10); do
preflash preflash
/usr/bin/fli_control -x60000 -d dark fli_control -r /tmp/10micron.fitsheader -x1 -O "bias" -d bias
preflash preflash
/usr/bin/fli_control -x1 -d bias fli_control -r /tmp/10micron.fitsheader -x $EXPTIME -O "dark" -d dark
# preflash
# fli_control -r /tmp/10micron.fitsheader -x $FLATTIME -O "dark" -d darkf
preflash
fli_control -r /tmp/10micron.fitsheader -n5 -x $FLATTIME -O "flat" flat
done done
relay_manage -r1
echo "Closed @ $(date)" >> closed
STOPobs STOPobs

View File

@ -0,0 +1,5 @@
#!/bin/bash
for f in *; do
solve-field --use-sextractor --no-remove-lines --uniformize 0 --radius 2 -p -L 1.3 -H 1.4 -u arcsecperpix $f # && rm -f $f
done
rm -f *.axy *.corr *.xyls *.match *.rdls *.solved *.wcs

View File

@ -0,0 +1,9 @@
#!/bin/bash
INPRA0=$(listhead $1 |grep TAGRA| sed 's|.*= *\(.*\)/.*|\1|')
#'
INPDEC0=$(listhead $1 |grep TAGDEC| sed 's|.*= *\(.*\)/.*|\1|')
#'
echo "RA: $INPRA0, DEC: $INPDEC0"
solve-field --ra $INPRA0 --dec $INPDEC0 --no-remove-lines --uniformize 0 --use-source-extractor -p -L 1.3 -H 1.4 -5 2.5 -u arcsecperpix -t 5 -O $1
rm -f *.axy *.corr *.xyls *.match *.rdls *.solved *.wcs

19
Daemons/astrosib/AZpoint Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
A="90:00:00"
H="45:00:00"
function sendcmd(){
echo $1 | nc localhost 10001 -q10
}
sendcmd ":Sz${A}#"
sendcmd ":Sa${H}#"
sendcmd ":MS#"
while true; do
ANS=$(sendcmd ":Gstat#")
echo $ANS
[ $ANS == "0#" ] && break
sleep 2
done

28
Daemons/astrosib/Chfocus Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
if [ $# != 1 ]; then
echo "USAGE: $0 fval (fval: 0..65000) OR $0 -g (get current focuser position)"
exit 1
fi
if [[ $1 -lt 0 || $1 -gt 65000 && $1 != "-g" ]]; then
echo "Focus value: from 0 to 65000"
exit 2
fi
COMDEV=/dev/ttyS0
stty -F $COMDEV -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
if [ "$1" != "-g" ]; then
echo "Set focus to $1"
echo -en "FOCUSERGO?$1" > $COMDEV
cat $COMDEV
echo -e "\n"
fi
echo -ne "FOCUSERGPOS?\r" > $COMDEV
ans=$(cat $COMDEV | sed 's/.*?//' | tr -d '\r')
echo "$ans"
printf "FOCUS = %5s / Current focuser position, steps\n" $ans > FOCUS.hdr

8
Daemons/astrosib/CloseScope Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
COMDEV=/dev/ttyS0
stty -F $COMDEV -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo -ne "SHUTTERCLOSE?1,1,1,1,1\r" > $COMDEV
cat $COMDEV
echo -e "\n"

9
Daemons/astrosib/GetCoords Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
TTY=/dev/ttyS1
stty -F $TTY -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo -n "RA: "
echo ":GR#" > /dev/ttyS1 && cat /dev/ttyS1
echo -n "Dec: "
echo ":GD#" > /dev/ttyS1 && cat /dev/ttyS1

14
Daemons/astrosib/GoTo Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
TTY=/dev/ttyS1
if [ $# -ne 2 ]; then
echo "USAGE: $0 hh:mm:ss.s +dd:mm:ss.s"
exit 1
fi
stty -F $TTY -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo ":Sr${1}#" > /dev/ttyS1 && cat /dev/ttyS1
echo ":Sd${2}#" > /dev/ttyS1 && cat /dev/ttyS1
echo ":MS#" > /dev/ttyS1 && cat /dev/ttyS1

8
Daemons/astrosib/OpenScope Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
COMDEV=/dev/ttyS0
stty -F $COMDEV -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo -ne "SHUTTEROPEN?1,1,1,1,1\r" > $COMDEV
cat $COMDEV
echo -e "\n"

26
Daemons/astrosib/STARTobs Normal file → Executable file
View File

@ -3,24 +3,24 @@
export http_proxy="" export http_proxy=""
echo "Turn ON hardware power" echo "Turn ON hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweron ssh obs@192.168.70.36 ~/bin/HWpoweron
echo "Open dome" echo "Open dome"
curl localhost:55555/open curl localhost:55555/open
sleep 5
echo "set camera temperature to -35degrC"
fli_control -t-35
echo "Turn ON mount"
ssh obs@192.168.70.36 ~/bin/MOUNTpoweronoff
while true; do while true; do
ANS=$(curl localhost:55555/status 2>/dev/null) ANS=$(curl localhost:55555/status 2>/dev/null)
echo "Status: $ANS" echo "Status: $ANS"
[ $ANS = "opened" ] && break [ $ANS = "2,2,90,90" ] && break
sleep 1 sleep 1
done done
echo "Turn ON mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff
echo "set camera temperature to -25degrC"
fli_control -t-25
echo "Open telescope doors" echo "Open telescope doors"
curl localhost:4444/open COMDEV=/dev/ttyS0
while true; do stty -F $COMDEV -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
ANS=$(curl localhost:4444/status 2>/dev/null) echo -ne "SHUTTEROPEN?1,1,1,1,1\r" > $COMDEV
echo "Status: $ANS" cat $COMDEV
[ $ANS = "opened" ] && break echo -e "\n"
sleep 1
done

23
Daemons/astrosib/STOPobs Normal file → Executable file
View File

@ -2,26 +2,27 @@
# stop observation: close everything, turn of power etc # stop observation: close everything, turn of power etc
export http_proxy="" export http_proxy=""
echo "Turn OFF mount" echo "Turn OFF mount"
ssh obs@192.168.70.34 ~/bin/MOUNTpoweronoff ssh obs@192.168.70.36 ~/bin/MOUNTpoweronoff
echo "Turn off camera TEC" echo "Turn off camera TEC"
fli_control -t25 fli_control -t25
echo "Close telescope doors" echo "Close telescope doors"
curl localhost:4444/close COMDEV=/dev/ttyS0
stty -F $COMDEV -hupcl -opost -onlcr -isig -iexten -echo -echoe -echok -echoctl -echoke -icanon min 0 time 5
echo -ne "SHUTTERCLOSE?1,1,1,1,1\r" > $COMDEV
cat $COMDEV
echo -e "\n"
echo "Close dome" echo "Close dome"
curl localhost:55555/close curl localhost:55555/close
while true; do while true; do
ANS=$(curl localhost:55555/status 2>/dev/null) ANS=$(curl localhost:55555/status 2>/dev/null)
echo "Status: $ANS" echo "Status: $ANS"
[ $ANS = "closed" ] && break [ $ANS = "3,3,0,0" ] && break
sleep 1 sleep 1
done done
echo "Dome closed!" echo "Dome closed!"
while true; do
ANS=$(curl localhost:4444/status 2>/dev/null)
echo "Status: $ANS"
[ $ANS = "closed" ] && break
sleep 1
done
sleep 10
echo "Turn OFF hardware power" echo "Turn OFF hardware power"
ssh obs@192.168.70.34 ~/bin/HWpoweroff ssh obs@192.168.70.36 ~/bin/HWpoweroff

24
Daemons/astrosib/park_tel.sh Executable file
View File

@ -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

23
Daemons/astrosib/park_telescope Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
A="00: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#" -o $ANS == "7#" ] && break
sleep 2
done
echo -e "\n\nTelescope parked\n"

21
Daemons/astrosib/point_AH.sh Executable file
View File

@ -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

94
Daemons/astrosib/run_w_arrays Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
# Change this variables
RA="HH:MM:SS"
DEC="DD:MM:SS"
OBJ="Object name"
OBS="A.U. Thor"
# the date and time of closing
last=$(date -d "Jan 22 06:20" +%s)
# array with filter positions (0 - hole, 1 - B, 2 - V, 3 - R, 4 - r')
POSITIONS=( 1 2 3 )
# array with expositions (in milliseconds!!!) for each position from POSITIONS
EXPTIME=( 600000 300000 400000 )
# array with focus (mm*10000) for each position
FOCUS=( 45000 45500 45300 )
# DON'T CHANGE ANYTHING BELOW THIS LINE
##################################################################################################
echo "Time diff: $(($last-$(date +%s)))"
if [ $(($last-$(date +%s))) -lt 3600 ]; then
echo "There's less an hour for observation!"
exit 2
fi
len=${#POSITIONS[@]}
export http_proxy=""
function sendcmd(){
echo $1 | nc localhost 10001 -q10
}
function point_tel(){
touch lastpointing
send_coords -r $1 -d $2
}
function take_image(){
for (( i=0; i<$len; i++ )); do
fli_control -w ${POSITIONS[i]} -g ${FOCUS[i]}
preflash
fli_control -r /tmp/10micron.fitsheader -x ${EXPTIME[i]} -N "${OBS}" -O "${OBJ}" "$OBJ"
done
}
#function send_coords(){
# echo "1 2 3 0"
#}
#function chkweather(){
# echo "OK"
#}
echo "GoTo object: ${RA} ${DEC}"
echo send_coords -r${RA} -d${DEC}
echo "Start taking object"
badweather=0
while true; do
now=$(date +%s)
chkweather > lastweather && badweather=0 || badweather=$((badweather+1))
[ $badweather -gt 5 ] && break
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
point_tel "${RA}" "${DEC}"
continue
else
take_image
fi
else
break
fi
done
curl localhost:4444/close
curl localhost:55555/close
echo "closed" > closed
park_telescope
for x in $(seq 1 5); do
preflash
fli_control -x300000 -d dark
preflash
fli_control -x1 -d bias
done
STOPobs

5
Daemons/astrosib/solve_all Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
for f in *.fit; do
solve-field -l 5 --use-sextractor --no-remove-lines --uniformize 0 --radius 1 -p -L 0.4 -H 0.5 -u arcsecperpix $f # && rm -f $f
done
rm -f *.axy *.corr *.xyls *.match *.rdls *.solved *.wcs

3
Daemons/astrosib/solve_one Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
solve-field -l 10 --use-sextractor --no-remove-lines --uniformize 0 --radius 1 -p -L 0.4 -H 0.5 -u arcsecperpix $1
rm -f *.axy *.corr *.xyls *.match *.rdls *.solved *.wcs