Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
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 "RefCountingObject.h"
27
28namespace RoR {
29
32
35
36class Autopilot : public RefCountingObject<Autopilot>
37{
38public:
39 enum
40 {
45 };
46
47 enum
48 {
51 ALT_VS
52 };
53
56
57 Autopilot(int actor_id);
58 void reset();
59 void disconnect();
61 void setForceDisabled(bool disabled);
62 void setInertialReferences(node_t* refl, node_t* refr, node_t* refb, node_t* refc);
63 int toggleHeading(int mode);
64 int toggleAlt(int mode);
65 bool toggleIAS();
66 bool toggleGPWS();
67 int adjHDG(int d);
68 int adjALT(int d);
69 int adjVS(int d);
70 int adjIAS(int d);
71
72 float getAilerons();
73 float getElevator();
74 float getRudder();
75 float getThrottle(float thrtl, float dt);
76
77 void gpws_update(float spawnheight);
78
79 void UpdateIls();
83 int GetHeadingMode() const { return mode_heading; }
84 int GetHeadingValue() const { return heading; }
85 int GetAltMode() const { return mode_alt; }
86 int GetAltValue() const { return alt; }
87 bool GetIasMode() const { return mode_ias; }
88 int GetIasValue() const { return ias; }
89 bool GetGpwsMode() const { return mode_gpws; }
90 int GetVsValue() const { return vs; }
91private:
92
93 // When true, this prevents the default A/P from controlling the aircraft and
94 // disables the default logic (such as the A/P disengaging when NAV is engaged
95 // and ILS is not available).
96 // Allows custom autopilot scripts to use all the A/P settings and operate the
97 // controls without conflicts from the default A/P.
99
104 int alt;
105 int vs;
106 int ias;
111 float ref_span;
117
125
127};
128
131
132} // namespace RoR
Central state/object manager and communications hub.
Self reference-counting objects, as requred by AngelScript garbage collector.
int toggleHeading(int mode)
float getRudder()
float m_ils_runway_distance
Definition AutoPilot.h:123
void setInertialReferences(node_t *refl, node_t *refr, node_t *refb, node_t *refc)
Definition AutoPilot.cpp:88
int adjALT(int d)
float m_ils_runway_heading
Definition AutoPilot.h:122
int adjIAS(int d)
float getAilerons()
Definition AutoPilot.cpp:97
float last_closest_hdist
Definition AutoPilot.h:124
int GetVsValue() const
Definition AutoPilot.h:90
void gpws_update(float spawnheight)
float GetHorizontalApproachDeviation()
Definition AutoPilot.h:81
node_t * ref_r
Definition AutoPilot.h:108
float last_aileron
Definition AutoPilot.h:113
node_t * ref_c
Definition AutoPilot.h:110
int GetAltValue() const
Definition AutoPilot.h:86
float m_ils_angle_hdev
Definition AutoPilot.h:121
int adjVS(int d)
bool m_vertical_locator_available
Definition AutoPilot.h:118
int GetIasValue() const
Definition AutoPilot.h:88
node_t * ref_b
Definition AutoPilot.h:109
int GetHeadingValue() const
Definition AutoPilot.h:84
bool GetGpwsMode() const
Definition AutoPilot.h:89
bool GetIasMode() const
Definition AutoPilot.h:87
bool getForceDisabled()
Definition AutoPilot.h:60
float last_gpws_height
Definition AutoPilot.h:115
int GetAltMode() const
Definition AutoPilot.h:85
bool m_horizontal_locator_available
Definition AutoPilot.h:119
int GetHeadingMode() const
Definition AutoPilot.h:83
float m_ils_angle_vdev
Definition AutoPilot.h:120
float GetVerticalApproachDeviation()
Definition AutoPilot.h:80
float last_elevator
Definition AutoPilot.h:112
float last_pullup_height
Definition AutoPilot.h:116
float getElevator()
bool wantsdisconnect
Definition AutoPilot.h:55
void setForceDisabled(bool disabled)
Definition AutoPilot.cpp:83
node_t * ref_l
Definition AutoPilot.h:107
int adjHDG(int d)
bool IsIlsAvailable()
Definition AutoPilot.h:82
void disconnect()
Definition AutoPilot.cpp:71
float last_rudder
Definition AutoPilot.h:114
float getThrottle(float thrtl, float dt)
bool force_disabled
Definition AutoPilot.h:98
int toggleAlt(int mode)
Physics: A vertex in the softbody structure.
Definition SimData.h:260