All Classes Functions
PitchRecorder.h
1 /* The PitchRecorder Class will record the pitch of a flight to a log file that can be used
2 ** for further pitch guidance.
3 ** It will save it in a file called Pitch-<BODY>-<VESSEL>.ini, where BODY is the GBody it is launching from
4 ** and VESSEL is the vessel type.
5 ** It will record the pitch every km of altitude until MECO
6 */
7 
8 // ==============================================================
9 // ORBITER MODULE: LaunchMFD
10 // Part of the ORBITER SDK
11 //
12 // Copyright (C) 2004 rjcroy - robust time based pitch autopilot (borrowed code)
13 // Copyright (C) 2004 Dave "Daver" Rowbotham - conversion of rjcroy's autopolot to C++ (borrowed code)
14 // Copyright (C) 2004 Erik H. "Sputnik" Anderson - conversion of the autopilot to energy based (borrowed code)
15 // Copyright (C) 2007 "Vanguard" - dressing up azimuth calcualtions into an MFD (author)
16 // Copyright (C) 2007 Pawel "She'da'Lier" Stiasny - yaw error visual representation (contributor)
17 // Copyright (C) 2008 Mohd "Computerex" Ali - borrowed his code (multiple vessels support) (borrowed code)
18 // Copyright (C) 2008 Chris "Kwan" Jeppesen - borrowed his code (peg guidance) (borrowed code)
19 // Copyright (C) 2008 Steve "agentgonzo" Arch - peg integration, offplane correction, compass, hud display (co-developer)
20 // Copyright (C) 2007-2012 Szymon "Enjo" Ender - everything else ;> (author and maintainer)
21 // All rights reserved
22 //
23 // PitchRecorder.h
24 // Authors - Steve "agentgonzo" Arch
25 //
26 // This module calculates the appropriate launch azimuth given
27 // desired orbital inclination and desired orbit altitude. This
28 // MFD takes the planets rotation into account, which provides a
29 // much more accurate azimuth. The calculations are performed
30 // 'on the fly' (technically and methaphorically), meaning that
31 // you get info about necessary course corrections.
32 //
33 // This file is part of LaunchMFD.
34 //
35 // LaunchMFD is free software: you can redistribute it and/or modify
36 // it under the terms of the GNU General Public License as published by
37 // the Free Software Foundation, either version 3 of the License, or
38 // (at your option) any later version.
39 //
40 // LaunchMFD is distributed in the hope that it will be useful,
41 // but WITHOUT ANY WARRANTY; without even the implied warranty of
42 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 // GNU General Public License for more details.
44 //
45 // You should have received a copy of the GNU General Public License
46 // along with LaunchMFD. If not, see <http://www.gnu.org/licenses/>.
47 // ==============================================================
48 
49 #pragma once
50 
51 #include "OrbiterSDK.h"
52 #include <fstream>
53 
54 using namespace std;
55 
57 {
58 public:
59  PitchRecorder(HWND hWnd);
60  ~PitchRecorder(void);
61 private:
62  void LogFileHeader();
63  void WriteAltitude(int altitude, double pitch);
64  static void CALLBACK AltitudeLoop(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
65  bool BeforeMECO();
66 
67 private:
68  int nextLogAltitude; // counter for the next altitude to take a pitch log of
69  OBJHANDLE gBody; // body vessel is launching from
70  VESSEL* vessel;
71  ofstream file;
72  HWND window;
73 };