]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBsim/FGMain.cpp
source tree reorganization prior to flightgear 0.7
[flightgear.git] / src / FDM / JSBsim / FGMain.cpp
1 #include "FGFDMExec.h"
2 #include "FGRotation.h"
3 #include "FGAtmosphere.h"
4 #include "FGState.h"
5 #include "FGFCS.h"
6 #include "FGAircraft.h"
7 #include "FGTranslation.h"
8 #include "FGPosition.h"
9 #include "FGAuxiliary.h"
10 #include "FGOutput.h"
11
12 #include <iostream>
13 #include <ctime>
14
15 void main(int argc, char** argv)
16 {
17         FGFDMExec* FDMExec;
18         
19 //  struct timespec short_wait = {0,100000000};
20 //  struct timespec no_wait    = {0,100000000};
21
22   if (argc != 3) {
23     cout << endl
24          << "  You must enter the name of a registered aircraft and reset point:"
25          << endl << endl << "  FDM <aircraft name> <reset file>" << endl;
26     exit(0);
27   }
28
29   FDMExec = new FGFDMExec();
30
31   FDMExec->GetAircraft()->LoadAircraft("aircraft", "engine", string(argv[1]));
32   FDMExec->GetState()->Reset("aircraft", string(argv[2]));
33
34   while (FDMExec->GetState()->Getsim_time() <= 25.0)
35   {
36 //
37 // fake an aileron, rudder and elevator kick here after 20 seconds
38 //
39
40                 if (FDMExec->GetState()->Getsim_time() > 5.0) {
41                         FDMExec->GetFCS()->SetDe(0.05);
42 //                      FDMExec->GetFCS()->SetDr(0.05);
43 //                      FDMExec->GetFCS()->SetDa(0.05);
44                 }
45                 
46     FDMExec->Run();
47 //    nanosleep(&short_wait,&no_wait);
48   }
49
50   delete FDMExec;
51 }