All Classes Functions
OffPlaneCorrector.hpp
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 // Authors:
17 // Steve "agentgonzo" Arch - extending and coding concept
18 // Szymon "Enjo" Ender - small fixes and extending to direct ascent
19 //
20 // This module calculates the appropriate launch azimuth given
21 // desired orbital inclination and desired orbit altitude. This
22 // MFD takes the planets rotation into account, which provides a
23 // much more accurate azimuth. The calculations are performed
24 // 'on the fly' (technically and methaphorically), meaning that
25 // you get info about necessary course corrections.
26 //
27 // This file is part of LaunchMFD.
28 //
29 // LaunchMFD is free software: you can redistribute it and/or modify
30 // it under the terms of the GNU General Public License as published by
31 // the Free Software Foundation, either version 3 of the License, or
32 // (at your option) any later version.
33 //
34 // LaunchMFD is distributed in the hope that it will be useful,
35 // but WITHOUT ANY WARRANTY; without even the implied warranty of
36 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 // GNU General Public License for more details.
38 //
39 // You should have received a copy of the GNU General Public License
40 // along with LaunchMFD. If not, see <http://www.gnu.org/licenses/>.
41 // ==============================================================
42 
43 #ifndef OFFPLANECORRECTOR_HPP_INCLUDED
44 #define OFFPLANECORRECTOR_HPP_INCLUDED
45 
46 class MFDDataLaunchMFD;
47 
49 {
50 public:
52  double Calculate(char * tgt, MFDDataLaunchMFD * data );
53  double GetCorrectionAngle() const;
54  bool IsValid() const;
55 
56 protected:
57  virtual double CalculateClient( double timeToNode, MFDDataLaunchMFD * data ) = 0;
58  bool IsAbovePlane( double timeToNode, MFDDataLaunchMFD * data );
59  double GetCorrectionTimePositive( double tMeco, double timeToNode, MFDDataLaunchMFD * data, double limit );
60 
61 
62  bool isValid;
63  const double limit; // 45 degrees
64 private:
65  double AdjustSilencer( double adjust, MFDDataLaunchMFD * data ) const;
66  double correctionAngle;
67 };
68 
69 
70 #endif // OFFPLANECORRECTOR_HPP_INCLUDED