forked from arhcf/pswai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtake_pic_solve
More file actions
executable file
·75 lines (64 loc) · 2.12 KB
/
take_pic_solve
File metadata and controls
executable file
·75 lines (64 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#
# PSWAI: A Plate Solved Where Am I application
# Copyright (C) 2018 arhcf (user arhcf at github 2018)
# This file is part of the pswai project.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
#
# takes a pic using pic.py, downloads it using lftp and solves it using
# plate solver
#
# Needs pic.py lftp and plate solver like
# astrometry.net's solve-field installed
#
top=`dirname $0`
top=`cd $top; pwd -P`
xyip=$XYIIP
#echo "XYI IP is $xyip"
#echo $top
/usr/bin/pkill solve-field
rundir=/tmp/pushto
mkdir -p $rundir
cd $rundir
\rm -f $rundir/radec.hist.txt
touch $rundir/radec.hist.txt
opd=$rundir
tmout="-l 40"
#dt=`date +"%s"`
ping -c 1 -w 3 $XYIIP > /dev/null 2>&1
rval=$?
if [ $rval -ne 0 ]
then
echo "Cannot access IP $XYIIP .... exiting ...."
exit 1
fi
rfile=`$top/pic.py`
pdt=`date +"%H:%M:%S"`
lftp -e "set xfer:clobber true; get -O $opd $rfile ; quit" -u root, $xyip > /dev/null 2>&1
mv $(basename $rfile) capt.jpg
# Any plate solver can be used, here is an example using solve-field from astrometry.net
solve-field --tweak-order 2 --sigma 12.0 --scale-units degwidth --scale-low 3 --scale-high 8 capt.jpg --out capt.solved --overwrite --no-plot $tmout > solve.log 2>&1
retv=$?
if [ $retv -eq 0 ]; then
r1=`grep "(RA,Dec)" solve.log | awk '{print $5,$6}' | sed -e "s/(//g" -e "s/)//g" -e "s/\,//g"`
r2=`grep "rotation" solve.log | awk '{print $2,$6}' | sed -e "s/(//g" -e "s/)//g" -e "s/\,//g"`
echo $pdt" "$r1" "$r2 | tee $rundir/radec.txt
cat $rundir/radec.txt >> $rundir/radec.hist.txt
exit 0
else
exit 1
fi