JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGGyro.cpp
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Module: FGGyro.cpp
4 Author: Jon Berndt
5 Date started: 29 August 2009
6
7 ------------- Copyright (C) 2009 -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26FUNCTIONAL DESCRIPTION
27--------------------------------------------------------------------------------
28
29HISTORY
30--------------------------------------------------------------------------------
31
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33COMMENTS, REFERENCES, and NOTES
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35
36%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37INCLUDES
38%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40#include "FGGyro.h"
41#include "models/FGFCS.h"
42
43using namespace std;
44
45namespace JSBSim {
46
47/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48CLASS IMPLEMENTATION
49%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50
51FGGyro::FGGyro(FGFCS* fcs, Element* element)
52 : FGSensor(fcs, element),
53 FGSensorOrientation(element)
54{
55 Propagate = fcs->GetExec()->GetPropagate();
56
57 Debug(0);
58}
59
60//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61
62FGGyro::~FGGyro()
63{
64 Debug(1);
65}
66
67//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68
69bool FGGyro::Run(void )
70{
71 // There is no input assumed. This is a dedicated rotation rate sensor.
72
73 // get aircraft rates
74 Rates = Propagate->GetPQRi();
75
76 // transform to the specified orientation
77 vRates = mT * Rates;
78
79 Input = vRates(axis);
80
81 ProcessSensorSignal();
82
83 SetOutput();
84
85 return true;
86}
87
88//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89// The bitmasked value choices are as follows:
90// unset: In this case (the default) JSBSim would only print
91// out the normally expected messages, essentially echoing
92// the config files as they are read. If the environment
93// variable is not set, debug_lvl is set to 1 internally
94// 0: This requests JSBSim not to output any messages
95// whatsoever.
96// 1: This value explicitly requests the normal JSBSim
97// startup messages
98// 2: This value asks for a message to be printed out when
99// a class is instantiated
100// 4: When this value is set, a message is displayed when a
101// FGModel object executes its Run() method
102// 8: When this value is set, various runtime state variables
103// are printed out periodically
104// 16: When set various parameters are sanity checked and
105// a message is printed out when they go out of bounds
106
107void FGGyro::Debug(int from)
108{
109 string ax[4] = {"none", "X", "Y", "Z"};
110
111 if (debug_lvl <= 0) return;
112
113 if (debug_lvl & 1) { // Standard console startup message output
114 FGLogging log(LogLevel::DEBUG);
115 if (from == 0) { // Constructor
116 log << " Axis: " << ax[axis] << "\n";
117 }
118 }
119 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
120 FGLogging log(LogLevel::DEBUG);
121 if (from == 0) log << "Instantiated: FGGyro\n";
122 if (from == 1) log << "Destroyed: FGGyro\n";
123 }
124 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
125 }
126 if (debug_lvl & 8 ) { // Runtime state variables
127 }
128 if (debug_lvl & 16) { // Sanity checking
129 }
130 if (debug_lvl & 64) {
131 if (from == 0) { // Constructor
132 }
133 }
134}
135}
Main namespace for the JSBSim Flight Dynamics Model.
Definition FGFDMExec.cpp:71