Aktualisierung
parent
31542d484c
commit
afadf42961
|
@ -3,6 +3,6 @@ for i in /tmp/*.pid; do
|
|||
tp=$(cat $i)
|
||||
if [ $(ps ${tp}|grep ${tp}|wc -l) -eq 0 ]; then
|
||||
rm $i
|
||||
nohup /home/pi/gps/gps_raw.sh $(basename $i .pid) &>/dev/null &
|
||||
nohup /home/pi/gps/gps_raw5.sh $(basename $i .pid) &>/dev/null &
|
||||
fi
|
||||
done
|
||||
|
|
21
gps2sql.sh
21
gps2sql.sh
|
@ -1,5 +1,20 @@
|
|||
#!/bin/sh
|
||||
gpsl=
|
||||
pid=$$
|
||||
for i in $(find /tmp -name "gps_*.*"|cut -d/ -f3|cut -d\. -f1|sort -u); do
|
||||
for j in $(find /tmp -name "$i.*"|sort|head -n-1); do
|
||||
cat $j|grep RMC > /tmp/${pid}.rmc
|
||||
cat $j|grep GSV > /tmp/${pid}.gsv
|
||||
cat $j|grep GSA |cut -d, -f1-5,18-20> /tmp/${pid}.gsa
|
||||
cat $j|grep GST > /tmp/${pid}.gst
|
||||
cat $j|grep GGA > /tmp/${pid}.gga
|
||||
rm $j
|
||||
done
|
||||
done
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '/tmp/${pid}.rmc' into table gpsrmc fields terminated by ',' enclosed by ';' (epoch,tty,uid,telegram,system,fix,breite,laenge,nord,west,velocity,course);"
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '/tmp/${pid}.gsv' into table gpsgsv fields terminated by ',' enclosed by ';' (epoch,tty,uid,telegram,system,prn,elevation,azimuth,snr);"
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '/tmp/${pid}.gsa' into table gpsgsa fields terminated by ',' enclosed by ';' (epoch,tty,uid,telegram,system,pdop,hdop,vdop);"
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '/tmp/${pid}.gst' into table gpsgst fields terminated by ',' enclosed by ';' (epoch,tty,uid,telegram,system,rms,errmaj,errmin,error,sig_lat,sig_lon,sig_height);"
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '/tmp/${pid}.gga' into table gpsgga fields terminated by ',' enclosed by ';' (epoch,tty,uid,telegram,system,sats,hdop,hoehe,geoid);"
|
||||
|
||||
find /tmp -name "gps_*" -not -newermt '-120 seconds'|parallel -j3 /home/pi/gps/mysql_import.sh {}
|
||||
|
||||
#/home/pi/gps/gps_preanalyse.r
|
||||
rm /tmp/${pid}.*
|
||||
|
|
34
gps_pre.awk
34
gps_pre.awk
|
@ -1,8 +1,30 @@
|
|||
#!/usr/bin/gawk -f
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {FS =","
|
||||
OFS=","}
|
||||
/RMC/ {east=$9+0;gsub(/ \$/,"",$4);gsub(/^0/,"",$11);print $1,$2,$3,$4,int($5),$13,$7,east,$8,$10,$11,$12}
|
||||
/GGA/ {gsub(/ \$/,"",$4);gsub(/^0/,"",$11);gsub(/^0/,"",$8);print $1,$2,$3,$4,int($5),$6,$8,$7,$9,$11,$12,$13,$15}
|
||||
/GSA/ {gsub(/ \$/,"",$4);print $1,$2,$3,$4,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21}
|
||||
/GSV/ {gsub(/ \$/,"",$4);$5="";$6="";print $0}
|
||||
/GST/ {gsub(/ \$/,"",$4);print $0}
|
||||
/RMC/ {
|
||||
gsub(/\./,"",$1)
|
||||
gsub(/ \$/,"",$4)
|
||||
gsub(/^0/,"",$11)
|
||||
split($5,zeit,".")
|
||||
split($7,w,".")
|
||||
for(i=length(w[2]);i<6;i++)w[2]=w[2] "0";
|
||||
deg=substr(w[1],1,length(w[1])-2)*60+substr(w[1],length(w[1])-1,2)
|
||||
split($9,l,".")
|
||||
for(i=length(l[2]);i<6;i++)l[2]=l[2] "0";
|
||||
ldeg=substr(l[1],1,length(l[1])-2)*60+substr(l[1],length(l[1])-1,2)
|
||||
utc=mktime("20"substr($13,5,2)" "substr($13,3,2)" "substr($13,1,2)" "substr($5,1,2)" "substr($5,3,2)" "substr($5,5,2))
|
||||
print $1,$2,$3,substr($4,3),substr($4,2,1),zeit[1],deg w[2],ldeg l[2],$8,$10,$11*1000,$12,utc}
|
||||
/GGA/ {gsub(/\./,"",$1);gsub(/ \$/,"",$4);gsub(/^0/,"",$11);split($5,ts,".");gsub(/^0/,"",$8);print $1,$2,$3,substr($4,3),substr($4,2,1),ts[1],$11,$12*1000,$13*1000,$15*1000}
|
||||
/GSA/ {gsub(/\./,"",$1);gsub(/ \$/,"",$4);print $1,$2,$3,substr($4,3),substr($4,2,1),$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19*1000,$20*1000,$21*1000}
|
||||
/GSV/ {gsub(/\./,"",$1);gsub(/ \$/,"",$4)
|
||||
for(i=1;i<=4;i++){
|
||||
if(i*4+4<NF){print $1,$2,$3,substr($4,3),substr($4,2,1),$(4*i+4),$(4*i+5),$(4*i+6),$(4*i+7)}
|
||||
}
|
||||
}
|
||||
/GST/ {
|
||||
gsub(/\./,"",$1)
|
||||
split($5,zeit,".")
|
||||
gsub(/ \$/,"",$4)
|
||||
print $1,$2,$3,substr($4,3),substr($4,2,1),zeit[1],$6,$7,$8,$9,$10*1000,$11*1000,$12*1000
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#!/bin/bash
|
||||
export TZ=UTC
|
||||
TTY=$1
|
||||
STTY=$(echo $TTY|sed -e 's/tty//g')
|
||||
STTY=$(echo $1|sed -e 's/tty//g')
|
||||
if [ ! -f /tmp/${TTY}.pid ]; then
|
||||
id=
|
||||
echo $$ > /tmp/${TTY}.pid
|
||||
|
||||
uid=$(echo $(udevadm info --name=/dev/${TTY}|sed -n '/MAJOR/{s/[A-Z: =]*//;p}')*256+$(udevadm info --name=/dev/${TTY}|sed -n '/MINOR/{s/[A-Z: =]*//;p}')|bc)
|
||||
# id=${uid}$(date +%s%2N)
|
||||
exfile=$(date +%j%H%M)
|
||||
cat /dev/${TTY}|unbuffer -p tr -dc "[:print:]\n"|unbuffer -p grep '^$G.RMC\|^$G.GS\|^$G.GGA\|^$G.GNS\|^$G.VTG\|^$G.ZDA'|ts %.s,${TTY},${uid},|unbuffer -p sed -e 's/*..//g'|split -a4 -d -l10000 - /tmp/${TTY}.
|
||||
cat /dev/${TTY}|unbuffer -p tr -dc "[:print:]\n"|ts %.s,${STTY},${uid},|unbuffer -p sed -e 's/*..//g'|/home/pi/gps/gps_pre.awk|split -a6 -l10000 - /tmp/gps_${uid}.
|
||||
fi
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
#!/bin/sh
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsin (uid integer, id bigint, epoch bigint, telegram char(5),payload varchar(160),raw tinyint, index (uid,id,epoch,telegram,raw));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsrmc (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,velocity integer,fix char(1),system char(1),fix_epoch integer,raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgga (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,fix integer,fix_epoch integer,sats tinyint,hdop decimal(3,3),hoehe integer,hoehe_datum integer,raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsv (uid integer, id bigint, epoch bigint, prn smallint unsigned,elevation smallint unsigned,azimuth smallint unsigned,snr smallint unsigned,folge tinyint unsigned,system char(1),raw tinyint, index (uid,id,epoch,prn,system));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsa (uid integer, id bigint, epoch bigint, system char(1),hdop decimal(5,3),vdop decimal(5,3),pdop decimal(5,3),sats varchar(50),raw tinyint, index (uid,id,epoch));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgbs (uid integer, id bigint, epoch bigint, system char(1),lat_err decimal(5,3),lon_err decimal(5,3),alt_err decimal(5,3),raw tinyint, index (uid,id,epoch));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgrs (uid integer, id bigint, epoch bigint, system char(1),fix integer,fgga integer,s1 numeric,s2 numeric,s3 numeric,s4 numeric,s5 numeric,s6 numeric,s7 numeric,s8 numeric,s9 numeric,s10 numeric,s11 numeric,s12 numeric,raw tinyint, index (uid,id,epoch));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgst (uid integer, id bigint, epoch bigint, system char(1),rms mediumint,lat_sigma decimal(5,3),lon_sigma decimal(5,3),height_sigma decimal(5,3),raw tinyint, index (uid,id,epoch));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsvtg (uid integer, id bigint, epoch bigint, system char(1),course_true mediumint,course_mag mediumint,speed_kn integer unsigned,speed_kmh integer unsigned,raw tinyint, index (uid,id,epoch));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgns (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,fix integer,sats tinyint,hdop decimal(3,3),hoehe integer,hoehe_datum integer,mode varchar(8),raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsrmc (epoch bigint,tty char(5),uid integer,telegram char(3),system char(1),fix integer,breite bigint,laenge bigint,nord char(1),west char(1),velocity integer,course integer, index(uid,epoch,breite,laenge));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsv (epoch bigint,tty char(5),uid integer,telegram char(3),system char(1),prn smallint,elevation tinyint,azimuth smallint,snr tinyint, index(uid,epoch,prn));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgga (epoch bigint,tty char(5),uid integer,telegram char(3),system char(1),fix integer,sats tinyint,hdop integer,hoehe bigint,geoid integer, index(uid,epoch,hoehe));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsa (epoch bigint,tty char(5),uid integer,telegram char(3),system char(1),pdop integer,hdop integer,vdop integer, index(uid,epoch,hdop,vdop,pdop));"
|
||||
mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgst (epoch bigint,tty char(5),uid integer,telegram char(3),system char(1),rms bigint,errmaj integer,errmin integer,error integer,sig_lat integer,sig_lon integer,sig_height integer, index(uid,epoch,sig_lat,sig_lon,sig_height));"
|
||||
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsin (uid integer, id bigint, epoch bigint, telegram char(5),payload varchar(160),raw tinyint, index (uid,id,epoch,telegram,raw));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsrmc (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,velocity integer,fix char(1),system char(1),fix_epoch integer,raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgga (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,fix integer,fix_epoch integer,sats tinyint,hdop decimal(3,3),hoehe integer,hoehe_datum integer,raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsv (uid integer, id bigint, epoch bigint, prn smallint unsigned,elevation smallint unsigned,azimuth smallint unsigned,snr smallint unsigned,folge tinyint unsigned,system char(1),raw tinyint, index (uid,id,epoch,prn,system));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgsa (uid integer, id bigint, epoch bigint, system char(1),hdop decimal(5,3),vdop decimal(5,3),pdop decimal(5,3),sats varchar(50),raw tinyint, index (uid,id,epoch));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgbs (uid integer, id bigint, epoch bigint, system char(1),lat_err decimal(5,3),lon_err decimal(5,3),alt_err decimal(5,3),raw tinyint, index (uid,id,epoch));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgrs (uid integer, id bigint, epoch bigint, system char(1),fix integer,fgga integer,s1 numeric,s2 numeric,s3 numeric,s4 numeric,s5 numeric,s6 numeric,s7 numeric,s8 numeric,s9 numeric,s10 numeric,s11 numeric,s12 numeric,raw tinyint, index (uid,id,epoch));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgst (uid integer, id bigint, epoch bigint, system char(1),rms mediumint,lat_sigma decimal(5,3),lon_sigma decimal(5,3),height_sigma decimal(5,3),raw tinyint, index (uid,id,epoch));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsvtg (uid integer, id bigint, epoch bigint, system char(1),course_true mediumint,course_mag mediumint,speed_kn integer unsigned,speed_kmh integer unsigned,raw tinyint, index (uid,id,epoch));"
|
||||
#mysql -u gps -pgps -D gps -e "create table if not exists gps.gpsgns (uid integer, id bigint, epoch bigint, breite bigint,laenge bigint,fix integer,sats tinyint,hdop decimal(3,3),hoehe integer,hoehe_datum integer,mode varchar(8),raw tinyint, index (uid,id,epoch,breite,laenge));"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '$1' into table gpsin fields terminated by ',' enclosed by ';' (uid,id,epoch,telegram,payload);"
|
||||
mysql -u gps -pgps -D gps -e "load data local infile '$1' into table gpsin fields terminated by ',' enclosed by ';' (epoch,id,uid,telegram,payload);"
|
||||
rm $1
|
||||
|
|
Loading…
Reference in New Issue