diff --git a/data/launchsites.txt b/data/launchsites.txt index 0c805f2..f1d2685 100644 --- a/data/launchsites.txt +++ b/data/launchsites.txt @@ -13,3 +13,4 @@ 31.2519 131.0819 Uchinoura 13.7199 80.2304 Satish Dhawan 41.5330 111.7067 Siziwang Banner + -39.2608 177.8641 Mahia diff --git a/satorbit.c b/satorbit.c index 10d864a..bc2f8e6 100644 --- a/satorbit.c +++ b/satorbit.c @@ -65,6 +65,7 @@ double nfd2mjd(char *date); double date2mjd(int year,int month,double day); void mjd2date(double mjd,char *date,int length); void usage(); +void interactive_usage(); void nfd_now(char *s); void rotate(int axis,float angle,float *x,float *y,float *z); void sunpos_xyz(double mjd,xyz_t *pos,double *ra,double *de); @@ -1069,6 +1070,13 @@ void plot_map(int plotflag) // Get cursor cpgcurs(&x,&y,&c); + // Help + if (c=='h') { + interactive_usage(); + + continue; + } + // Redraw if (c=='r') { m.mjd=-1.0; @@ -1316,7 +1324,50 @@ double nfd2mjd(char *date) void usage() { - return; + printf("usage: satorbit -c TLEFILE [-g DEVICE] [-t TIMESTAMP] [-s COSPARID] [-i SATNO]\n"); + printf(" [-q] [-p XYZFILE] [-m] [-N NOTAMFILE] [-l LENGTH]\n"); + printf(" [-L LNG] [-B LAT] [-R ZOOMSIZE] [-S ORIENTATION] [-h]\n\n"); + + printf("-c TLEFILE The file containing orbital elements in the form of TLEs, 3 lines per object\n"); + printf("-g DEVICE PGPlot device (default: \"/xs\" --> interactive).\n"); + printf(" If set exit the program when everything was drawn.\n"); + printf(" default: stay in interactive mode\n"); + printf("-t TIMESTAMP Timestamp of the map, formatted as YYYY-mm-ddTHH:MM:SS, default: now\n"); + printf("-s COSPARID observation site, COSPAR ID of the observation site on which the map is centered optionally\n"); + printf("-i SATNO satno of the selected satellite, default: 0 (all satellites in the TLE file)\n"); + printf("-q launchsitesflag: If value=1 plot the launch sites as well, default: 0\n"); + printf("-p XYZFILE If given, plot xyz instead of track\n"); + printf("-m moonflag: If value=1 plot the moon as well\n"); + printf("-N NOTAMFILE If given, plot the NOTAM as well\n"); + printf("-l LENGTH Integration length in seconds, default: 60\n"); + printf("-L LNG map longitude\n"); + printf("-B LAT map latitude\n"); + printf("-R ZOOMSIZE Initial window size in earth radii, default: 1.2\n"); + printf("-S ORIENTATION map orientation: sidereal, default: terrestial\n"); + printf("-h Print usage\n"); +} + +void interactive_usage() +{ + printf("r Redraw\n"); + printf("f Toggle footprint visibility\n"); + printf("m Toggle moon visibility\n"); + printf("L Toggle launchsite visibility\n"); + printf("o Switch between terrestial and sidereal orientation\n"); + printf("c Center map on cursor position\n"); + printf("- Zoom out by a factor of 1.2\n"); + printf("+/= Zoom in\n"); + printf("{ decrease latitude -2\n"); + printf("} increase latitude +2\n"); + printf("[ decrease longitude -2\n"); + printf("] increase longitude +2\n"); + printf("< Divide the integration length by a facor of 2\n"); + printf("> Multiply the integration length by a facor of 2\n"); + printf(", Increase time (+integration_length in seconds /(1 day))\n"); + printf(". Roll back the time\n"); + printf("l Enter the integration length in seconds\n"); + printf("h this interactive help\n"); + printf("q/Q Exit\n"); } // Compute Date from Julian Day diff --git a/tleinfo.c b/tleinfo.c index 3eba6ff..ace267b 100644 --- a/tleinfo.c +++ b/tleinfo.c @@ -19,8 +19,33 @@ extern double SGDP4_jd0; void usage(void) { - return; + printf("usage: tleinfo [-c TLEFILE] [-u] [|-1|-f] [ |-n|-d] [-i SATNO] [ |-a|-b] [-H] [-h]\n\n"); + + printf("-c TLEFILE The file containing orbital elements in the form of TLEs, 3 lines per object\n"); + printf(" default: ./bulk.tle\n"); + printf("-i SATNO Filter only elements for objects with this satno\n"); + printf("-u Show only one object (MODE0 only)\n"); + + printf("\nSelect MODE:\n"); + printf(" MODE0: Show TLEs, object names or COSPAR designations\n"); + printf("-1 MODE1: Show list of elements (one line per object)\n"); + printf("-f MODE2: Show human-readable parameters\n\n"); + + printf("Select INFOTYPE\n"); + printf("MODE0:\n"); + printf(" default Show the TLEs itself\n"); + printf(" -n Show only the name of the objects\n"); + printf(" -d Show only the COSPAR designation of the objects\n\n"); + printf("MODE1:\n"); + printf(" default SATNO, YEAR, DOY, INCL, ASCN, ARGP, MA, ECC, MM, BSTAR\n"); + printf(" -a SATNO, SEMI, PERIGEE, APOGEE, INCL, PERIOD, ECC\n"); + printf(" -b SATNO, YEAR, DOY, INCL, ASCN, ARGP, MA, ECC, MM, floor(MJD), LNG_AT_MIDNIGHT\n\n"); + + + printf("-H Show header (MODE1 only), default: disabled\n"); + printf("-h Print usage\n"); } + double modulo(double x,double y); // Compute Julian Day from Date @@ -251,19 +276,21 @@ int main(int argc,char *argv[]) while (fgetline(file,line1,LIM)>0) { // Find TLE line if (line1[0]=='1') { - fgetline(file,line2,LIM); - sscanf(line1+2,"%d",&no); - if (satno==0 || satno==no) { - if (name==1 && desig==0) - printf("%s\n",line0); - else if (name==0 && desig==1) - printf("%.8s\n",line1+9); - else - printf("%s\n%s\n%s\n",line0,line1,line2); - if (unique==1) - break; - } + fgetline(file,line2,LIM); + sscanf(line1+2,"%d",&no); + + if (satno==0 || satno==no) { + if (name==1 && desig==0) + printf("%s\n",line0); + else if (name==0 && desig==1) + printf("%.8s\n",line1+9); + else + printf("%s\n%s\n%s\n",line0,line1,line2); + if (unique==1) + break; + } } + strcpy(line0,line1); } @@ -299,12 +326,16 @@ int main(int argc,char *argv[]) file=fopen(tlefile,"rb"); if (file==NULL) fatal_error("File open failed for reading \"%s\"",tlefile); - - if (info==0 && header==1) - printf("SATNO YEAR DOY INCL ASCN ARGP MA ECC MM\n"); - if (info==1 && header==1) - printf("SATNO SEMI PERIGEE APOGEE PERIOD ECC\n"); - + + if (header==1) { + if (info==0) + printf("SATNO YEAR DOY INCL ASCN ARGP MA ECC MM BSTAR\n"); + else if (info==1) + printf("SATNO SEMI PERIGEE APOGEE PERIOD ECC\n"); + else if (info==2) + printf("SATNO YEAR DOY INCL ASCN ARGP MA ECC MM floor(MJD) LNG_AT_MIDNIGHT\n"); + } + // Loop over file while (read_twoline(file,satno,&orb)==0) { orbit(orb,&aodp,&perigee,&apogee,&period); @@ -313,8 +344,8 @@ int main(int argc,char *argv[]) if (info==0) printf("%05d %10.4lf %8.4f %8.4f %8.4f %8.4f %8.6f %8.5f %e\n",orb.satno,mjd,DEG(orb.eqinc),DEG(orb.ascn),DEG(orb.argp),DEG(orb.mnan),orb.ecc,orb.rev,orb.bstar); if (info==1) printf("%05d %6.0f x %6.0f x %6.2f %8.2f %8.6f %14.8lf\n",orb.satno,perigee,apogee,DEG(orb.eqinc),period,orb.ecc,mjd); if (info==2) { - lng=orbital_longitude_at_midnight(orb,mjd); - printf("%05d %10.4lf %8.4f %8.4f %8.4f %8.4f %8.6f %8.5f %10.4lf %8.4f\n",orb.satno,mjd,DEG(orb.eqinc),DEG(orb.ascn),DEG(orb.argp),DEG(orb.mnan),orb.ecc,orb.rev,floor(mjd),lng); + lng=orbital_longitude_at_midnight(orb,mjd); + printf("%05d %10.4lf %8.4f %8.4f %8.4f %8.4f %8.6f %8.5f %10.4lf %8.4f\n",orb.satno,mjd,DEG(orb.eqinc),DEG(orb.ascn),DEG(orb.argp),DEG(orb.mnan),orb.ecc,orb.rev,floor(mjd),lng); } } fclose(file); @@ -323,15 +354,11 @@ int main(int argc,char *argv[]) file=fopen(tlefile,"rb"); if (file==NULL) fatal_error("File open failed for reading \"%s\"",tlefile); - - if (info==0 && header==1) - printf("SATNO YEAR DOY INCL ASCN ARGP MA ECC MM\n"); - if (info==1 && header==1) - printf("SATNO SEMI PERIGEE APOGEE PERIOD ECC\n"); - + // Loop over file while (read_twoline(file,satno,&orb)==0) print_orb(&orb); + fclose(file); }