JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGGroundCallback.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGGroundCallback.h
4  Author: Mathias Froehlich
5  Date started: 05/21/04
6 
7  ------ Copyright (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) -------
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 Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  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 with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 -------------------------------------------------------------------------------
28 05/21/00 MF Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGGROUNDCALLBACK_H
35 #define FGGROUNDCALLBACK_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "simgear/structure/SGReferenced.hxx"
42 #include "simgear/structure/SGSharedPtr.hxx"
43 
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 DEFINITIONS
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 
48 #define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.18 2014/11/30 12:35:32 bcoconni Exp $"
49 
50 namespace JSBSim {
51 
52 class FGLocation;
53 class FGColumnVector3;
54 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
68 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 CLASS DECLARATION
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 
72 class FGGroundCallback : public SGReferenced
73 {
74 public:
75 
76  FGGroundCallback() : time(0.0) {}
77  virtual ~FGGroundCallback() {}
78 
82  virtual double GetAltitude(const FGLocation& l) const = 0;
83 
94  virtual double GetAGLevel(double t, const FGLocation& location,
95  FGLocation& contact,
96  FGColumnVector3& normal, FGColumnVector3& v,
97  FGColumnVector3& w) const = 0;
98 
108  virtual double GetAGLevel(const FGLocation& location, FGLocation& contact,
109  FGColumnVector3& normal, FGColumnVector3& v,
110  FGColumnVector3& w) const
111  { return GetAGLevel(time, location, contact, normal, v, w); }
112 
117  virtual double GetTerrainGeoCentRadius(double t, const FGLocation& location) const = 0;
118 
122  virtual double GetTerrainGeoCentRadius(const FGLocation& location) const
123  { return GetTerrainGeoCentRadius(time, location); }
124 
128  virtual double GetSeaLevelRadius(const FGLocation& location) const = 0;
129 
134  virtual void SetTerrainGeoCentRadius(double radius) { }
135 
140  virtual void SetSeaLevelRadius(double radius) { }
141 
142  void SetTime(double _time) { time = _time; }
143 
144 private:
145  double time;
146 };
147 
148 typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr;
149 
150 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151 // The default sphere earth implementation:
152 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 
155 {
156 public:
157 
158  // This should not be hardcoded, but retrieved from FGInertial
159  FGDefaultGroundCallback(double referenceRadius);
160 
161  double GetAltitude(const FGLocation& l) const;
162 
163  double GetAGLevel(double t, const FGLocation& location,
164  FGLocation& contact,
165  FGColumnVector3& normal, FGColumnVector3& v,
166  FGColumnVector3& w) const;
167 
168  void SetTerrainGeoCentRadius(double radius) { mTerrainLevelRadius = radius;}
169  double GetTerrainGeoCentRadius(double t, const FGLocation& location) const
170  { return mTerrainLevelRadius; }
171 
172  void SetSeaLevelRadius(double radius) { mSeaLevelRadius = radius; }
173  double GetSeaLevelRadius(const FGLocation& location) const
174  {return mSeaLevelRadius; }
175 
176 private:
177 
178  double mSeaLevelRadius;
179  double mTerrainLevelRadius;
180 };
181 
182 
183 }
184 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185 #endif
virtual double GetTerrainGeoCentRadius(double t, const FGLocation &location) const =0
Compute the local terrain radius.
void SetTerrainGeoCentRadius(double radius)
Set the local terrain radius.
This class provides callback slots to get ground specific data.
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF)...
Definition: FGLocation.h:160
virtual double GetAGLevel(const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const
Compute the altitude above ground.
virtual void SetSeaLevelRadius(double radius)
Set the sea level radius.
void SetSeaLevelRadius(double radius)
Set the sea level radius.
double GetTerrainGeoCentRadius(double t, const FGLocation &location) const
Compute the local terrain radius.
virtual double GetTerrainGeoCentRadius(const FGLocation &location) const
Compute the local terrain radius.
virtual double GetAltitude(const FGLocation &l) const =0
Compute the altitude above sealevel.
double GetSeaLevelRadius(const FGLocation &location) const
Return the sea level radius.
This class implements a 3 element column vector.
virtual double GetSeaLevelRadius(const FGLocation &location) const =0
Return the sea level radius.
virtual double GetAGLevel(double t, const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const =0
Compute the altitude above ground.
virtual void SetTerrainGeoCentRadius(double radius)
Set the local terrain radius.