RigsofRods
Soft-body Physics Simulation
AutoPilot.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5 
6  For more information, see http://www.rigsofrods.org/
7 
8  Rigs of Rods is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License version 3, as
10  published by the Free Software Foundation.
11 
12  Rigs of Rods is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #pragma once
22 
23 #include "Application.h"
24 #include "TerrainObjectManager.h"
25 
26 namespace RoR {
27 
30 
33 
34 class Autopilot
35 {
36 public:
37 
38  enum
39  {
44  };
45 
46  enum
47  {
51  };
52 
53  int heading;
55 
56  Autopilot(int actor_id);
57  void reset();
58  void disconnect();
59  void setInertialReferences(node_t* refl, node_t* refr, node_t* refb, node_t* refc);
60  int toggleHeading(int mode);
61  int toggleAlt(int mode);
62  bool toggleIAS();
63  bool toggleGPWS();
64  int adjHDG(int d);
65  int adjALT(int d);
66  int adjVS(int d);
67  int adjIAS(int d);
68 
69  float getAilerons();
70  float getElevator();
71  float getRudder();
72  float getThrottle(float thrtl, float dt);
73 
74  void gpws_update(float spawnheight);
75 
76  void UpdateIls(std::vector<RoR::TerrainObjectManager::localizer_t> localizers);
80  int GetHeadingMode() const { return mode_heading; }
81  int GetAltMode() const { return mode_alt; }
82  int GetAltValue() const { return alt; }
83  bool GetIasMode() const { return mode_ias; }
84  int GetIasValue() const { return ias; }
85  bool GetGpwsMode() const { return mode_gpws; }
86  int GetVsValue() const { return vs; }
87 private:
88 
90  int mode_alt;
91  bool mode_ias;
92  bool mode_gpws;
93  int alt;
94  int vs;
95  int ias;
100  float ref_span;
103  float last_rudder;
106 
114 
116 };
117 
120 
121 } // namespace RoR
RoR::Autopilot::setInertialReferences
void setInertialReferences(node_t *refl, node_t *refr, node_t *refb, node_t *refc)
Definition: AutoPilot.cpp:82
RoR::Autopilot::GetVerticalApproachDeviation
float GetVerticalApproachDeviation()
Definition: AutoPilot.h:77
RoR::Autopilot::getThrottle
float getThrottle(float thrtl, float dt)
Definition: AutoPilot.cpp:225
RoR::Autopilot::m_ils_runway_heading
float m_ils_runway_heading
Definition: AutoPilot.h:111
RoR::Autopilot::GetAltMode
int GetAltMode() const
Definition: AutoPilot.h:81
RoR::Autopilot::UpdateIls
void UpdateIls(std::vector< RoR::TerrainObjectManager::localizer_t > localizers)
Definition: AutoPilot.cpp:363
RoR::Autopilot::last_pullup_height
float last_pullup_height
Definition: AutoPilot.h:105
RoR::Autopilot::heading
int heading
Definition: AutoPilot.h:53
RoR::Autopilot::HEADING_FIXED
@ HEADING_FIXED
Definition: AutoPilot.h:41
RoR::Autopilot::last_rudder
float last_rudder
Definition: AutoPilot.h:103
RoR::Autopilot::Autopilot
Autopilot(int actor_id)
Definition: AutoPilot.cpp:33
RoR::Autopilot::ALT_FIXED
@ ALT_FIXED
Definition: AutoPilot.h:49
RoR::Autopilot::GetHeadingMode
int GetHeadingMode() const
Definition: AutoPilot.h:80
RoR::Autopilot::vs
int vs
Definition: AutoPilot.h:94
TerrainObjectManager.h
RoR::Autopilot::GetIasValue
int GetIasValue() const
Definition: AutoPilot.h:84
RoR::Autopilot::ref_span
float ref_span
Definition: AutoPilot.h:100
RoR::Autopilot::m_horizontal_locator_available
bool m_horizontal_locator_available
Definition: AutoPilot.h:108
RoR::Autopilot::gpws_update
void gpws_update(float spawnheight)
Definition: AutoPilot.cpp:322
RoR::Autopilot::toggleHeading
int toggleHeading(int mode)
Definition: AutoPilot.cpp:256
RoR::Autopilot::mode_ias
bool mode_ias
Definition: AutoPilot.h:91
RoR::Autopilot::m_ils_runway_distance
float m_ils_runway_distance
Definition: AutoPilot.h:112
RoR::Autopilot::m_actor_id
int m_actor_id
Definition: AutoPilot.h:115
RoR::Autopilot::toggleAlt
int toggleAlt(int mode)
Definition: AutoPilot.cpp:265
RoR::Autopilot::ref_b
node_t * ref_b
Definition: AutoPilot.h:98
RoR::Autopilot::ALT_VS
@ ALT_VS
Definition: AutoPilot.h:50
RoR::Autopilot::last_closest_hdist
float last_closest_hdist
Definition: AutoPilot.h:113
RoR::Autopilot::adjVS
int adjVS(int d)
Definition: AutoPilot.cpp:302
RoR::Autopilot
Definition: AutoPilot.h:34
RoR::Autopilot::getRudder
float getRudder()
Definition: AutoPilot.cpp:220
RoR::Autopilot::getElevator
float getElevator()
Definition: AutoPilot.cpp:163
RoR::Autopilot::ias
int ias
Definition: AutoPilot.h:95
RoR::Autopilot::adjHDG
int adjHDG(int d)
Definition: AutoPilot.cpp:286
RoR::Autopilot::m_vertical_locator_available
bool m_vertical_locator_available
Definition: AutoPilot.h:107
RoR::Autopilot::disconnect
void disconnect()
Definition: AutoPilot.cpp:70
RoR::Autopilot::wantsdisconnect
bool wantsdisconnect
Definition: AutoPilot.h:54
RoR::Autopilot::IsIlsAvailable
bool IsIlsAvailable()
Definition: AutoPilot.h:79
RoR::Autopilot::HEADING_WLV
@ HEADING_WLV
Definition: AutoPilot.h:42
RoR::Autopilot::reset
void reset()
Definition: AutoPilot.cpp:44
Application.h
Central state/object manager and communications hub.
RoR::node_t
Physics: A vertex in the softbody structure.
Definition: SimData.h:286
RoR::Autopilot::adjALT
int adjALT(int d)
Definition: AutoPilot.cpp:296
RoR::Autopilot::toggleIAS
bool toggleIAS()
Definition: AutoPilot.cpp:274
RoR::Autopilot::ref_c
node_t * ref_c
Definition: AutoPilot.h:99
RoR::Autopilot::alt
int alt
Definition: AutoPilot.h:93
RoR::Autopilot::mode_gpws
bool mode_gpws
Definition: AutoPilot.h:92
RoR::Autopilot::mode_heading
int mode_heading
Definition: AutoPilot.h:89
RoR::Autopilot::last_aileron
float last_aileron
Definition: AutoPilot.h:102
RoR::Autopilot::GetVsValue
int GetVsValue() const
Definition: AutoPilot.h:86
RoR::Autopilot::adjIAS
int adjIAS(int d)
Definition: AutoPilot.cpp:312
RoR::Autopilot::toggleGPWS
bool toggleGPWS()
Definition: AutoPilot.cpp:280
RoR::Autopilot::HEADING_NONE
@ HEADING_NONE
Definition: AutoPilot.h:40
RoR::Autopilot::GetAltValue
int GetAltValue() const
Definition: AutoPilot.h:82
RoR::Autopilot::ref_l
node_t * ref_l
Definition: AutoPilot.h:96
RoR::Autopilot::GetHorizontalApproachDeviation
float GetHorizontalApproachDeviation()
Definition: AutoPilot.h:78
RoR::Autopilot::HEADING_NAV
@ HEADING_NAV
Definition: AutoPilot.h:43
RoR::Autopilot::ALT_NONE
@ ALT_NONE
Definition: AutoPilot.h:48
RoR::Autopilot::m_ils_angle_vdev
float m_ils_angle_vdev
Definition: AutoPilot.h:109
RoR::Autopilot::last_elevator
float last_elevator
Definition: AutoPilot.h:101
RoR::Autopilot::GetIasMode
bool GetIasMode() const
Definition: AutoPilot.h:83
RoR::Autopilot::last_gpws_height
float last_gpws_height
Definition: AutoPilot.h:104
RoR::Autopilot::mode_alt
int mode_alt
Definition: AutoPilot.h:90
RoR::Autopilot::ref_r
node_t * ref_r
Definition: AutoPilot.h:97
RoR::Autopilot::GetGpwsMode
bool GetGpwsMode() const
Definition: AutoPilot.h:85
RoR
Definition: AppContext.h:36
RoR::Autopilot::getAilerons
float getAilerons()
Definition: AutoPilot.cpp:91
RoR::Autopilot::m_ils_angle_hdev
float m_ils_angle_hdev
Definition: AutoPilot.h:110