android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / Computer / CirclingComputer.hpp
blobb5f19dacf80f909da4cb1a2c396662e83032ed2c
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef XCSOAR_CIRCLING_COMPUTER_HPP
25 #define XCSOAR_CIRCLING_COMPUTER_HPP
27 #include "Math/fixed.hpp"
28 #include "Geo/GeoPoint.hpp"
29 #include "DeltaTime.hpp"
31 struct CirclingInfo;
32 struct NMEAInfo;
33 struct MoreData;
34 struct DerivedInfo;
35 struct CirclingSettings;
36 struct FlyingState;
38 /**
39 * Detect when the aircraft begins or ends circling.
41 * Dependencies: #FlyingComputer.
43 class CirclingComputer {
44 DeltaTime turn_rate_delta_time;
46 Angle last_track, last_heading;
48 DeltaTime turning_delta_time;
50 /**
51 * Start/end time of the turn.
53 fixed turn_start_time;
55 /**
56 * Start/end location of the turn.
58 GeoPoint turn_start_location;
60 /**
61 * Start/end energy height of the turn.
63 fixed turn_start_energy_height;
65 /**
66 * Start/end altitude of the turn.
68 fixed turn_start_altitude;
70 DeltaTime percent_delta_time;
72 /**
73 * Minimum altitude since start of task.
75 fixed min_altitude;
77 public:
78 /**
79 * Reset this computer, as if a new flight starts.
81 void Reset();
83 /**
84 * Reset only statistics, to be called when the task starts, to
85 * eliminate the portion of the flight that is irrelevant to the
86 * task.
88 void ResetStats();
90 /**
91 * Calculates the turn rate
93 void TurnRate(CirclingInfo &circling_info,
94 const NMEAInfo &basic,
95 const FlyingState &flight);
97 /**
98 * Calculates the turn rate and the derived features.
99 * Determines the current flight mode (cruise/circling).
101 void Turning(CirclingInfo &circling_info,
102 const MoreData &basic,
103 const FlyingState &flight,
104 const CirclingSettings &settings);
107 * Calculate the circling time and percentage
109 void PercentCircling(const MoreData &basic,
110 CirclingInfo &circling_info);
112 void MaxHeightGain(const MoreData &basic, const FlyingState &flight,
113 CirclingInfo &circling_info);
116 #endif