From efd12eaf39a05c64d13da9e7ef4aa14c9904f0d7 Mon Sep 17 00:00:00 2001 From: Alexander Kuna Date: Sun, 11 Feb 2018 21:29:34 +0100 Subject: [PATCH] Add -c option to set static position in cartesian coordinates. --- README.md | 1 + gpssim.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33162e8..d84b18d 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Options: -e RINEX navigation file for GPS ephemerides (required) -u User motion file (dynamic mode) -g NMEA GGA stream (dynamic mode) + -c ECEF X,Y,Z in meters (static mode) e.g. 3967283.15,1022538.18,4872414.48 -l Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100 -t Scenario start time YYYY/MM/DD,hh:mm:ss -T Overwrite TOC and TOE to scenario start time diff --git a/gpssim.c b/gpssim.c index 20f9c83..779454a 100644 --- a/gpssim.c +++ b/gpssim.c @@ -1654,6 +1654,7 @@ void usage(void) " -e RINEX navigation file for GPS ephemerides (required)\n" " -u User motion file (dynamic mode)\n" " -g NMEA GGA stream (dynamic mode)\n" + " -c ECEF X,Y,Z in meters (static mode) e.g. 3967283.154,1022538.181,4872414.484\n" " -l Lat,Lon,Hgt (static mode) e.g. 35.681298,139.766247,10.0\n" " -t Scenario start time YYYY/MM/DD,hh:mm:ss\n" " -T Overwrite TOC and TOE to scenario start time\n" @@ -1752,7 +1753,7 @@ int main(int argc, char *argv[]) exit(1); } - while ((result=getopt(argc,argv,"e:u:g:l:o:s:b:T:t:d:iv"))!=-1) + while ((result=getopt(argc,argv,"e:u:g:c:l:o:s:b:T:t:d:iv"))!=-1) { switch (result) { @@ -1767,6 +1768,11 @@ int main(int argc, char *argv[]) strcpy(umfile, optarg); nmeaGGA = TRUE; break; + case 'c': + // Static ECEF coordinates input mode + staticLocationMode = TRUE; + sscanf(optarg,"%lf,%lf,%lf",&xyz[0][0],&xyz[0][1],&xyz[0][2]); + break; case 'l': // Static geodetic coordinates input mode // Added by scateu@gmail.com @@ -1774,6 +1780,7 @@ int main(int argc, char *argv[]) sscanf(optarg,"%lf,%lf,%lf",&llh[0],&llh[1],&llh[2]); llh[0] = llh[0] / R2D; // convert to RAD llh[1] = llh[1] / R2D; // convert to RAD + llh2xyz(llh,xyz[0]); // Convert llh to xyz break; case 'o': strcpy(outfile, optarg); @@ -1905,7 +1912,6 @@ int main(int argc, char *argv[]) // Static geodetic coordinates input mode: "-l" // Added by scateu@gmail.com fprintf(stderr, "Using static location mode.\n"); - llh2xyz(llh,xyz[0]); // Convert llh to xyz numd = iduration; }