Browse Source

adding changes / fixes made for keet.space

master
rra 7 years ago
parent
commit
aeab738a43
  1. 2
      get_tle.py
  2. 20
      render.sh
  3. 14
      satpredict.py
  4. 2
      sats.sh
  5. 15
      satschedule.py

2
get_tle.py

@ -6,7 +6,7 @@ import sys
web_tle = [ 'http://www.celestrak.com/NORAD/elements/weather.txt', 'https://www.celestrak.com/NORAD/elements/stations.txt' ] web_tle = [ 'http://www.celestrak.com/NORAD/elements/weather.txt', 'https://www.celestrak.com/NORAD/elements/stations.txt' ]
#celestrak uses a different key value than I do, find all instances of their keys and replace with mine. #celestrak uses a different key value than I do, find all instances of their keys and replace with mine.
sats_of_interest = { 'NOAA-15':'NOAA 15', 'NOAA-18':'NOAA 18', 'NOAA-19':'NOAA 19', 'METEOR-M1':'METEOR-M 1', 'METEOR-M2':'METEOR-M 2', 'ISS':'ISS (ZARYA)' } sats_of_interest = { 'NOAA-15':'NOAA 15', 'NOAA-18':'NOAA 18', 'NOAA-19':'NOAA 19'}
#NOAA 15 [B] #NOAA 15 [B]
#1 25338U 98030A 16173.50363904 .00000079 00000-0 52195-4 0 9991 #1 25338U 98030A 16173.50363904 .00000079 00000-0 52195-4 0 9991

20
render.sh

@ -2,14 +2,14 @@
#!/bin/bash #!/bin/bash
#render_options=("ZA" "HVCT" "NO") #render_options=("ZA" "HVCT" "NO")
render_options=("HVCT") render_options=("BD" "HVCT" "MCIR")
render_options_night=("MCIR") render_options_night=("HVCT" "MCIR")
direction=${f:(-7):(-6)} direction=${f:(-7):(-6)}
echo $1 echo $1
#remove the directory structure from the first argument #remove the directory structure from the first argument
f1="${1:0:(-4)}" f1="${1:0:(-4)}"
file="${f1#'/tmp/'}" file="${f1#'tmp/'}"
#Isolate data values from filename file should begin with YYYYMMDD-HHMM #Isolate data values from filename file should begin with YYYYMMDD-HHMM
dyear=${file:(0):(4)} dyear=${file:(0):(4)}
@ -29,7 +29,7 @@ echo "${dyear}/${dmonth}/${dday} ${dhour}:${dminute} /" $unixtimestamp
#-gRSCFH are for turning on/off the overlays such as long/lat, cities, lakes, borders, etc. #-gRSCFH are for turning on/off the overlays such as long/lat, cities, lakes, borders, etc.
#-H selects the TLE file #-H selects the TLE file
#-o is when the satellite is overhead forward one minute from the filename just to ensure that the predictor wxmap uses agrees with the pypredict predictor #-o is when the satellite is overhead forward one minute from the filename just to ensure that the predictor wxmap uses agrees with the pypredict predictor
wxmap -T "NOAA 15" -T "NOAA 18" -T "NOAA 19" -n "Vancouver,Canada" -c l:0xff000 -g 0 -R 0 -S 1 -C 1 -F 0 -H ~/satellites/weather.txt -o $(($unixtimestamp+60)) /tmp/passmap.png #wxmap -T "NOAA 15" -T "NOAA 18" -T "NOAA 19" -n "Vancouver,Canada" -c l:0xff000 -g 0 -R 0 -S 1 -C 1 -F 0 -H ~/satellites/weather.txt -o $(($unixtimestamp+60)) /tmp/passmap.png
#If pass is at night time render differently for daytime. #If pass is at night time render differently for daytime.
if [[ ${dhour#0} -le 8 ]] || [[ ${dhour#0} -ge 17 ]] #the funny code is to ensure things are translated into base 10. if [[ ${dhour#0} -le 8 ]] || [[ ${dhour#0} -ge 17 ]] #the funny code is to ensure things are translated into base 10.
@ -39,17 +39,21 @@ then
do do
echo "Now rendering option: ${r}" echo "Now rendering option: ${r}"
wxtoimg -e $r -ocK -m /tmp/passmap.png /tmp/$file /tmp/$file"_${r}".png wxtoimg -e $r -oK /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_${r}".png
done wxtoimg -p /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_pristine".png
wxtoimg -r /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_raw".png
done
else else
echo "Pass is in sun" echo "Pass is in sun"
for r in "${render_options[@]}" for r in "${render_options[@]}"
do do
echo "Now rendering option: ${r}" echo "Now rendering option: ${r}"
wxtoimg -e $r -ocK -m /tmp/passmap.png /tmp/$file /tmp/$file"_${r}".png wxtoimg -e $r -oK /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_${r}".png
wxtoimg -p /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_pristine".png
wxtoimg -r /home/space/satstuff/Pi_WXRX/tmp/$file.wav /var/www/html/APT/$file"_raw".png
done done
fi fi
#Upload. #Upload.
bash ~/satellites/ftp.sh /tmp/$file"_${r}".png #bash ~/satellites/ftp.sh /tmp/$file"_${r}".png

14
satpredict.py

@ -4,11 +4,11 @@ import sys
import datetime import datetime
#Frequencies that satellites transmit on. #Frequencies that satellites transmit on.
frequencies = {'NOAA-15':'137.620M', 'NOAA-18':'137.9125M', 'NOAA-19':'137.10M', 'METEOR-M2':'137.925M', 'ISS':'145.80M' } #Meteor M2 is also on 137.1M frequencies = {'NOAA-15':'137.620M', 'NOAA-18':'137.9125M', 'NOAA-19':'137.10M'} #Meteor M2 is also on 137.1M
tle_data = json.load(open('sat_tle.txt')) tle_data = json.load(open('sat_tle.txt'))
default_predictions = 1 #how many predictions do we want to predict in advance default_predictions = 1 #how many predictions do we want to predict in advance
default_min_elevation = 30 #how low the angle of the satellitie pass is allowed to be if we want to record a pass default_min_elevation = 15 #how low the angle of the satellitie pass is allowed to be if we want to record a pass
suppress_low_passes = False #Less console spam if you enable this. suppress_low_passes = False #Less console spam if you enable this.
#You can change the default elevation with the first parameter #You can change the default elevation with the first parameter
@ -47,7 +47,7 @@ def get_sat( sat ):
return sat + '\n' + tle_data[sat] return sat + '\n' + tle_data[sat]
#Where on the earth you are. Change this to your location #Where on the earth you are. Change this to your location
qth = (49.5, 123.5, 50) # lat (N), long (W), alt (meters) qth = (52.08, 5.17, 5) # lat (N), long (W), alt (meters)
data = {} data = {}
@ -59,14 +59,14 @@ for sat, freq in frequencies.iteritems():
count = 0 count = 0
while ( count < predictions ): while ( count < predictions ):
p = t.next() p = t.next()
p_nw = t_nw.next() # p_nw = t_nw.next()
p_se = t_se.next() # p_se = t_se.next()
#peak check. PEAK CHECK! #peak check. PEAK CHECK!
while (p.peak()['elevation'] < default_min_elevation): while (p.peak()['elevation'] < default_min_elevation):
p = t.next() p = t.next()
p_nw = t_nw.next() # p_nw = t_nw.next()
p_se = t_se.next() # p_se = t_se.next()
if( not suppress_low_passes ): if( not suppress_low_passes ):
print name, "pass too low, recalculating" print name, "pass too low, recalculating"

2
sats.sh

@ -5,7 +5,7 @@ SAT=$1
#current unix time #current unix time
TIEMSTAMP=$(date +%s) TIEMSTAMP=$(date +%s)
#make a file #make a file
FILENAME="sat_schedules/schd-${SAT}-${TIEMSTAMP}" FILENAME="sat_scheds/schd-${SAT}-${TIEMSTAMP}"
rm reschd-$SAT.txt rm reschd-$SAT.txt

15
satschedule.py

@ -5,18 +5,18 @@ import time
import datetime import datetime
ppmshift = '1' #adjust this if you don't have a TCXO equipped RTLSDR ppmshift = '1.1' #adjust this if you don't have a TCXO equipped RTLSDR
name = sys.argv[1].upper() #what satellite we're using name = sys.argv[1].upper() #what satellite we're using
input_sample_rate = '48000' #actually the bandwidth of the audio sample we're taking from the RTLSDR input_sample_rate = '48000' #actually the bandwidth of the audio sample we're taking from the RTLSDR
output_sample_rate = '11025' #what we downconvert to to play nicely with wxtoimg output_sample_rate = '11025' #what we downconvert to to play nicely with wxtoimg
gain = '40' #software gain gain = '35' #software gain
gain_lower_pass = gain #we can add more or less gain if a satellite is at a lower elevation, currently disabled gain_lower_pass = gain #we can add more or less gain if a satellite is at a lower elevation, currently disabled
gain_lower_pass_requirement = 40 gain_lower_pass_requirement = 40
data = json.load(open('satpredict.txt')) data = json.load(open('satpredict.txt'))
af_folder = '/tmp/' af_folder = 'tmp/'
output_folder = '~/sat_output/' output_folder = '/home/space/satstuff/PI_WXRX/sat_output/'
#this line is depreciated, make it a zero element array to do rtl_power surveys of the downline band #this line is depreciated, make it a zero element array to do rtl_power surveys of the downline band
wxtoimg_options = ['HVCT', 'MCIR', 'NO'] wxtoimg_options = ['HVCT', 'MCIR', 'NO']
@ -75,12 +75,12 @@ filename = datestamp(data[name]['start_unix']) + name + '_' + str(int(data[name]
#I may or may not have forgotten to specify you need the heatmap.py from the rtl_power page on keenerd. #I may or may not have forgotten to specify you need the heatmap.py from the rtl_power page on keenerd.
if( len(wxtoimg_options) == 0 ): if( len(wxtoimg_options) == 0 ):
rtlpower = 'rtl_power -f 137M:138M:4k -g ' + gain + ' -i 1s -e ' + str(data[name]['duration_seconds']) + 's -p ' + ppmshift + ' -c 0.2 ' + output_folder + filename + '.csv' # rtlpower = 'rtl_power -f 137M:138M:4k -g ' + gain + ' -i 1s -e ' + str(data[name]['duration_seconds']) + 's -p ' + ppmshift + ' -c 0.2 ' + output_folder + filename + '.csv'
heatmap = 'python heatmap.py ' + output_folder + name + '_' + str(int(data[name]['elevation'])) + '_' + timestamp + '.csv ' + output_folder + name + '_' + data[name]['direction'] + str(int(data[name]['elevation'])) + '_' + timestamp + '.png' # heatmap = 'python heatmap.py ' + output_folder + name + '_' + str(int(data[name]['elevation'])) + '_' + timestamp + '.csv ' + output_folder + name + '_' + data[name]['direction'] + str(int(data[name]['elevation'])) + '_' + timestamp + '.png'
print timeoutstr, rtlpower print timeoutstr, rtlpower
print heatmap print heatmap
print 'bash ftp.sh ' + output_folder + name + '_' + str(int(data[name]['elevation'])) + '_' + timestamp + '.png' # print 'bash ftp.sh ' + output_folder + name + '_' + str(int(data[name]['elevation'])) + '_' + timestamp + '.png'
else: else:
@ -94,6 +94,7 @@ else:
for v in sox_options: for v in sox_options:
soxstr = soxstr + ' ' + v soxstr = soxstr + ' ' + v
print '/home/space/satstuff/rtl_biast/build/src/rtl_biast -b1'
print timeoutstr, rtlstr, af_folder + filename + '.raw' print timeoutstr, rtlstr, af_folder + filename + '.raw'
print soxstr, af_folder + filename + '.raw', af_folder + filename + '.wav', 'rate 11025' print soxstr, af_folder + filename + '.raw', af_folder + filename + '.wav', 'rate 11025'
print 'touch -r', af_folder + filename + '.raw', af_folder + filename + '.wav' print 'touch -r', af_folder + filename + '.raw', af_folder + filename + '.wav'

Loading…
Cancel
Save