All Classes Functions
PitchSchedule.h
1 // ==============================================================
2 // ORBITER MODULE: LaunchMFD
3 // Part of the ORBITER SDK
4 //
5 // Copyright (C) 2004 rjcroy - robust time based pitch autopilot (borrowed code)
6 // Copyright (C) 2004 Dave "Daver" Rowbotham - conversion of rjcroy's autopolot to C++ (borrowed code)
7 // Copyright (C) 2004 Erik H. "Sputnik" Anderson - conversion of the autopilot to energy based (borrowed code)
8 // Copyright (C) 2007 "Vanguard" - dressing up azimuth calcualtions into an MFD (author)
9 // Copyright (C) 2007 Pawel "She'da'Lier" Stiasny - yaw error visual representation (contributor)
10 // Copyright (C) 2008 Mohd "Computerex" Ali - borrowed his code (multiple vessels support) (borrowed code)
11 // Copyright (C) 2008 Chris "Kwan" Jeppesen - borrowed his code (peg guidance) (borrowed code)
12 // Copyright (C) 2008 Steve "agentgonzo" Arch - peg integration, offplane correction, compass, hud display (co-developer)
13 // Copyright (C) 2007-2012 Szymon "Enjo" Ender - everything else ;> (author and maintainer)
14 // All rights reserved
15 //
16 // PitchSchedule.h
17 // Authors - Steve "agentgonzo" Arch
18 //
19 // This module calculates the appropriate launch azimuth given
20 // desired orbital inclination and desired orbit altitude. This
21 // MFD takes the planets rotation into account, which provides a
22 // much more accurate azimuth. The calculations are performed
23 // 'on the fly' (technically and methaphorically), meaning that
24 // you get info about necessary course corrections.
25 //
26 // This file is part of LaunchMFD.
27 //
28 // LaunchMFD is free software: you can redistribute it and/or modify
29 // it under the terms of the GNU General Public License as published by
30 // the Free Software Foundation, either version 3 of the License, or
31 // (at your option) any later version.
32 //
33 // LaunchMFD is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with LaunchMFD. If not, see <http://www.gnu.org/licenses/>.
40 // ==============================================================
41 
42 
43 #pragma once
44 #include "pitchguidance.h"
45 #include "orbitersdk.h"
46 #include <fstream>
47 #include <list>
48 
49 using namespace std;
50 
52  public PitchGuidance
53 {
54 private:
55  class AltitudePitchPair
56  {
57  public:
58  double altitude;
59  double pitch;
60  int operator<(const AltitudePitchPair &rhs) {return altitude < rhs.altitude;};
61  bool operator!=(const AltitudePitchPair &rhs) {return altitude != rhs.altitude || pitch != rhs.pitch;}
62  istream& operator<<(istream& in) {char ignore[256]; in >> altitude >> ignore >> pitch; return in;}
63  };
64 
65 public:
66  PitchSchedule(void);
67  ~PitchSchedule(void);
68 
69  double GetTargetPitch();
70  double GetTMECO(){return 0;};
71  void SetApses(double a, double b){};
72  bool IsValid(){return isValid;};
73 
74 private:
75  void ReadPitches(char *filename);
76  bool isValid;
77 
78 private:
79  ifstream file;
80  list<AltitudePitchPair> pitches;
81 };