JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGGroundCallback.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGGroundCallback.cpp
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
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 
26 HISTORY
27 -------------------------------------------------------------------------------
28 05/21/00 MF Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #include "math/FGLocation.h"
35 #include "FGGroundCallback.h"
36 
37 namespace JSBSim {
38 
39 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 
41 double FGDefaultGroundCallback::GetAGLevel(double t, const FGLocation& loc,
42  FGLocation& contact, FGColumnVector3& normal,
43  FGColumnVector3& vel, FGColumnVector3& angularVel) const
44 {
45  vel.InitMatrix();
46  angularVel.InitMatrix();
47  FGLocation l = loc;
48  l.SetEllipse(a,b);
49  double latitude = l.GetGeodLatitudeRad();
50  double cosLat = cos(latitude);
51  double longitude = l.GetLongitude();
52  normal = FGColumnVector3(cosLat*cos(longitude), cosLat*sin(longitude),
53  sin(latitude));
54  contact.SetEllipse(a, b);
55  contact.SetPositionGeodetic(longitude, latitude, mTerrainElevation);
56  return l.GetGeodAltitude() - mTerrainElevation;
57 }
58 
59 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 
61 } // namespace JSBSim
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGLocation
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF).
Definition: FGLocation.h:151
JSBSim::FGDefaultGroundCallback::GetAGLevel
double GetAGLevel(double t, const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const override
Compute the altitude above ground.
Definition: FGGroundCallback.cpp:41
JSBSim::FGLocation::GetLongitude
double GetLongitude() const
Get the longitude.
Definition: FGLocation.h:234
JSBSim::FGLocation::GetGeodLatitudeRad
double GetGeodLatitudeRad(void) const
Get the GEODETIC latitude in radians.
Definition: FGLocation.h:258
JSBSim::FGLocation::SetPositionGeodetic
void SetPositionGeodetic(double lon, double lat, double height)
Sets the longitude, latitude and the distance above the reference spheroid.
Definition: FGLocation.cpp:241
JSBSim::FGLocation::SetEllipse
void SetEllipse(double semimajor, double semiminor)
Sets the semimajor and semiminor axis lengths for this planet.
Definition: FGLocation.cpp:257
JSBSim::FGLocation::GetGeodAltitude
double GetGeodAltitude(void) const
Gets the geodetic altitude in feet.
Definition: FGLocation.h:279