From 4d49329dee736e43286485dc97a0187e60be7224 Mon Sep 17 00:00:00 2001
From: Stuart Buchanan
Date: Thu, 24 Nov 2011 22:28:10 +0000
Subject: [PATCH 01/16] Remove 3d clouds reliance on
/sim/rendering/shader-effects
---
src/Environment/environment_mgr.cxx | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx
index 18015d6cf..312d52129 100644
--- a/src/Environment/environment_mgr.cxx
+++ b/src/Environment/environment_mgr.cxx
@@ -55,16 +55,12 @@ public:
private:
FGClouds * _fgClouds;
- SGPropertyNode_ptr _shaderNode;
SGPropertyNode_ptr _enableNode;
};
FG3DCloudsListener::FG3DCloudsListener( FGClouds * fgClouds ) :
_fgClouds( fgClouds )
{
- _shaderNode = fgGetNode( "/sim/rendering/shader-effects", true );
- _shaderNode->addChangeListener( this );
-
_enableNode = fgGetNode( "/sim/rendering/clouds3d-enable", true );
_enableNode->addChangeListener( this );
@@ -74,12 +70,11 @@ FG3DCloudsListener::FG3DCloudsListener( FGClouds * fgClouds ) :
FG3DCloudsListener::~FG3DCloudsListener()
{
_enableNode->removeChangeListener( this );
- _shaderNode->removeChangeListener( this );
}
void FG3DCloudsListener::valueChanged( SGPropertyNode * node )
{
- _fgClouds->set_3dClouds( _enableNode->getBoolValue() && _shaderNode->getBoolValue() );
+ _fgClouds->set_3dClouds( _enableNode->getBoolValue() );
}
FGEnvironmentMgr::FGEnvironmentMgr () :
From 3027424e3e0f02aa0417d47361638927a2baa005 Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Fri, 25 Nov 2011 12:12:38 +0100
Subject: [PATCH 02/16] cmake: rename script to avoid downgrading Use local
copy of cmake script only for older cmake versions
---
CMakeModules/GNUInstallDirs.cmake | 182 ------------------------------
man/CMakeLists.txt | 8 +-
2 files changed, 7 insertions(+), 183 deletions(-)
delete mode 100644 CMakeModules/GNUInstallDirs.cmake
diff --git a/CMakeModules/GNUInstallDirs.cmake b/CMakeModules/GNUInstallDirs.cmake
deleted file mode 100644
index a114dcb2e..000000000
--- a/CMakeModules/GNUInstallDirs.cmake
+++ /dev/null
@@ -1,182 +0,0 @@
-# - Define GNU standard installation directories
-# Provides install directory variables as defined for GNU software:
-# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
-# Inclusion of this module defines the following variables:
-# CMAKE_INSTALL_ - destination for files of a given type
-# CMAKE_INSTALL_FULL_ - corresponding absolute path
-# where is one of:
-# BINDIR - user executables (bin)
-# SBINDIR - system admin executables (sbin)
-# LIBEXECDIR - program executables (libexec)
-# SYSCONFDIR - read-only single-machine data (etc)
-# SHAREDSTATEDIR - modifiable architecture-independent data (com)
-# LOCALSTATEDIR - modifiable single-machine data (var)
-# LIBDIR - object code libraries (lib or lib64)
-# INCLUDEDIR - C header files (include)
-# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
-# DATAROOTDIR - read-only architecture-independent data root (share)
-# DATADIR - read-only architecture-independent data (DATAROOTDIR)
-# INFODIR - info documentation (DATAROOTDIR/info)
-# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
-# MANDIR - man documentation (DATAROOTDIR/man)
-# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
-# Each CMAKE_INSTALL_ value may be passed to the DESTINATION options of
-# install() commands for the corresponding file type. If the includer does
-# not define a value the above-shown default will be used and the value will
-# appear in the cache for editing by the user.
-# Each CMAKE_INSTALL_FULL_ value contains an absolute path constructed
-# from the corresponding destination by prepending (if necessary) the value
-# of CMAKE_INSTALL_PREFIX.
-
-#=============================================================================
-# Copyright 2011 Nikita Krupen'ko
-# Copyright 2011 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Installation directories
-#
-if(NOT DEFINED CMAKE_INSTALL_BINDIR)
- set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
- set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
- set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
- set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
- set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
- set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
- set(_LIBDIR_DEFAULT "lib")
- # Override this default 'lib' with 'lib64' iff:
- # - we are on Linux system but NOT cross-compiling
- # - we are NOT on debian
- # - we are on a 64 bits system
- # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
- # Note that the future of multi-arch handling may be even
- # more complicated than that: http://wiki.debian.org/Multiarch
- if(CMAKE_SYSTEM_NAME MATCHES "Linux"
- AND NOT CMAKE_CROSSCOMPILING
- AND NOT EXISTS "/etc/debian_version")
- if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
- message(AUTHOR_WARNING
- "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
- "Please enable at least one language before including GNUInstallDirs.")
- else()
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
- set(_LIBDIR_DEFAULT "lib64")
- endif()
- endif()
- endif()
- set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
- set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
- set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
- set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
-endif()
-
-#-----------------------------------------------------------------------------
-# Values whose defaults are relative to DATAROOTDIR. Store empty values in
-# the cache and store the defaults in local variables if the cache values are
-# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
-
-if(NOT CMAKE_INSTALL_DATADIR)
- set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
- set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
-endif()
-
-if(NOT CMAKE_INSTALL_INFODIR)
- set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
- set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
-endif()
-
-if(NOT CMAKE_INSTALL_LOCALEDIR)
- set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
- set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
-endif()
-
-if(NOT CMAKE_INSTALL_MANDIR)
- set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
- set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
-endif()
-
-if(NOT CMAKE_INSTALL_DOCDIR)
- set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
- set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
-endif()
-
-#-----------------------------------------------------------------------------
-
-mark_as_advanced(
- CMAKE_INSTALL_BINDIR
- CMAKE_INSTALL_SBINDIR
- CMAKE_INSTALL_LIBEXECDIR
- CMAKE_INSTALL_SYSCONFDIR
- CMAKE_INSTALL_SHAREDSTATEDIR
- CMAKE_INSTALL_LOCALSTATEDIR
- CMAKE_INSTALL_LIBDIR
- CMAKE_INSTALL_INCLUDEDIR
- CMAKE_INSTALL_OLDINCLUDEDIR
- CMAKE_INSTALL_DATAROOTDIR
- CMAKE_INSTALL_DATADIR
- CMAKE_INSTALL_INFODIR
- CMAKE_INSTALL_LOCALEDIR
- CMAKE_INSTALL_MANDIR
- CMAKE_INSTALL_DOCDIR
- )
-
-# Result directories
-#
-foreach(dir
- BINDIR
- SBINDIR
- LIBEXECDIR
- SYSCONFDIR
- SHAREDSTATEDIR
- LOCALSTATEDIR
- LIBDIR
- INCLUDEDIR
- OLDINCLUDEDIR
- DATAROOTDIR
- DATADIR
- INFODIR
- LOCALEDIR
- MANDIR
- DOCDIR
- )
- if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
- else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
- endif()
-endforeach()
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 5011a831d..178595399 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,4 +1,10 @@
-include(GNUInstallDirs)
+if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
+ # use official include provided by latest CMake
+ include(GNUInstallDirs)
+else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
+ # backward compatibility: use our own module for older cmake versions
+ include(OldGNUInstallDirs)
+endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
set(MANPAGES
est-epsilon.1
From 1a28a933ba8f3d961f0b757864cc64a362825fdc Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Fri, 25 Nov 2011 12:14:57 +0100
Subject: [PATCH 03/16] Add missing file... (yikes!) What's wrong with "rename"
these days...
---
CMakeModules/OldGNUInstallDirs.cmake | 182 +++++++++++++++++++++++++++
1 file changed, 182 insertions(+)
create mode 100644 CMakeModules/OldGNUInstallDirs.cmake
diff --git a/CMakeModules/OldGNUInstallDirs.cmake b/CMakeModules/OldGNUInstallDirs.cmake
new file mode 100644
index 000000000..a114dcb2e
--- /dev/null
+++ b/CMakeModules/OldGNUInstallDirs.cmake
@@ -0,0 +1,182 @@
+# - Define GNU standard installation directories
+# Provides install directory variables as defined for GNU software:
+# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+# Inclusion of this module defines the following variables:
+# CMAKE_INSTALL_ - destination for files of a given type
+# CMAKE_INSTALL_FULL_ - corresponding absolute path
+# where is one of:
+# BINDIR - user executables (bin)
+# SBINDIR - system admin executables (sbin)
+# LIBEXECDIR - program executables (libexec)
+# SYSCONFDIR - read-only single-machine data (etc)
+# SHAREDSTATEDIR - modifiable architecture-independent data (com)
+# LOCALSTATEDIR - modifiable single-machine data (var)
+# LIBDIR - object code libraries (lib or lib64)
+# INCLUDEDIR - C header files (include)
+# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
+# DATAROOTDIR - read-only architecture-independent data root (share)
+# DATADIR - read-only architecture-independent data (DATAROOTDIR)
+# INFODIR - info documentation (DATAROOTDIR/info)
+# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
+# MANDIR - man documentation (DATAROOTDIR/man)
+# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
+# Each CMAKE_INSTALL_ value may be passed to the DESTINATION options of
+# install() commands for the corresponding file type. If the includer does
+# not define a value the above-shown default will be used and the value will
+# appear in the cache for editing by the user.
+# Each CMAKE_INSTALL_FULL_ value contains an absolute path constructed
+# from the corresponding destination by prepending (if necessary) the value
+# of CMAKE_INSTALL_PREFIX.
+
+#=============================================================================
+# Copyright 2011 Nikita Krupen'ko
+# Copyright 2011 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Installation directories
+#
+if(NOT DEFINED CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
+ set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
+ set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
+ set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
+ set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
+ set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(_LIBDIR_DEFAULT "lib")
+ # Override this default 'lib' with 'lib64' iff:
+ # - we are on Linux system but NOT cross-compiling
+ # - we are NOT on debian
+ # - we are on a 64 bits system
+ # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+ # Note that the future of multi-arch handling may be even
+ # more complicated than that: http://wiki.debian.org/Multiarch
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ AND NOT CMAKE_CROSSCOMPILING
+ AND NOT EXISTS "/etc/debian_version")
+ if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
+ message(AUTHOR_WARNING
+ "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
+ "Please enable at least one language before including GNUInstallDirs.")
+ else()
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(_LIBDIR_DEFAULT "lib64")
+ endif()
+ endif()
+ endif()
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
+ set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
+ set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
+endif()
+
+#-----------------------------------------------------------------------------
+# Values whose defaults are relative to DATAROOTDIR. Store empty values in
+# the cache and store the defaults in local variables if the cache values are
+# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
+
+if(NOT CMAKE_INSTALL_DATADIR)
+ set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
+ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
+endif()
+
+if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
+ set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+endif()
+
+if(NOT CMAKE_INSTALL_LOCALEDIR)
+ set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
+ set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
+endif()
+
+if(NOT CMAKE_INSTALL_MANDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
+ set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
+endif()
+
+if(NOT CMAKE_INSTALL_DOCDIR)
+ set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
+ set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
+endif()
+
+#-----------------------------------------------------------------------------
+
+mark_as_advanced(
+ CMAKE_INSTALL_BINDIR
+ CMAKE_INSTALL_SBINDIR
+ CMAKE_INSTALL_LIBEXECDIR
+ CMAKE_INSTALL_SYSCONFDIR
+ CMAKE_INSTALL_SHAREDSTATEDIR
+ CMAKE_INSTALL_LOCALSTATEDIR
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_INCLUDEDIR
+ CMAKE_INSTALL_OLDINCLUDEDIR
+ CMAKE_INSTALL_DATAROOTDIR
+ CMAKE_INSTALL_DATADIR
+ CMAKE_INSTALL_INFODIR
+ CMAKE_INSTALL_LOCALEDIR
+ CMAKE_INSTALL_MANDIR
+ CMAKE_INSTALL_DOCDIR
+ )
+
+# Result directories
+#
+foreach(dir
+ BINDIR
+ SBINDIR
+ LIBEXECDIR
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ LIBDIR
+ INCLUDEDIR
+ OLDINCLUDEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ MANDIR
+ DOCDIR
+ )
+ if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ endif()
+endforeach()
From 02c286bb0862f05c436bb62ecf0b63c938da75bf Mon Sep 17 00:00:00 2001
From: Erik Hofman
Date: Fri, 25 Nov 2011 13:38:08 +0100
Subject: [PATCH 04/16] Sync. With JSBSim CVS
---
src/FDM/JSBSim/FGFDMExec.cpp | 20 +--
src/FDM/JSBSim/FGFDMExec.h | 42 +++--
.../initialization/FGInitialCondition.cpp | 154 ++++++++++++++----
.../initialization/FGInitialCondition.h | 30 ++--
src/FDM/JSBSim/initialization/FGTrim.cpp | 4 +-
.../JSBSim/input_output/FGGroundCallback.h | 16 +-
src/FDM/JSBSim/input_output/FGScript.cpp | 4 +-
src/FDM/JSBSim/math/FGCondition.cpp | 8 +-
src/FDM/JSBSim/math/FGLocation.cpp | 9 +-
src/FDM/JSBSim/math/FGLocation.h | 75 ++++++++-
src/FDM/JSBSim/math/FGQuaternion.cpp | 6 +-
src/FDM/JSBSim/math/FGQuaternion.h | 7 +-
src/FDM/JSBSim/models/FGAccelerations.h | 6 +-
src/FDM/JSBSim/models/FGAircraft.h | 8 +-
src/FDM/JSBSim/models/FGAuxiliary.cpp | 32 +---
src/FDM/JSBSim/models/FGAuxiliary.h | 14 +-
src/FDM/JSBSim/models/FGBuoyantForces.cpp | 8 +-
src/FDM/JSBSim/models/FGBuoyantForces.h | 10 +-
src/FDM/JSBSim/models/FGExternalForce.cpp | 4 +-
src/FDM/JSBSim/models/FGExternalForce.h | 4 +-
src/FDM/JSBSim/models/FGExternalReactions.h | 6 +-
src/FDM/JSBSim/models/FGFCS.h | 20 +--
src/FDM/JSBSim/models/FGInertial.cpp | 4 +-
src/FDM/JSBSim/models/FGInertial.h | 6 +-
src/FDM/JSBSim/models/FGLGear.cpp | 13 +-
src/FDM/JSBSim/models/FGLGear.h | 28 ++--
src/FDM/JSBSim/models/FGMassBalance.cpp | 8 +-
src/FDM/JSBSim/models/FGMassBalance.h | 16 +-
src/FDM/JSBSim/models/FGOutput.h | 14 +-
src/FDM/JSBSim/models/FGPropagate.cpp | 64 ++------
src/FDM/JSBSim/models/FGPropagate.h | 34 ++--
src/FDM/JSBSim/models/FGPropulsion.cpp | 8 +-
src/FDM/JSBSim/models/FGPropulsion.h | 12 +-
src/FDM/JSBSim/models/atmosphere/FGWinds.cpp | 52 +++++-
src/FDM/JSBSim/models/atmosphere/FGWinds.h | 25 ++-
.../models/flight_control/FGFCSFunction.h | 14 +-
src/FDM/JSBSim/models/propulsion/FGEngine.cpp | 9 +-
src/FDM/JSBSim/models/propulsion/FGEngine.h | 34 ++--
src/FDM/JSBSim/models/propulsion/FGForce.cpp | 6 +-
src/FDM/JSBSim/models/propulsion/FGForce.h | 22 +--
.../JSBSim/models/propulsion/FGPropeller.cpp | 16 +-
.../JSBSim/models/propulsion/FGPropeller.h | 34 ++--
src/FDM/JSBSim/models/propulsion/FGTank.cpp | 8 +-
src/FDM/JSBSim/models/propulsion/FGTank.h | 32 ++--
44 files changed, 569 insertions(+), 377 deletions(-)
mode change 100644 => 100755 src/FDM/JSBSim/input_output/FGScript.cpp
mode change 100644 => 100755 src/FDM/JSBSim/models/FGAuxiliary.cpp
mode change 100644 => 100755 src/FDM/JSBSim/models/FGExternalForce.cpp
mode change 100644 => 100755 src/FDM/JSBSim/models/FGExternalForce.h
mode change 100644 => 100755 src/FDM/JSBSim/models/FGExternalReactions.h
mode change 100644 => 100755 src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp
index 570baf75f..d5c81f821 100644
--- a/src/FDM/JSBSim/FGFDMExec.cpp
+++ b/src/FDM/JSBSim/FGFDMExec.cpp
@@ -70,7 +70,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.118 2011/10/22 15:11:23 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.120 2011/11/10 12:06:13 jberndt Exp $";
static const char *IdHdr = ID_FDMEXEC;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -82,10 +82,9 @@ CLASS IMPLEMENTATION
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
{
-
Frame = 0;
Error = 0;
- GroundCallback = new FGDefaultGroundCallback();
+ SetGroundCallback(new FGDefaultGroundCallback());
IC = 0;
Trim = 0;
Script = 0;
@@ -186,9 +185,6 @@ FGFDMExec::~FGFDMExec()
if (FDMctr > 0) (*FDMctr)--;
- if(GroundCallback)
- delete GroundCallback;
-
Debug(1);
}
@@ -213,7 +209,7 @@ bool FGFDMExec::Allocate(void)
Models[ePropulsion] = new FGPropulsion(this);
Models[eAerodynamics] = new FGAerodynamics (this);
- GroundCallback->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius());
+ GetGroundCallback()->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius());
Models[eGroundReactions] = new FGGroundReactions(this);
Models[eExternalReactions] = new FGExternalReactions(this);
@@ -616,14 +612,6 @@ string FGFDMExec::GetOutputFileName(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFDMExec::SetGroundCallback(FGGroundCallback* p)
-{
- delete GroundCallback;
- GroundCallback = p;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
vector FGFDMExec::EnumerateFDMs(void)
{
vector FDMList;
@@ -1137,7 +1125,7 @@ void FGFDMExec::ForceOutput(int idx)
{
if (idx >= (int)0 && idx < (int)Outputs.size()) Outputs[idx]->Print();
}
-
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGFDMExec::SetOutputDirectives(const string& fname)
diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h
index 68dc380d1..2628a66ff 100644
--- a/src/FDM/JSBSim/FGFDMExec.h
+++ b/src/FDM/JSBSim/FGFDMExec.h
@@ -47,7 +47,6 @@ INCLUDES
#include "initialization/FGTrim.h"
#include "FGJSBBase.h"
#include "input_output/FGPropertyManager.h"
-#include "input_output/FGGroundCallback.h"
#include "input_output/FGXMLFileRead.h"
#include "models/FGPropagate.h"
#include "math/FGColumnVector3.h"
@@ -56,7 +55,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.72 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.74 2011/11/09 21:58:26 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -181,7 +180,7 @@ CLASS DOCUMENTATION
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
- @version $Revision: 1.72 $
+ @version $Revision: 1.74 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -268,10 +267,14 @@ public:
@return true if successful */
bool RunIC(void);
- /** Sets the ground callback pointer.
- @param gc A pointer to a ground callback object.
+ /** Sets the ground callback pointer. For optimal memory management, a shared
+ pointer is used internally that maintains a reference counter. The calling
+ application must therefore use FGGroundCallback_ptr 'smart pointers' to
+ manage their copy of the ground callback.
+ @param gc A pointer to a ground callback object
+ @see FGGroundCallback
*/
- void SetGroundCallback(FGGroundCallback* gc);
+ void SetGroundCallback(FGGroundCallback* gc) { FGLocation::SetGroundCallback(gc); }
/** Loads an aircraft model.
@param AircraftPath path to the aircraft/ directory. For instance:
@@ -328,7 +331,7 @@ public:
bool SetSystemsPath(const string& path) { SystemsPath = RootDir + path; return true; }
/// @name Top-level executive State and Model retrieval mechanism
- //@{
+ ///@{
/// Returns the FGAtmosphere pointer.
FGAtmosphere* GetAtmosphere(void) {return (FGAtmosphere*)Models[eAtmosphere];}
/// Returns the FGAccelerations pointer.
@@ -359,15 +362,19 @@ public:
FGAuxiliary* GetAuxiliary(void) {return (FGAuxiliary*)Models[eAuxiliary];}
/// Returns the FGInput pointer.
FGInput* GetInput(void) {return (FGInput*)Models[eInput];}
- /// Returns the FGGroundCallback pointer.
- FGGroundCallback* GetGroundCallback(void) {return GroundCallback;}
+ /** Get a pointer to the ground callback currently used. It is recommanded
+ to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
+ @return A pointer to the current ground callback object.
+ @see FGGroundCallback
+ */
+ FGGroundCallback* GetGroundCallback(void) {return FGLocation::GetGroundCallback();}
/// Retrieves the script object
FGScript* GetScript(void) {return Script;}
- // Returns a pointer to the FGInitialCondition object
+ /// Returns a pointer to the FGInitialCondition object
FGInitialCondition* GetIC(void) {return IC;}
- // Returns a pointer to the FGTrim object
+ /// Returns a pointer to the FGTrim object
FGTrim* GetTrim(void);
- //@}
+ ///@}
/// Retrieves the engine path.
const string& GetEnginePath(void) {return EnginePath;}
@@ -391,7 +398,7 @@ public:
}
/// Returns the model name.
- const string& GetModelName(void) { return modelName; }
+ const string& GetModelName(void) const { return modelName; }
/*
/// Returns the current time.
double GetSimTime(void);
@@ -404,9 +411,9 @@ public:
/// Returns a vector of strings representing the names of all loaded models (future)
vector EnumerateFDMs(void);
/// Gets the number of child FDMs.
- int GetFDMCount(void) {return (int)ChildFDMList.size();}
+ int GetFDMCount(void) const {return (int)ChildFDMList.size();}
/// Gets a particular child FDM.
- childData* GetChildFDM(int i) {return ChildFDMList[i];}
+ childData* GetChildFDM(int i) const {return ChildFDMList[i];}
/// Marks this instance of the Exec object as a "child" object.
void SetChild(bool ch) {IsChild = ch;}
@@ -503,7 +510,7 @@ public:
double GetSimTime(void) const { return sim_time; }
/// Returns the simulation delta T.
- double GetDeltaT(void) {return dT;}
+ double GetDeltaT(void) const {return dT;}
/// Suspends the simulation and sets the delta T to zero.
void SuspendIntegration(void) {saved_dT = dT; dT = 0.0;}
@@ -513,7 +520,7 @@ public:
/** Returns the simulation suspension state.
@return true if suspended, false if executing */
- bool IntegrationSuspended(void) {return dT == 0.0;}
+ bool IntegrationSuspended(void) const {return dT == 0.0;}
/** Sets the current sim time.
@param cur_time the current time
@@ -588,7 +595,6 @@ private:
bool trim_status;
int ta_mode;
- FGGroundCallback* GroundCallback;
FGScript* Script;
FGInitialCondition* IC;
FGTrim* Trim;
diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
index d787193f5..1706b3019 100644
--- a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
+++ b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
@@ -63,7 +63,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.75 2011/10/23 15:05:32 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.78 2011/11/09 21:57:51 bcoconni Exp $";
static const char *IdHdr = ID_INITIALCONDITION;
//******************************************************************************
@@ -109,13 +109,16 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
vPQR_body = FGColumnVector3(p0, q0, r0);
alpha = alpha0; beta = beta0;
- position.SetPosition(lonRad0, latRad0, altAGLFt0 + terrain_elevation + sea_level_radius);
+ position.SetLongitude(lonRad0);
+ position.SetLatitude(latRad0);
+ position.SetAltitudeAGL(altAGLFt0, fdmex->GetSimTime());
orientation = FGQuaternion(phi0, theta0, psi0);
const FGMatrix33& Tb2l = orientation.GetTInv();
vUVW_NED = Tb2l * FGColumnVector3(u0, v0, w0);
vt = vUVW_NED.Magnitude();
+ lastSpeedSet = setuvw;
Tw2b = FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
sbeta, cbeta, 0.0,
@@ -130,11 +133,12 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
void FGInitialCondition::InitializeIC(void)
{
alpha=beta=0;
- terrain_elevation = 0;
- sea_level_radius = fdmex->GetInertial()->GetRefRadius();
+
position.SetEllipse(fdmex->GetInertial()->GetSemimajor(), fdmex->GetInertial()->GetSemiminor());
- position.SetPosition(0., 0., sea_level_radius);
+
+ position.SetPositionGeodetic(0.0, 0.0, 0.0);
position.SetEarthPositionAngle(fdmex->GetPropagate()->GetEarthPositionAngle());
+
orientation = FGQuaternion(0.0, 0.0, 0.0);
vUVW_NED.InitMatrix();
vPQR_body.InitMatrix();
@@ -144,6 +148,9 @@ void FGInitialCondition::InitializeIC(void)
Tw2b.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
Tb2w.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
+
+ lastSpeedSet = setvt;
+ lastAltitudeSet = setasl;
}
//******************************************************************************
@@ -185,7 +192,7 @@ void FGInitialCondition::WriteStateFile(int num)
void FGInitialCondition::SetVequivalentKtsIC(double ve)
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double rho = Atmosphere->GetDensity(altitudeASL);
double rhoSL = Atmosphere->GetDensitySL();
SetVtrueFpsIC(ve*ktstofps*sqrt(rhoSL/rho));
@@ -196,7 +203,7 @@ void FGInitialCondition::SetVequivalentKtsIC(double ve)
void FGInitialCondition::SetMachIC(double mach)
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature);
SetVtrueFpsIC(mach*soundSpeed);
@@ -207,7 +214,7 @@ void FGInitialCondition::SetMachIC(double mach)
void FGInitialCondition::SetVcalibratedKtsIC(double vcas)
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL();
double rhoSL = Atmosphere->GetDensitySL();
@@ -671,6 +678,49 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
calcAeroAngles(_vt_NED);
}
+//******************************************************************************
+
+void FGInitialCondition::SetSeaLevelRadiusFtIC(double slr)
+{
+ fdmex->GetGroundCallback()->SetSeaLevelRadius(slr);
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetTerrainElevationFtIC(double elev)
+{
+ double agl = GetAltitudeAGLFtIC();
+
+ fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(elev + position.GetSeaLevelRadius());
+
+ if (lastAltitudeSet == setagl)
+ SetAltitudeAGLFtIC(agl);
+}
+
+//******************************************************************************
+
+double FGInitialCondition::GetAltitudeAGLFtIC(void) const
+{
+ return position.GetAltitudeAGL(fdmex->GetSimTime());
+}
+
+//******************************************************************************
+
+double FGInitialCondition::GetTerrainElevationFtIC(void) const
+{
+ return position.GetTerrainRadius(fdmex->GetSimTime())
+ - position.GetSeaLevelRadius();
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
+{
+ double terrainElevation = position.GetTerrainRadius(fdmex->GetSimTime()) - position.GetSeaLevelRadius();
+ SetAltitudeASLFtIC(agl + terrainElevation);
+ lastAltitudeSet = setagl;
+}
+
//******************************************************************************
// Set the altitude SL. If the airspeed has been previously set with parameters
// that are atmosphere dependent (Mach, VCAS, VEAS) then the true airspeed is
@@ -678,7 +728,7 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
void FGInitialCondition::SetAltitudeASLFtIC(double alt)
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL();
@@ -691,7 +741,7 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
double ve0 = vt * sqrt(rho/rhoSL);
altitudeASL=alt;
- position.SetRadius(alt + sea_level_radius);
+ position.SetAltitudeASL(alt);
temperature = Atmosphere->GetTemperature(altitudeASL);
soundSpeed = sqrt(SHRatio*Reng*temperature);
@@ -712,6 +762,47 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
default: // Make the compiler stop complaining about missing enums
break;
}
+
+ lastAltitudeSet = setasl;
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetLatitudeRadIC(double lat)
+{
+ double altitude;
+
+ switch(lastAltitudeSet) {
+ case setagl:
+ altitude = GetAltitudeAGLFtIC();
+ position.SetLatitude(lat);
+ SetAltitudeAGLFtIC(altitude);
+ break;
+ default:
+ altitude = position.GetAltitudeASL();
+ position.SetLatitude(lat);
+ position.SetAltitudeASL(altitude);
+ }
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetLongitudeRadIC(double lon)
+{
+ double altitude;
+
+ switch(lastAltitudeSet) {
+ case setagl:
+ altitude = GetAltitudeAGLFtIC();
+ position.SetLongitude(lon);
+ SetAltitudeAGLFtIC(altitude);
+ break;
+ default:
+ altitude = position.GetAltitudeASL();
+ position.SetLongitude(lon);
+ position.SetAltitudeASL(altitude);
+ break;
+ }
}
//******************************************************************************
@@ -764,7 +855,7 @@ double FGInitialCondition::GetBodyWindFpsIC(int idx) const
double FGInitialCondition::GetVcalibratedKtsIC(void) const
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL();
@@ -778,7 +869,7 @@ double FGInitialCondition::GetVcalibratedKtsIC(void) const
double FGInitialCondition::GetVequivalentKtsIC(void) const
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double rho = Atmosphere->GetDensity(altitudeASL);
double rhoSL = Atmosphere->GetDensitySL();
return fpstokts * vt * sqrt(rho/rhoSL);
@@ -788,7 +879,7 @@ double FGInitialCondition::GetVequivalentKtsIC(void) const
double FGInitialCondition::GetMachIC(void) const
{
- double altitudeASL = position.GetRadius() - sea_level_radius;
+ double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature);
return vt / soundSpeed;
@@ -868,18 +959,18 @@ bool FGInitialCondition::Load_v1(void)
bool result = true;
if (document->FindElement("latitude"))
- position.SetLatitude(document->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+ SetLatitudeRadIC(document->FindElementValueAsNumberConvertTo("latitude", "RAD"));
if (document->FindElement("longitude"))
- position.SetLongitude(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
+ SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
if (document->FindElement("elevation"))
- terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT");
+ SetTerrainElevationFtIC(document->FindElementValueAsNumberConvertTo("elevation", "FT"));
if (document->FindElement("altitude")) // This is feet above ground level
- position.SetRadius(document->FindElementValueAsNumberConvertTo("altitude", "FT") + terrain_elevation + sea_level_radius);
+ SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitude", "FT"));
else if (document->FindElement("altitudeAGL")) // This is feet above ground level
- position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT") + terrain_elevation + sea_level_radius);
+ SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
else if (document->FindElement("altitudeMSL")) // This is feet above sea level
- position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT") + sea_level_radius);
+ SetAltitudeASLFtIC(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
FGColumnVector3 vOrient = orientation.GetEuler();
@@ -957,9 +1048,6 @@ bool FGInitialCondition::Load_v2(void)
if (document->FindElement("earth_position_angle"))
position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD"));
- if (document->FindElement("elevation"))
- terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT");
-
// Initialize vehicle position
//
// Allowable frames:
@@ -974,20 +1062,25 @@ bool FGInitialCondition::Load_v2(void)
position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT");
} else if (frame == "ecef") {
if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) {
+
+ if (position_el->FindElement("longitude"))
+ position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
+
+ if (position_el->FindElement("latitude"))
+ position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+
if (position_el->FindElement("radius")) {
position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT"));
} else if (position_el->FindElement("altitudeAGL")) {
- position.SetRadius(sea_level_radius + terrain_elevation + position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
+ position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"),
+ fdmex->GetSimTime());
} else if (position_el->FindElement("altitudeMSL")) {
- position.SetRadius(sea_level_radius + position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
+ position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
} else {
cerr << endl << " No altitude or radius initial condition is given." << endl;
result = false;
}
- if (position_el->FindElement("longitude"))
- position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
- if (position_el->FindElement("latitude"))
- position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+
} else {
position = position_el->FindElementTripletConvertTo("FT");
}
@@ -1000,6 +1093,9 @@ bool FGInitialCondition::Load_v2(void)
result = false;
}
+ if (document->FindElement("elevation"))
+ fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(document->FindElementValueAsNumberConvertTo("elevation", "FT")+position.GetSeaLevelRadius());
+
// End of position initialization
// Initialize vehicle orientation
@@ -1101,8 +1197,10 @@ bool FGInitialCondition::Load_v2(void)
if (frame == "eci") {
FGColumnVector3 omega_cross_r = vOmegaEarth * (position.GetTec2i() * position);
vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r);
+ lastSpeedSet = setned;
} else if (frame == "ecef") {
vUVW_NED = mTec2l * vInitVelocity;
+ lastSpeedSet = setned;
} else if (frame == "local") {
vUVW_NED = vInitVelocity;
lastSpeedSet = setned;
diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.h b/src/FDM/JSBSim/initialization/FGInitialCondition.h
index 03f11f064..ce56991aa 100644
--- a/src/FDM/JSBSim/initialization/FGInitialCondition.h
+++ b/src/FDM/JSBSim/initialization/FGInitialCondition.h
@@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $"
+#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -68,6 +68,7 @@ class FGColumnVector3;
class FGAtmosphere;
typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
+typedef enum { setasl, setagl} altitudeset;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
@@ -214,7 +215,7 @@ CLASS DOCUMENTATION
@property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
@author Tony Peden
- @version "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $"
+ @version "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,24 +292,23 @@ public:
/** Sets the initial Altitude above ground level.
@param agl Altitude above ground level in feet */
- void SetAltitudeAGLFtIC(double agl)
- { SetAltitudeASLFtIC(terrain_elevation + agl); }
+ void SetAltitudeAGLFtIC(double agl);
/** Sets the initial sea level radius from planet center
@param sl_rad sea level radius in feet */
- void SetSeaLevelRadiusFtIC(double sl_rad) { sea_level_radius = sl_rad; }
+ void SetSeaLevelRadiusFtIC(double slr);
/** Sets the initial terrain elevation.
@param elev Initial terrain elevation in feet */
- void SetTerrainElevationFtIC(double elev) { terrain_elevation = elev; }
+ void SetTerrainElevationFtIC(double elev);
/** Sets the initial latitude.
@param lat Initial latitude in degrees */
- void SetLatitudeDegIC(double lat) { position.SetLatitude(lat*degtorad); }
+ void SetLatitudeDegIC(double lat) { SetLatitudeRadIC(lat*degtorad); }
/** Sets the initial longitude.
@param lon Initial longitude in degrees */
- void SetLongitudeDegIC(double lon) { position.SetLongitude(lon*degtorad); }
+ void SetLongitudeDegIC(double lon) { SetLongitudeRadIC(lon*degtorad); }
/** Gets the initial calibrated airspeed.
@return Initial calibrated airspeed in knots */
@@ -370,15 +370,15 @@ public:
/** Gets the initial altitude above sea level.
@return Initial altitude in feet. */
- double GetAltitudeASLFtIC(void) const { return position.GetRadius() - sea_level_radius; }
+ double GetAltitudeASLFtIC(void) const { return position.GetAltitudeASL(); }
/** Gets the initial altitude above ground level.
@return Initial altitude AGL in feet */
- double GetAltitudeAGLFtIC(void) const { return position.GetRadius() - sea_level_radius - terrain_elevation; }
+ double GetAltitudeAGLFtIC(void) const;
/** Gets the initial terrain elevation.
@return Initial terrain elevation in feet */
- double GetTerrainElevationFtIC(void) const { return terrain_elevation; }
+ double GetTerrainElevationFtIC(void) const;
/** Sets the initial ground speed.
@param vg Initial ground speed in feet/second */
@@ -585,11 +585,11 @@ public:
/** Sets the initial latitude.
@param lat Initial latitude in radians */
- void SetLatitudeRadIC(double lat) { position.SetLatitude(lat); }
+ void SetLatitudeRadIC(double lat);
/** Sets the initial longitude.
@param lon Initial longitude in radians */
- void SetLongitudeRadIC(double lon) { position.SetLongitude(lon); }
+ void SetLongitudeRadIC(double lon);
/** Sets the target normal load factor.
@param nlf Normal load factor*/
@@ -665,14 +665,14 @@ private:
FGLocation position;
FGQuaternion orientation;
double vt;
- double sea_level_radius;
- double terrain_elevation;
+
double targetNlfIC;
FGMatrix33 Tw2b, Tb2w;
double alpha, beta;
speedset lastSpeedSet;
+ altitudeset lastAltitudeSet;
FGFDMExec *fdmex;
FGPropertyManager *PropertyManager;
diff --git a/src/FDM/JSBSim/initialization/FGTrim.cpp b/src/FDM/JSBSim/initialization/FGTrim.cpp
index cc863c85d..f20c96ef4 100644
--- a/src/FDM/JSBSim/initialization/FGTrim.cpp
+++ b/src/FDM/JSBSim/initialization/FGTrim.cpp
@@ -54,7 +54,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGTrim.cpp,v 1.15 2011/02/19 16:29:29 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGTrim.cpp,v 1.16 2011/11/10 12:06:13 jberndt Exp $";
static const char *IdHdr = ID_TRIM;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -244,7 +244,7 @@ bool FGTrim::DoTrim(void) {
//<< " " << TrimAxes[current_axis]->GetControlName()<< endl;
if(TrimAxes[current_axis]->GetStateType() == tQdot) {
if(mode == tGround) {
- TrimAxes[current_axis]->initTheta();
+ TrimAxes[current_axis]->initTheta();
}
}
xlo=TrimAxes[current_axis]->GetControlMin();
diff --git a/src/FDM/JSBSim/input_output/FGGroundCallback.h b/src/FDM/JSBSim/input_output/FGGroundCallback.h
index 10063f9b9..91937956d 100644
--- a/src/FDM/JSBSim/input_output/FGGroundCallback.h
+++ b/src/FDM/JSBSim/input_output/FGGroundCallback.h
@@ -38,17 +38,21 @@ SENTRY
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include "math/FGColumnVector3.h"
-#include "math/FGLocation.h"
+#include "FGJSBBase.h"
+#include "simgear/structure/SGReferenced.hxx"
+#include "simgear/structure/SGSharedPtr.hxx"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $"
namespace JSBSim {
+class FGLocation;
+class FGColumnVector3;
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -59,14 +63,14 @@ CLASS DOCUMENTATION
ball formed earth with an adjustable terrain elevation.
@author Mathias Froehlich
- @version $Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $
+ @version $Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGGroundCallback : public FGJSBBase
+class FGGroundCallback : public FGJSBBase, public SGReferenced
{
public:
@@ -119,6 +123,8 @@ public:
};
+typedef SGSharedPtr FGGroundCallback_ptr;
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The default sphere earth implementation:
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/input_output/FGScript.cpp b/src/FDM/JSBSim/input_output/FGScript.cpp
old mode 100644
new mode 100755
index 7a88d54ab..acf17368e
--- a/src/FDM/JSBSim/input_output/FGScript.cpp
+++ b/src/FDM/JSBSim/input_output/FGScript.cpp
@@ -55,7 +55,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGScript.cpp,v 1.48 2011/09/07 02:36:04 jberndt Exp $";
+static const char *IdSrc = "$Id: FGScript.cpp,v 1.49 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_FGSCRIPT;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -595,7 +595,7 @@ void FGScript::Debug(int from)
cout << " Notifications" << ":" << endl << " {" << endl;
for (unsigned j=0; jGetRelativeName("/fdm/jsbsim/")
+ << Events[i].NotifyProperties[j]->GetRelativeName("/fdm/jsbsim/")
<< endl;
}
cout << " }" << endl;
diff --git a/src/FDM/JSBSim/math/FGCondition.cpp b/src/FDM/JSBSim/math/FGCondition.cpp
index 719a3e79d..16106874a 100644
--- a/src/FDM/JSBSim/math/FGCondition.cpp
+++ b/src/FDM/JSBSim/math/FGCondition.cpp
@@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGCondition.cpp,v 1.14 2011/04/05 20:20:21 andgi Exp $";
+static const char *IdSrc = "$Id: FGCondition.cpp,v 1.16 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_CONDITION;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -131,7 +131,7 @@ FGCondition::FGCondition(const string& test, FGPropertyManager* PropertyManager)
}
Comparison = mComparison[conditional];
if (Comparison == ecUndef) {
- throw("Comparison operator: \""+conditional+"\" does not exist. Please check the conditional.");
+ throw("Comparison operator: \""+conditional+"\" does not exist. Please check the conditional.");
}
if (is_number(property2)) {
TestValue = atof(property2.c_str());
@@ -269,8 +269,8 @@ void FGCondition::PrintCondition(void )
} else {
if (TestParam2 != 0L)
cout << " " << TestParam1->GetName() << " "
- << conditional << " "
- << TestParam2->GetName();
+ << conditional << " "
+ << TestParam2->GetName();
else
cout << " " << TestParam1->GetName() << " "
<< conditional << " " << TestValue;
diff --git a/src/FDM/JSBSim/math/FGLocation.cpp b/src/FDM/JSBSim/math/FGLocation.cpp
index ce10adfef..95c6e6e7d 100644
--- a/src/FDM/JSBSim/math/FGLocation.cpp
+++ b/src/FDM/JSBSim/math/FGLocation.cpp
@@ -7,6 +7,7 @@
------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------
------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ----
+ ------- (C) 2011 Ola Røer Thorsen (ola@silentwings.no) -----------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
@@ -33,6 +34,8 @@ It has vector properties, so you can add multiply ....
HISTORY
------------------------------------------------------------------------------
04/04/2004 MF Created
+11/01/2011 ORT Encapsulated ground callback code in FGLocation and removed
+ it from FGFDMExec.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
@@ -45,10 +48,14 @@ INCLUDES
namespace JSBSim {
-static const char *IdSrc = "$Id: FGLocation.cpp,v 1.25 2011/10/16 00:19:56 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGLocation.cpp,v 1.26 2011/11/06 18:14:51 bcoconni Exp $";
static const char *IdHdr = ID_LOCATION;
using std::cerr;
using std::endl;
+
+// Set up the default ground callback object.
+FGGroundCallback_ptr FGLocation::GroundCallback = NULL;
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
diff --git a/src/FDM/JSBSim/math/FGLocation.h b/src/FDM/JSBSim/math/FGLocation.h
index 743d6ea09..7042d798b 100644
--- a/src/FDM/JSBSim/math/FGLocation.h
+++ b/src/FDM/JSBSim/math/FGLocation.h
@@ -6,6 +6,7 @@
------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------
------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ----
+ ------- (C) 2011 Ola Røer Thorsen (ola@silentwings.no) -----------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
@@ -27,6 +28,8 @@
HISTORY
-------------------------------------------------------------------------------
04/04/2004 MF Created from code previously in the old positions class.
+11/01/2011 ORT Encapsulated ground callback code in FGLocation and removed
+ it from FGFDMExec.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
@@ -43,12 +46,13 @@ INCLUDES
#include "input_output/FGPropertyManager.h"
#include "FGColumnVector3.h"
#include "FGMatrix33.h"
+#include "input_output/FGGroundCallback.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_LOCATION "$Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $"
+#define ID_LOCATION "$Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -142,7 +146,7 @@ CLASS DOCUMENTATION
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2
@author Mathias Froehlich
- @version $Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $
+ @version $Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -306,6 +310,70 @@ public:
//double GetRadius() const { return mECLoc.Magnitude(); } // may not work with FlightGear
double GetRadius() const { ComputeDerived(); return mRadius; }
+ /// @name Functions that need the ground callback to be set
+ ///@{
+ /** Set the altitude above sea level.
+ @param altitudeASL altitude above Sea Level in feet. */
+ void SetAltitudeASL(double altitudeASL)
+ { SetRadius(GroundCallback->GetSeaLevelRadius(*this) + altitudeASL); }
+
+ /** Set the altitude above ground level.
+ @param altitudeAGL altitude above Ground Level in feet. */
+ void SetAltitudeAGL(double altitudeAGL, double time)
+ { SetRadius(GroundCallback->GetTerrainGeoCentRadius(time, *this) + altitudeAGL); }
+
+ /** Get the local sea level radius
+ @return the sea level radius at the location in feet. */
+ double GetSeaLevelRadius(void) const
+ { ComputeDerived(); return GroundCallback->GetSeaLevelRadius(*this); }
+
+ /** Get the local terrain radius
+ @return the terrain level radius at the location in feet. */
+ double GetTerrainRadius(double time) const
+ { ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(time, *this); }
+
+ /** Get the altitude above sea level.
+ @return the altitude ASL in feet. */
+ double GetAltitudeASL() const
+ { ComputeDerived(); return GroundCallback->GetAltitude(*this); }
+
+ /** Get the altitude above ground level.
+ @return the altitude AGL in feet. */
+ double GetAltitudeAGL(double time) const {
+ FGLocation c;
+ FGColumnVector3 n,v,w;
+ return GetContactPoint(time,c,n,v,w);
+ }
+
+ /** Get terrain contact point information below the current location.
+ @param time Simulation time
+ @param contact Contact point location
+ @param normal Terrain normal vector in contact point (ECEF frame)
+ @param v Terrain linear velocity in contact point (ECEF frame)
+ @param w Terrain angular velocity in contact point (ECEF frame)
+ @return Location altitude above contact point (AGL) in feet. */
+ double GetContactPoint(double time,
+ FGLocation& contact, FGColumnVector3& normal,
+ FGColumnVector3& v, FGColumnVector3& w) const
+ { ComputeDerived(); return GroundCallback->GetAGLevel(time, *this, contact, normal, v, w); }
+
+ /** Sets the ground callback pointer. For optimal memory management, a shared
+ pointer is used internally that maintains a reference counter. The calling
+ application must therefore use FGGroundCallback_ptr 'smart pointers' to
+ manage their copy of the ground callback.
+ @param gc A pointer to a ground callback object
+ @see FGGroundCallback
+ */
+ static void SetGroundCallback(FGGroundCallback* gc) { GroundCallback = gc; }
+
+ /** Get a pointer to the ground callback currently used. It is recommanded
+ to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
+ @return A pointer to the current ground callback object.
+ @see FGGroundCallback
+ */
+ static FGGroundCallback* GetGroundCallback(void) { return GroundCallback; }
+ ///@}
+
/** Transform matrix from local horizontal to earth centered frame.
Returns a const reference to the rotation matrix of the transform from
the local horizontal frame to the earth centered frame. */
@@ -520,6 +588,9 @@ private:
The C++ keyword "mutable" tells the compiler that the data member is
allowed to change during a const member function. */
mutable bool mCacheValid;
+
+ /** The ground callback object pointer */
+ static FGGroundCallback_ptr GroundCallback;
};
/** Scalar multiplication.
diff --git a/src/FDM/JSBSim/math/FGQuaternion.cpp b/src/FDM/JSBSim/math/FGQuaternion.cpp
index e983550a6..f147a3a2b 100644
--- a/src/FDM/JSBSim/math/FGQuaternion.cpp
+++ b/src/FDM/JSBSim/math/FGQuaternion.cpp
@@ -57,7 +57,7 @@ using std::endl;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.19 2010/12/07 12:57:14 jberndt Exp $";
+static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.20 2011/10/31 14:54:40 bcoconni Exp $";
static const char *IdHdr = ID_QUATERNION;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -154,10 +154,10 @@ FGQuaternion::FGQuaternion(const FGMatrix33& m) : mCacheValid(false)
/** Returns the derivative of the quaternion corresponding to the
angular velocities PQR.
See Stevens and Lewis, "Aircraft Control and Simulation", Second Edition,
- Equation 1.3-36.
+ Equation 1.3-36.
Also see Jack Kuipers, "Quaternions and Rotation Sequences", Equation 11.12.
*/
-FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR)
+FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR) const
{
return FGQuaternion(
-0.5*( data[1]*PQR(eP) + data[2]*PQR(eQ) + data[3]*PQR(eR)),
diff --git a/src/FDM/JSBSim/math/FGQuaternion.h b/src/FDM/JSBSim/math/FGQuaternion.h
index 8486b49f8..841ecc262 100644
--- a/src/FDM/JSBSim/math/FGQuaternion.h
+++ b/src/FDM/JSBSim/math/FGQuaternion.h
@@ -47,7 +47,7 @@ SENTRY
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_QUATERNION "$Id: FGQuaternion.h,v 1.22 2010/12/07 12:57:14 jberndt Exp $"
+#define ID_QUATERNION "$Id: FGQuaternion.h,v 1.23 2011/10/31 14:54:40 bcoconni Exp $"
namespace JSBSim {
@@ -164,7 +164,7 @@ public:
@return the quaternion derivative
@see Stevens and Lewis, "Aircraft Control and Simulation", Second Edition,
Equation 1.3-36. */
- FGQuaternion GetQDot(const FGColumnVector3& PQR);
+ FGQuaternion GetQDot(const FGColumnVector3& PQR) const;
/** Transformation matrix.
@return a reference to the transformation/rotation matrix
@@ -527,7 +527,4 @@ inline FGQuaternion operator*(double scalar, const FGQuaternion& q) {
std::ostream& operator<<(std::ostream& os, const FGQuaternion& q);
} // namespace JSBSim
-
-#include "FGMatrix33.h"
-
#endif
diff --git a/src/FDM/JSBSim/models/FGAccelerations.h b/src/FDM/JSBSim/models/FGAccelerations.h
index 5cc609103..bb50da67f 100644
--- a/src/FDM/JSBSim/models/FGAccelerations.h
+++ b/src/FDM/JSBSim/models/FGAccelerations.h
@@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $"
+#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -70,7 +70,7 @@ CLASS DOCUMENTATION
-Calculate the translational velocity
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
- @version $Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $
+ @version $Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -151,7 +151,7 @@ public:
*/
double GetUVWdot(int idx) const { return vUVWdot(idx); }
- FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
+ const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
diff --git a/src/FDM/JSBSim/models/FGAircraft.h b/src/FDM/JSBSim/models/FGAircraft.h
index a7a2ba69b..13a499bd5 100644
--- a/src/FDM/JSBSim/models/FGAircraft.h
+++ b/src/FDM/JSBSim/models/FGAircraft.h
@@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $"
+#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -91,10 +91,10 @@ CLASS DOCUMENTATION
@endcode
@author Jon S. Berndt
- @version $Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $
+ @version $Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $
@see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
- Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
- School, January 1994
+ Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
+ School, January 1994
@see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
JSC 12960, July 1977
@see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
diff --git a/src/FDM/JSBSim/models/FGAuxiliary.cpp b/src/FDM/JSBSim/models/FGAuxiliary.cpp
old mode 100644
new mode 100755
index 8e29a7e39..d18b3052f
--- a/src/FDM/JSBSim/models/FGAuxiliary.cpp
+++ b/src/FDM/JSBSim/models/FGAuxiliary.cpp
@@ -50,7 +50,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.53 2011/08/17 23:56:01 jberndt Exp $";
+static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.55 2011/11/12 18:59:11 bcoconni Exp $";
static const char *IdHdr = ID_AUXILIARY;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -180,6 +180,8 @@ bool FGAuxiliary::Run(bool Holding)
}
}
+ UpdateWindMatrices();
+
Re = Vt * in.Wingchord / in.KinematicViscosity;
double densityD2 = 0.5*in.Density;
@@ -278,7 +280,7 @@ bool FGAuxiliary::Run(bool Holding)
// sin(B) cos(B) 0
// sin(a)*cos(B) -sin(a)*sin(B) cos(a)
-FGMatrix33& FGAuxiliary::GetTw2b(void)
+void FGAuxiliary::UpdateWindMatrices(void)
{
double ca, cb, sa, sb;
@@ -297,31 +299,7 @@ FGMatrix33& FGAuxiliary::GetTw2b(void)
mTw2b(3,2) = -sa*sb;
mTw2b(3,3) = ca;
- return mTw2b;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-FGMatrix33& FGAuxiliary::GetTb2w(void)
-{
- double ca, cb, sa, sb;
-
- ca = cos(alpha);
- sa = sin(alpha);
- cb = cos(beta);
- sb = sin(beta);
-
- mTb2w(1,1) = ca*cb;
- mTb2w(1,2) = sb;
- mTb2w(1,3) = sa*cb;
- mTb2w(2,1) = -ca*sb;
- mTb2w(2,2) = cb;
- mTb2w(2,3) = -sa*sb;
- mTb2w(3,1) = -sa;
- mTb2w(3,2) = 0.0;
- mTb2w(3,3) = ca;
-
- return mTb2w;
+ mTb2w = mTw2b.Transposed();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/FGAuxiliary.h b/src/FDM/JSBSim/models/FGAuxiliary.h
index 45a7382f5..01fc0b91f 100644
--- a/src/FDM/JSBSim/models/FGAuxiliary.h
+++ b/src/FDM/JSBSim/models/FGAuxiliary.h
@@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $"
+#define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -99,7 +99,7 @@ CLASS DOCUMENTATION
to the JSBSim vPQRdot vector, and the w parameter is equivalent to vPQR.
@author Tony Peden, Jon Berndt
- @version $Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $
+ @version $Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -195,12 +195,12 @@ public:
/** Calculates and returns the wind-to-body axis transformation matrix.
@return a reference to the wind-to-body transformation matrix.
*/
- FGMatrix33& GetTw2b(void);
+ const FGMatrix33& GetTw2b(void) { return mTw2b; }
/** Calculates and returns the body-to-wind axis transformation matrix.
@return a reference to the wind-to-body transformation matrix.
*/
- FGMatrix33& GetTb2w(void);
+ const FGMatrix33& GetTb2w(void) { return mTb2w; }
double Getqbar (void) const { return qbar; }
double GetqbarUW (void) const { return qbarUW; }
@@ -225,7 +225,7 @@ public:
/** The vertical acceleration in g's of the aircraft center of gravity. */
double GetNz (void) const { return Nz; }
- FGColumnVector3& GetNwcg(void) { return vNwcg; }
+ const FGColumnVector3& GetNwcg(void) const { return vNwcg; }
double GetHOverBCG(void) const { return hoverbcg; }
double GetHOverBMAC(void) const { return hoverbmac; }
@@ -248,7 +248,7 @@ public:
double GetLatitudeRelativePosition (void) const { return lat_relative_position; }
double GetDistanceRelativePosition (void) const { return relative_position; }
- void SetAeroPQR(FGColumnVector3 tt) { vAeroPQR = tt; }
+ void SetAeroPQR(const FGColumnVector3& tt) { vAeroPQR = tt; }
struct Inputs {
double Pressure;
@@ -329,6 +329,8 @@ private:
double lat_relative_position;
double relative_position;
+ void UpdateWindMatrices(void);
+
void CalculateRelativePosition(void);
void bind(void);
diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.cpp b/src/FDM/JSBSim/models/FGBuoyantForces.cpp
index d98d543dd..b50817608 100644
--- a/src/FDM/JSBSim/models/FGBuoyantForces.cpp
+++ b/src/FDM/JSBSim/models/FGBuoyantForces.cpp
@@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.20 2011/08/06 13:47:59 jberndt Exp $";
+static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.21 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_BUOYANTFORCES;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -146,7 +146,7 @@ bool FGBuoyantForces::Load(Element *element)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGBuoyantForces::GetGasMass(void)
+double FGBuoyantForces::GetGasMass(void) const
{
double Gw = 0.0;
@@ -187,7 +187,7 @@ const FGMatrix33& FGBuoyantForces::GetGasMassInertia(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
+string FGBuoyantForces::GetBuoyancyStrings(const string& delimeter)
{
string CoeffStrings = "";
/*
@@ -217,7 +217,7 @@ string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGBuoyantForces::GetBuoyancyValues(string delimeter)
+string FGBuoyantForces::GetBuoyancyValues(const string& delimeter)
{
string SDValues = "";
/*
diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.h b/src/FDM/JSBSim/models/FGBuoyantForces.h
index a844b9c3b..4b23841c7 100644
--- a/src/FDM/JSBSim/models/FGBuoyantForces.h
+++ b/src/FDM/JSBSim/models/FGBuoyantForces.h
@@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $"
+#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -96,7 +96,7 @@ CLASS DOCUMENTATION
See FGGasCell for the full configuration file format for gas cells.
@author Anders Gidenstam, Jon S. Berndt
- @version $Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $
+ @version $Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -150,7 +150,7 @@ public:
/** Gets the total gas mass. The gas mass is part of the aircraft's
inertia.
@return mass in slugs. */
- double GetGasMass(void);
+ double GetGasMass(void) const;
/** Gets the total moment from the gas mass.
@return a moment vector in the structural frame in lbs in. */
@@ -164,13 +164,13 @@ public:
/** Gets the strings for the current set of gas cells.
@param delimeter either a tab or comma string depending on output type
@return a string containing the descriptive names for all parameters */
- string GetBuoyancyStrings(string delimeter);
+ string GetBuoyancyStrings(const string& delimeter);
/** Gets the coefficient values.
@param delimeter either a tab or comma string depending on output type
@return a string containing the numeric values for the current set of
parameters */
- string GetBuoyancyValues(string delimeter);
+ string GetBuoyancyValues(const string& delimeter);
FGGasCell::Inputs in;
diff --git a/src/FDM/JSBSim/models/FGExternalForce.cpp b/src/FDM/JSBSim/models/FGExternalForce.cpp
old mode 100644
new mode 100755
index 12ade79e7..f0ef173b5
--- a/src/FDM/JSBSim/models/FGExternalForce.cpp
+++ b/src/FDM/JSBSim/models/FGExternalForce.cpp
@@ -60,7 +60,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $";
+static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.11 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_EXTERNALFORCE;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -168,7 +168,7 @@ void FGExternalForce::SetMagnitude(double mag)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGExternalForce::GetBodyForces(void)
+const FGColumnVector3& FGExternalForce::GetBodyForces(void)
{
if (Magnitude_Function) {
double mag = Magnitude_Function->GetValue();
diff --git a/src/FDM/JSBSim/models/FGExternalForce.h b/src/FDM/JSBSim/models/FGExternalForce.h
old mode 100644
new mode 100755
index 5ece2bf22..5c8ec266b
--- a/src/FDM/JSBSim/models/FGExternalForce.h
+++ b/src/FDM/JSBSim/models/FGExternalForce.h
@@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.9 2010/11/18 12:38:06 jberndt Exp $"
+#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.10 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -154,7 +154,7 @@ public:
void SetMagnitude(double mag);
void SetAzimuth(double az) {azimuth = az;}
- FGColumnVector3& GetBodyForces(void);
+ const FGColumnVector3& GetBodyForces(void);
double GetMagnitude(void) const {return magnitude;}
double GetAzimuth(void) const {return azimuth;}
double GetX(void) const {return vDirection(eX);}
diff --git a/src/FDM/JSBSim/models/FGExternalReactions.h b/src/FDM/JSBSim/models/FGExternalReactions.h
old mode 100644
new mode 100755
index 9f9164ed4..7945abf88
--- a/src/FDM/JSBSim/models/FGExternalReactions.h
+++ b/src/FDM/JSBSim/models/FGExternalReactions.h
@@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.13 2011/07/20 12:16:34 jberndt Exp $"
+#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -153,13 +153,13 @@ public:
/** Retrieves the total forces defined in the external reactions.
@return the total force in pounds.
*/
- FGColumnVector3 GetForces(void) const {return vTotalForces;}
+ const FGColumnVector3& GetForces(void) const {return vTotalForces;}
double GetForces(int idx) const {return vTotalForces(idx);}
/** Retrieves the total moment resulting from the forces defined in the external reactions.
@return the total moment in foot-pounds.
*/
- FGColumnVector3 GetMoments(void) const {return vTotalMoments;}
+ const FGColumnVector3& GetMoments(void) const {return vTotalMoments;}
double GetMoments(int idx) const {return vTotalMoments(idx);}
private:
diff --git a/src/FDM/JSBSim/models/FGFCS.h b/src/FDM/JSBSim/models/FGFCS.h
index c48cc4cc1..5c485c2bd 100644
--- a/src/FDM/JSBSim/models/FGFCS.h
+++ b/src/FDM/JSBSim/models/FGFCS.h
@@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FCS "$Id: FGFCS.h,v 1.39 2011/08/14 20:15:56 jberndt Exp $"
+#define ID_FCS "$Id: FGFCS.h,v 1.40 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -168,7 +168,7 @@ CLASS DOCUMENTATION
@property gear/tailhook-pos-norm
@author Jon S. Berndt
- @version $Revision: 1.39 $
+ @version $Revision: 1.40 $
@see FGActuator
@see FGDeadBand
@see FGFCSFunction
@@ -243,14 +243,14 @@ public:
@return throttle command in range from 0 - 1.0 for the given engine */
double GetThrottleCmd(int engine) const;
- vector GetThrottleCmd() const {return ThrottleCmd;}
+ const vector& GetThrottleCmd() const {return ThrottleCmd;}
/** Gets the mixture command.
@param engine engine ID number
@return mixture command in range from 0 - 1.0 for the given engine */
double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
- vector GetMixtureCmd() const {return MixtureCmd;}
+ const vector& GetMixtureCmd() const {return MixtureCmd;}
/** Gets the prop pitch command.
@param engine engine ID number
@@ -322,20 +322,20 @@ public:
@return throttle position for the given engine in range from 0 - 1.0 */
double GetThrottlePos(int engine) const;
- vector GetThrottlePos() const {return ThrottlePos;}
+ const vector& GetThrottlePos() const {return ThrottlePos;}
/** Gets the mixture position.
@param engine engine ID number
@return mixture position for the given engine in range from 0 - 1.0 */
double GetMixturePos(int engine) const { return MixturePos[engine]; }
- vector GetMixturePos() const {return MixturePos;}
+ const vector& GetMixturePos() const {return MixturePos;}
/** Gets the steering position.
@return steering position in degrees */
double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; }
- vector GetSteerPosDeg() const {return SteerPosDeg;}
+ const vector& GetSteerPosDeg() const {return SteerPosDeg;}
/** Gets the gear position (0 up, 1 down), defaults to down
@return gear position (0 up, 1 down) */
@@ -354,14 +354,14 @@ public:
@return prop pitch position for the given engine in range from 0 - 1.0 */
double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
- vector GetPropAdvance() const { return PropAdvance; }
+ const vector& GetPropAdvance() const { return PropAdvance; }
/** Gets the prop feather position.
@param engine engine ID number
@return prop fether for the given engine (on / off)*/
bool GetPropFeather(int engine) const { return PropFeather[engine]; }
- vector GetPropFeather() const { return PropFeather; }
+ const vector& GetPropFeather() const { return PropFeather; }
//@}
/** Retrieves all component names for inclusion in output stream
@@ -528,7 +528,7 @@ public:
@return the brake setting for the supplied brake group argument */
double GetBrake(FGLGear::BrakeGroup bg);
- vector GetBrakePos() const {return BrakePos;}
+ const vector& GetBrakePos() const {return BrakePos;}
/** Gets the left brake.
@return the left brake setting. */
diff --git a/src/FDM/JSBSim/models/FGInertial.cpp b/src/FDM/JSBSim/models/FGInertial.cpp
index b241f78ed..1f4d011dc 100644
--- a/src/FDM/JSBSim/models/FGInertial.cpp
+++ b/src/FDM/JSBSim/models/FGInertial.cpp
@@ -43,7 +43,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGInertial.cpp,v 1.24 2011/08/04 12:46:32 jberndt Exp $";
+static const char *IdSrc = "$Id: FGInertial.cpp,v 1.25 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_INERTIAL;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -130,7 +130,7 @@ double FGInertial::GetGAccel(double r) const
// and therefore may need to be expressed (transformed) in another frame,
// depending on how it is used. See Stevens and Lewis eqn. 1.4-16.
-FGColumnVector3 FGInertial::GetGravityJ2(FGColumnVector3 position) const
+FGColumnVector3 FGInertial::GetGravityJ2(const FGColumnVector3& position) const
{
FGColumnVector3 J2Gravity;
diff --git a/src/FDM/JSBSim/models/FGInertial.h b/src/FDM/JSBSim/models/FGInertial.h
index 0e08abe29..0bf9f460f 100644
--- a/src/FDM/JSBSim/models/FGInertial.h
+++ b/src/FDM/JSBSim/models/FGInertial.h
@@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_INERTIAL "$Id: FGInertial.h,v 1.19 2011/08/04 12:46:32 jberndt Exp $"
+#define ID_INERTIAL "$Id: FGInertial.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -86,9 +86,9 @@ public:
double SLgravity(void) const {return gAccelReference;}
double gravity(void) const {return gAccel;}
double omega(void) const {return RotationRate;}
- FGColumnVector3 GetOmegaPlanet() const {return vOmegaPlanet;}
+ const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
double GetGAccel(double r) const;
- FGColumnVector3 GetGravityJ2(FGColumnVector3 position) const;
+ FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
double GetRefRadius(void) const {return RadiusReference;}
double GetSemimajor(void) const {return a;}
double GetSemiminor(void) const {return b;}
diff --git a/src/FDM/JSBSim/models/FGLGear.cpp b/src/FDM/JSBSim/models/FGLGear.cpp
index cb3d8f521..5f801f428 100644
--- a/src/FDM/JSBSim/models/FGLGear.cpp
+++ b/src/FDM/JSBSim/models/FGLGear.cpp
@@ -60,7 +60,7 @@ DEFINITIONS
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-static const char *IdSrc = "$Id: FGLGear.cpp,v 1.89 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGLGear.cpp,v 1.92 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_LGEAR;
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
@@ -274,7 +274,7 @@ FGLGear::~FGLGear()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGLGear::GetBodyForces(void)
+const FGColumnVector3& FGLGear::GetBodyForces(void)
{
double t = fdmex->GetSimTime();
@@ -290,7 +290,7 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
gearLoc = in.Location.LocalToLocation(vLocalGear);
// Compute the height of the theoretical location of the wheel (if strut is
// not compressed) with respect to the ground level
- double height = fdmex->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, terrainVel, dummy);
+ double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
vGroundNormal = in.Tec2b * normal;
// The height returned above is the AGL and is expressed in the Z direction
@@ -339,11 +339,10 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
vLocalWhlVel = Transform().Transposed() * vBodyWhlVel;
if (fdmex->GetTrimStatus())
- compressSpeed = 0.0; // Steady state is sought during trimming
+ compressSpeed = 0.0; // Steady state is sought during trimming
else {
- compressSpeed = -vLocalWhlVel(eX);
- if (eContactType == ctBOGEY)
- compressSpeed /= LGearProj;
+ compressSpeed = -vLocalWhlVel(eX);
+ if (eContactType == ctBOGEY) compressSpeed /= LGearProj;
}
ComputeVerticalStrutForce();
diff --git a/src/FDM/JSBSim/models/FGLGear.h b/src/FDM/JSBSim/models/FGLGear.h
index ba44029fe..792f1bb2e 100644
--- a/src/FDM/JSBSim/models/FGLGear.h
+++ b/src/FDM/JSBSim/models/FGLGear.h
@@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_LGEAR "$Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $"
+#define ID_LGEAR "$Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -178,7 +178,7 @@ CLASS DOCUMENTATION
@endcode
@author Jon S. Berndt
- @version $Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $
+ @version $Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni Exp $
@see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
NASA-Ames", NASA CR-2497, January 1975
@see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
@@ -238,19 +238,19 @@ public:
~FGLGear();
/// The Force vector for this gear
- FGColumnVector3& GetBodyForces(void);
+ const FGColumnVector3& GetBodyForces(void);
/// Gets the location of the gear in Body axes
- FGColumnVector3 GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; }
+ const FGColumnVector3& GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; }
double GetBodyLocation(int idx) const { return in.vWhlBodyVec[GearNumber](idx); }
- FGColumnVector3& GetLocalGear(void) { return vLocalGear; }
+ const FGColumnVector3& GetLocalGear(void) const { return vLocalGear; }
double GetLocalGear(int idx) const { return vLocalGear(idx); }
/// Gets the name of the gear
- string GetName(void) const {return name; }
+ const string& GetName(void) const {return name; }
/// Gets the Weight On Wheels flag value
- bool GetWOW(void) const {return WOW; }
+ bool GetWOW(void) const {return WOW; }
/// Gets the current compressed length of the gear in feet
double GetCompLen(void) const {return compressLength;}
/// Gets the current gear compression velocity in ft/sec
@@ -276,17 +276,17 @@ public:
/** Get the console touchdown reporting feature
@return true if reporting is turned on */
bool GetReport(void) const { return ReportEnable; }
- double GetSteerNorm(void) const { return radtodeg/maxSteerAngle*SteerAngle; }
+ double GetSteerNorm(void) const { return radtodeg/maxSteerAngle*SteerAngle; }
double GetDefaultSteerAngle(double cmd) const { return cmd*maxSteerAngle; }
double GetstaticFCoeff(void) const { return staticFCoeff; }
- int GetBrakeGroup(void) const { return (int)eBrakeGrp; }
- int GetSteerType(void) const { return (int)eSteerType; }
+ int GetBrakeGroup(void) const { return (int)eBrakeGrp; }
+ int GetSteerType(void) const { return (int)eSteerType; }
- bool GetSteerable(void) const { return eSteerType != stFixed; }
- bool GetRetractable(void) const { return isRetractable; }
- bool GetGearUnitUp(void) const { return GearUp; }
- bool GetGearUnitDown(void) const { return GearDown; }
+ bool GetSteerable(void) const { return eSteerType != stFixed; }
+ bool GetRetractable(void) const { return isRetractable; }
+ bool GetGearUnitUp(void) const { return GearUp; }
+ bool GetGearUnitDown(void) const { return GearDown; }
double GetWheelRollForce(void) {
UpdateForces();
FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
diff --git a/src/FDM/JSBSim/models/FGMassBalance.cpp b/src/FDM/JSBSim/models/FGMassBalance.cpp
index 9cb32f885..dbd8ab3a6 100644
--- a/src/FDM/JSBSim/models/FGMassBalance.cpp
+++ b/src/FDM/JSBSim/models/FGMassBalance.cpp
@@ -49,7 +49,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.37 2011/07/12 01:52:49 jberndt Exp $";
+static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.39 2011/11/09 21:58:26 bcoconni Exp $";
static const char *IdHdr = ID_MASSBALANCE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,7 +291,7 @@ void FGMassBalance::AddPointMass(Element* el)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGMassBalance::GetTotalPointMassWeight(void)
+double FGMassBalance::GetTotalPointMassWeight(void) const
{
double PM_total_weight = 0.0;
@@ -303,7 +303,7 @@ double FGMassBalance::GetTotalPointMassWeight(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
+const FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
{
PointMassCG.InitMatrix();
@@ -315,7 +315,7 @@ FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGMatrix33& FGMassBalance::CalculatePMInertias(void)
+const FGMatrix33& FGMassBalance::CalculatePMInertias(void)
{
unsigned int size;
diff --git a/src/FDM/JSBSim/models/FGMassBalance.h b/src/FDM/JSBSim/models/FGMassBalance.h
index 981eef6de..9b11290b1 100644
--- a/src/FDM/JSBSim/models/FGMassBalance.h
+++ b/src/FDM/JSBSim/models/FGMassBalance.h
@@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.25 2011/07/28 12:48:19 jberndt Exp $"
+#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.27 2011/11/09 21:58:26 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONSS
@@ -171,12 +171,12 @@ public:
void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
void AddPointMass(Element* el);
- double GetTotalPointMassWeight(void);
+ double GetTotalPointMassWeight(void) const;
- FGColumnVector3& GetPointMassMoment(void);
+ const FGColumnVector3& GetPointMassMoment(void);
const FGMatrix33& GetJ(void) const {return mJ;}
const FGMatrix33& GetJinv(void) const {return mJinv;}
- void SetAircraftBaseInertias(FGMatrix33 BaseJ) {baseJ = BaseJ;}
+ void SetAircraftBaseInertias(const FGMatrix33& BaseJ) {baseJ = BaseJ;}
void GetMassPropertiesReport(void) const;
struct Inputs {
@@ -204,7 +204,7 @@ private:
FGColumnVector3 vbaseXYZcg;
FGColumnVector3 vPMxyz;
FGColumnVector3 PointMassCG;
- FGMatrix33& CalculatePMInertias(void);
+ const FGMatrix33& CalculatePMInertias(void);
/** The PointMass structure encapsulates a point mass object, moments of inertia
@@ -255,9 +255,9 @@ private:
double GetPointMassLocation(int axis) const {return Location(axis);}
double GetPointMassWeight(void) const {return Weight;}
esShape GetShapeType(void) {return eShapeType;}
- FGColumnVector3 GetLocation(void) {return Location;}
- FGMatrix33 GetPointMassInertia(void) {return mPMInertia;}
- string GetName(void) {return Name;}
+ const FGColumnVector3& GetLocation(void) {return Location;}
+ const FGMatrix33& GetPointMassInertia(void) {return mPMInertia;}
+ const string& GetName(void) {return Name;}
void SetPointMassLocation(int axis, double value) {Location(axis) = value;}
void SetPointMassWeight(double wt) {Weight = wt;}
diff --git a/src/FDM/JSBSim/models/FGOutput.h b/src/FDM/JSBSim/models/FGOutput.h
index 2640bbdcb..b7a62d57a 100644
--- a/src/FDM/JSBSim/models/FGOutput.h
+++ b/src/FDM/JSBSim/models/FGOutput.h
@@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_OUTPUT "$Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $"
+#define ID_OUTPUT "$Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -91,13 +91,13 @@ CLASS DOCUMENTATION
Examples:
@code
-
+
@endcode
@code
-
+
@endcode
@@ -124,7 +124,7 @@ CLASS DOCUMENTATION
propulsion ON|OFF
NOTE that Time is always output with the data.
- @version $Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $
+ @version $Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/FGPropagate.cpp b/src/FDM/JSBSim/models/FGPropagate.cpp
index d1ec2b922..2ff471740 100644
--- a/src/FDM/JSBSim/models/FGPropagate.cpp
+++ b/src/FDM/JSBSim/models/FGPropagate.cpp
@@ -68,7 +68,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.98 2011/10/22 15:11:24 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.100 2011/11/06 18:14:51 bcoconni Exp $";
static const char *IdHdr = ID_PROPAGATE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -113,10 +113,8 @@ FGPropagate::~FGPropagate(void)
bool FGPropagate::InitModel(void)
{
// For initialization ONLY:
- VState.vLocation.SetRadius( FDMExec->GetGroundCallback()->
- GetTerrainGeoCentRadius(0.0,VState.vLocation) + 4.0 );
-
VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
+ VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
vInertialVelocity.InitMatrix();
@@ -137,8 +135,6 @@ bool FGPropagate::InitModel(void)
void FGPropagate::SetInitialState(const FGInitialCondition *FGIC)
{
- SetTerrainElevation(FGIC->GetTerrainElevationFtIC());
-
// Initialize the State Vector elements and the transformation matrices
// Set the position lat/lon/radius
@@ -371,7 +367,7 @@ void FGPropagate::UpdateBodyMatrices(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGPropagate::SetInertialOrientation(FGQuaternion Qi) {
+void FGPropagate::SetInertialOrientation(const FGQuaternion& Qi) {
VState.qAttitudeECI = Qi;
VState.qAttitudeECI.Normalize();
UpdateBodyMatrices();
@@ -380,7 +376,7 @@ void FGPropagate::SetInertialOrientation(FGQuaternion Qi) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) {
+void FGPropagate::SetInertialVelocity(const FGColumnVector3& Vi) {
VState.vInertialVelocity = Vi;
CalculateUVW();
vVel = Tb2l * VState.vUVW;
@@ -388,7 +384,7 @@ void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGPropagate::SetInertialRates(FGColumnVector3 vRates) {
+void FGPropagate::SetInertialRates(const FGColumnVector3& vRates) {
VState.vPQRi = Ti2b * vRates;
VState.vPQR = VState.vPQRi - Ti2b * in.vOmegaPlanet;
}
@@ -397,23 +393,21 @@ void FGPropagate::SetInertialRates(FGColumnVector3 vRates) {
void FGPropagate::RecomputeLocalTerrainVelocity()
{
- FGLocation contact;
- FGColumnVector3 normal;
- FDMExec->GetGroundCallback()->GetAGLevel(FDMExec->GetSimTime(),
- VState.vLocation,
- contact, normal,
- LocalTerrainVelocity,
- LocalTerrainAngularVelocity);
+ FGLocation contact;
+ FGColumnVector3 normal;
+ VState.vLocation.GetContactPoint(FDMExec->GetSimTime(), contact, normal,
+ LocalTerrainVelocity, LocalTerrainAngularVelocity);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetTerrainElevation(double terrainElev)
{
- double radius = terrainElev + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+ double radius = terrainElev + VState.vLocation.GetSeaLevelRadius();
FDMExec->GetGroundCallback()->SetTerrainGeoCentRadius(radius);
}
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetSeaLevelRadius(double tt)
@@ -425,49 +419,22 @@ void FGPropagate::SetSeaLevelRadius(double tt)
double FGPropagate::GetLocalTerrainRadius(void) const
{
- return FDMExec->GetGroundCallback()->GetTerrainGeoCentRadius(FDMExec->GetSimTime(),
- VState.vLocation);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-double FGPropagate::GetTerrainElevation(void) const
-{
- return GetLocalTerrainRadius()
- - FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+ return VState.vLocation.GetTerrainRadius(FDMExec->GetSimTime());
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGL(void) const
{
- FGColumnVector3 dummy;
- FGLocation dummyloc;
- double t = FDMExec->GetSimTime();
- return FDMExec->GetGroundCallback()->GetAGLevel(t, VState.vLocation, dummyloc,
- dummy, dummy, dummy);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPropagate::SetAltitudeASL(double altASL)
-{
- SetRadius(altASL + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation));
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-double FGPropagate::GetAltitudeASL(void) const
-{
- return VState.vLocation.GetRadius()
- - FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+ return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime());
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetDistanceAGL(double tt)
{
- SetAltitudeASL(tt + GetTerrainElevation());
+ VState.vLocation.SetAltitudeAGL(tt, FDMExec->GetSimTime());
+ UpdateVehicleState();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -508,7 +475,6 @@ void FGPropagate::UpdateVehicleState(void)
void FGPropagate::SetLocation(const FGLocation& l)
{
VState.vLocation = l;
- VState.vLocation.SetEarthPositionAngle(l.GetEPA());
Ti2ec = VState.vLocation.GetTi2ec(); // useless ?
Tec2i = Ti2ec.Transposed();
UpdateVehicleState();
diff --git a/src/FDM/JSBSim/models/FGPropagate.h b/src/FDM/JSBSim/models/FGPropagate.h
index e1384f616..232c306de 100644
--- a/src/FDM/JSBSim/models/FGPropagate.h
+++ b/src/FDM/JSBSim/models/FGPropagate.h
@@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -93,7 +93,7 @@ CLASS DOCUMENTATION
@endcode
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
- @version $Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $
+ @version $Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -257,7 +257,7 @@ public:
@param idx the index of the velocity component desired (1-based).
@return The body frame velocity component.
*/
- double GetUVW (int idx) const { return VState.vUVW(idx); }
+ double GetUVW(int idx) const { return VState.vUVW(idx); }
/** Retrieves a Local frame velocity component.
Retrieves a Local frame velocity component. The velocity returned is
@@ -286,14 +286,14 @@ public:
/** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame.
*/
- const FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; }
+ FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; }
/** Returns the current altitude above sea level.
This function returns the altitude above sea level.
units ft
@return The current altitude above sea level in feet.
*/
- double GetAltitudeASL(void) const;
+ double GetAltitudeASL(void) const { return VState.vLocation.GetAltitudeASL(); }
/** Returns the current altitude above sea level.
This function returns the altitude above sea level.
@@ -387,7 +387,7 @@ public:
const FGColumnVector3& GetTerrainAngularVelocity(void) const { return LocalTerrainAngularVelocity; }
void RecomputeLocalTerrainVelocity();
- double GetTerrainElevation(void) const;
+ double GetTerrainElevation(void) const { return GetLocalTerrainRadius() - VState.vLocation.GetSeaLevelRadius(); }
double GetDistanceAGL(void) const;
double GetRadius(void) const {
if (VState.vLocation.GetRadius() == 0) return 1.0;
@@ -467,21 +467,21 @@ public:
void SetEarthPositionAngle(double epa) {VState.vLocation.SetEarthPositionAngle(epa);}
- void SetInertialOrientation(FGQuaternion Qi);
- void SetInertialVelocity(FGColumnVector3 Vi);
- void SetInertialRates(FGColumnVector3 vRates);
+ void SetInertialOrientation(const FGQuaternion& Qi);
+ void SetInertialVelocity(const FGColumnVector3& Vi);
+ void SetInertialRates(const FGColumnVector3& vRates);
const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; }
const FGQuaternion GetQuaternionECI(void) const { return VState.qAttitudeECI; }
void SetPQR(unsigned int i, double val) {
- if ((i>=1) && (i<=3) )
- VState.vPQR(i) = val;
+ VState.vPQR(i) = val;
+ VState.vPQRi = VState.vPQR + Ti2b * in.vOmegaPlanet;
}
void SetUVW(unsigned int i, double val) {
- if ((i>=1) && (i<=3) )
- VState.vUVW(i) = val;
+ VState.vUVW(i) = val;
+ CalculateInertialVelocity();
}
// SET functions
@@ -505,7 +505,11 @@ public:
VState.vInertialPosition = Tec2i * VState.vLocation;
}
- void SetAltitudeASL(double altASL);
+ void SetAltitudeASL(double altASL)
+ {
+ VState.vLocation.SetAltitudeASL(altASL);
+ UpdateVehicleState();
+ }
void SetAltitudeASLmeters(double altASL) { SetAltitudeASL(altASL/fttom); }
void SetSeaLevelRadius(double tt);
@@ -525,7 +529,7 @@ public:
SetLocation(l);
}
- void NudgeBodyLocation(FGColumnVector3 deltaLoc) {
+ void NudgeBodyLocation(const FGColumnVector3& deltaLoc) {
VState.vInertialPosition -= Tb2i*deltaLoc;
VState.vLocation -= Tb2ec*deltaLoc;
}
diff --git a/src/FDM/JSBSim/models/FGPropulsion.cpp b/src/FDM/JSBSim/models/FGPropulsion.cpp
index 2021c822e..bdf0cc9ce 100644
--- a/src/FDM/JSBSim/models/FGPropulsion.cpp
+++ b/src/FDM/JSBSim/models/FGPropulsion.cpp
@@ -66,7 +66,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.51 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.52 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_PROPULSION;
extern short debug_lvl;
@@ -584,7 +584,7 @@ string FGPropulsion::GetPropulsionTankReport()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGPropulsion::GetTanksMoment(void)
+const FGColumnVector3& FGPropulsion::GetTanksMoment(void)
{
vXYZtank_arm.InitMatrix();
for (unsigned int i=0; i= 0) {
+ for (unsigned int i=0; iringLatitude, UpDownBurstCells[i]->ringLongitude);
+
+ }
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGWinds::bind(void)
{
typedef double (FGWinds::*PMF)(int) const;
@@ -473,6 +513,16 @@ void FGWinds::bind(void)
PropertyManager->Tie("atmosphere/cosine-gust/Z-velocity-ft_sec", this, (Ptr)0L, &FGWinds::GustZComponent);
PropertyManager->Tie("atmosphere/cosine-gust/start", this, (PMFt)0L, (PMFi)&FGWinds::StartGust);
+ // User-specified Up- Down-burst parameters
+ PropertyManager->Tie("atmosphere/updownburst/number-of-cells", this, (PMFt)0L, &FGWinds::NumberOfUpDownburstCells);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+
// User-specified turbulence (local navigational/geographic frame: N-E-D)
PropertyManager->Tie("atmosphere/turb-north-fps", this, eNorth, (PMF)&FGWinds::GetTurbNED,
(PMFd)&FGWinds::SetTurbNED);
diff --git a/src/FDM/JSBSim/models/atmosphere/FGWinds.h b/src/FDM/JSBSim/models/atmosphere/FGWinds.h
index 8d8aa0552..fac8338e5 100644
--- a/src/FDM/JSBSim/models/atmosphere/FGWinds.h
+++ b/src/FDM/JSBSim/models/atmosphere/FGWinds.h
@@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_WINDS "$Id: FGWinds.h,v 1.6 2011/10/22 15:11:24 bcoconni Exp $"
+#define ID_WINDS "$Id: FGWinds.h,v 1.9 2011/11/19 14:14:57 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -154,7 +154,7 @@ public:
virtual void SetWindNED(const FGColumnVector3& wind) { vWindNED=wind; }
/// Retrieves the wind components in NED frame.
- virtual FGColumnVector3& GetWindNED(void) { return vWindNED; }
+ virtual const FGColumnVector3& GetWindNED(void) const { return vWindNED; }
/// Retrieves a wind component in NED frame.
virtual double GetWindNED(int idx) const {return vWindNED(idx);}
@@ -194,7 +194,7 @@ public:
virtual double GetTurbNED(int idx) const {return vTurbulenceNED(idx);}
/// Retrieves the gust components in NED frame.
- virtual FGColumnVector3& GetGustNED(void) {return vGustNED;}
+ virtual const FGColumnVector3& GetGustNED(void) const {return vGustNED;}
/** Turbulence models available: ttNone, ttStandard, ttBerndt, ttCulp, ttMilspec, ttTustin */
virtual void SetTurbType(tType tt) {turbType = tt;}
@@ -264,7 +264,14 @@ public:
double ringRadius; ///<- The radius of the ring (feet).
double ringCoreRadius; ///<- The cross-section "core" radius of the ring (feet).
double circulation; ///<- The circulation (gamma) (feet-squared per second).
- struct OneMinusCosineProfile oneMCosineProfile;
+ struct OneMinusCosineProfile oneMCosineProfile;///<- A gust profile structure.
+ UpDownBurst() { ///<- Constructor
+ ringLatitude = ringLongitude = 0.0;
+ ringAltitude = 1000.0;
+ ringRadius = 2000.0;
+ ringCoreRadius = 100.0;
+ circulation = 100000.0;
+ }
};
// 1 - Cosine gust setters
@@ -293,11 +300,17 @@ public:
/// Specifies the Z component of velocity in the specified gust frame (ft/sec).
virtual void GustZComponent(double z) {oneMinusCosineGust.vWind(eZ) = z;}
+ // Up- Down-burst functions
+ void NumberOfUpDownburstCells(int num);
+
struct Inputs {
double V;
double wingspan;
double DistanceAGL;
double AltitudeASL;
+ double longitude;
+ double latitude;
+ double planetRadius;
FGMatrix33 Tl2b;
FGMatrix33 Tw2b;
double totalDeltaT;
@@ -320,6 +333,7 @@ private:
FGColumnVector3 vTurbPQR;
struct OneMinusCosineGust oneMinusCosineGust;
+ std::vector UpDownBurstCells;
// Dryden turbulence model
double windspeed_at_20ft; ///< in ft/s
@@ -334,12 +348,13 @@ private:
FGColumnVector3 vBurstGust;
FGColumnVector3 vTurbulenceNED;
- /// Get T, P and rho for a standard atmosphere at the given altitude.
void Turbulence(double h);
+ void UpDownBurst();
void CosineGust();
double CosineGustProfile( double startDuration, double steadyDuration,
double endDuration, double elapsedTime);
+ double DistanceFromRingCenter(double lat, double lon);
virtual void bind(void);
void Debug(int from);
diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
old mode 100644
new mode 100755
index d6524edf2..779014ce1
--- a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
+++ b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
@@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $"
+#define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -94,18 +94,18 @@ a function (from an aero specification):
velocities/mach
- 0.0000 0.0220
- 0.2000 0.0200
- 0.6500 0.0220
- 0.9000 0.0240
- 0.9700 0.0500
+ 0.0000 0.0220
+ 0.2000 0.0200
+ 0.6500 0.0220
+ 0.9000 0.0240
+ 0.9700 0.0500
@endcode
- @version $Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $
+ @version $Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
index e0c056b37..3769934bd 100644
--- a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
@@ -53,7 +53,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGEngine.cpp,v 1.47 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGEngine.cpp,v 1.48 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_ENGINE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -183,7 +183,8 @@ unsigned int FGEngine::GetSourceTank(unsigned int i) const
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGEngine::SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation)
+void FGEngine::SetPlacement(const FGColumnVector3& location,
+ const FGColumnVector3& orientation)
{
X = location(eX);
Y = location(eY);
@@ -201,14 +202,14 @@ double FGEngine::GetThrust(void) const
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- FGColumnVector3& FGEngine::GetBodyForces(void)
+const FGColumnVector3& FGEngine::GetBodyForces(void)
{
return Thruster->GetBodyForces();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGEngine::GetMoments(void)
+const FGColumnVector3& FGEngine::GetMoments(void)
{
return Thruster->GetMoments();
}
diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.h b/src/FDM/JSBSim/models/propulsion/FGEngine.h
index 33db9998e..66c59ad42 100644
--- a/src/FDM/JSBSim/models/propulsion/FGEngine.h
+++ b/src/FDM/JSBSim/models/propulsion/FGEngine.h
@@ -55,7 +55,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_ENGINE "$Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $"
+#define ID_ENGINE "$Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -108,12 +108,12 @@ CLASS DOCUMENTATION
@endcode
NOTES:
-
- Not all thruster types can be matched with a given engine type. See the class
- documentation for engine and thruster classes.
+
+ Not all thruster types can be matched with a given engine type. See the class
+ documentation for engine and thruster classes.
@author Jon S. Berndt
- @version $Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $
+ @version $Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -157,28 +157,28 @@ public:
enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etTurboprop, etElectric};
- EngineType GetType(void) { return Type; }
- virtual string GetName(void) { return Name; }
+ EngineType GetType(void) const { return Type; }
+ virtual const string& GetName(void) const { return Name; }
// Engine controls
- virtual double GetThrottleMin(void) { return MinThrottle; }
- virtual double GetThrottleMax(void) { return MaxThrottle; }
- virtual bool GetStarter(void) { return Starter; }
+ virtual double GetThrottleMin(void) const { return MinThrottle; }
+ virtual double GetThrottleMax(void) const { return MaxThrottle; }
+ virtual bool GetStarter(void) const { return Starter; }
virtual double getFuelFlow_gph () const {return FuelFlow_gph;}
virtual double getFuelFlow_pph () const {return FuelFlow_pph;}
virtual double GetFuelFlowRate(void) const {return FuelFlowRate;}
virtual double GetFuelFlowRateGPH(void) const {return FuelFlowRate*3600/6.02;}
virtual double GetFuelUsedLbs(void) const {return FuelUsedLbs;}
- virtual bool GetStarved(void) { return Starved; }
+ virtual bool GetStarved(void) const { return Starved; }
virtual bool GetRunning(void) const { return Running; }
- virtual bool GetCranking(void) { return Cranking; }
+ virtual bool GetCranking(void) const { return Cranking; }
virtual void SetStarved(bool tt) { Starved = tt; }
virtual void SetStarved(void) { Starved = true; }
virtual void SetRunning(bool bb) { Running=bb; }
- virtual void SetName(string name) { Name = name; }
+ virtual void SetName(const string& name) { Name = name; }
virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
virtual void SetStarter(bool s) { Starter = s; }
@@ -194,7 +194,7 @@ public:
virtual double GetThrust(void) const;
/// Sets engine placement information
- virtual void SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation);
+ virtual void SetPlacement(const FGColumnVector3& location, const FGColumnVector3& orientation);
/** The fuel need is calculated based on power levels and flow rate for that
power level. It is also turned from a rate into an actual amount (pounds)
@@ -206,11 +206,11 @@ public:
virtual double GetPowerAvailable(void) {return 0.0;};
- virtual FGColumnVector3& GetBodyForces(void);
- virtual FGColumnVector3& GetMoments(void);
+ virtual const FGColumnVector3& GetBodyForces(void);
+ virtual const FGColumnVector3& GetMoments(void);
bool LoadThruster(Element *el);
- FGThruster* GetThruster(void) {return Thruster;}
+ FGThruster* GetThruster(void) const {return Thruster;}
unsigned int GetSourceTank(unsigned int i) const;
unsigned int GetNumSourceTanks() const {return SourceTanks.size();}
diff --git a/src/FDM/JSBSim/models/propulsion/FGForce.cpp b/src/FDM/JSBSim/models/propulsion/FGForce.cpp
index bd5872b95..787e184a1 100644
--- a/src/FDM/JSBSim/models/propulsion/FGForce.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGForce.cpp
@@ -53,7 +53,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGForce.cpp,v 1.16 2011/08/04 12:46:32 jberndt Exp $";
+static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_FORCE;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -89,7 +89,7 @@ FGForce::~FGForce()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3& FGForce::GetBodyForces(void)
+const FGColumnVector3& FGForce::GetBodyForces(void)
{
vFb = Transform()*vFn;
@@ -106,7 +106,7 @@ FGColumnVector3& FGForce::GetBodyForces(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGMatrix33 FGForce::Transform(void)
+const FGMatrix33& FGForce::Transform(void) const
{
switch(ttype) {
case tWindBody:
diff --git a/src/FDM/JSBSim/models/propulsion/FGForce.h b/src/FDM/JSBSim/models/propulsion/FGForce.h
index 9ec0d3064..f517bce0b 100644
--- a/src/FDM/JSBSim/models/propulsion/FGForce.h
+++ b/src/FDM/JSBSim/models/propulsion/FGForce.h
@@ -66,7 +66,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FORCE "$Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $"
+#define ID_FORCE "$Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -215,7 +215,7 @@ and vMn, the moments, can be made directly. Otherwise, the usage is similar.
@author Tony Peden
- @version $Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $
+ @version $Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -238,12 +238,12 @@ public:
enum TransformType { tNone, tWindBody, tLocalBody, tCustom };
- virtual FGColumnVector3& GetBodyForces(void);
+ virtual const FGColumnVector3& GetBodyForces(void);
inline double GetBodyXForce(void) const { return vFb(eX); }
inline double GetBodyYForce(void) const { return vFb(eY); }
inline double GetBodyZForce(void) const { return vFb(eZ); }
- inline FGColumnVector3& GetMoments(void) { return vM; }
+ inline const FGColumnVector3& GetMoments(void) const { return vM; }
// Normal point of application, JSBsim structural coords
// (inches, x +back, y +right, z +up)
@@ -273,8 +273,8 @@ public:
inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
- inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; SetActingLocation(vv);}
- inline void SetActingLocation(FGColumnVector3 vv) { vActingXYZn = vv; }
+ inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
+ inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }
inline double GetLocationX( void ) const { return vXYZn(eX);}
inline double GetLocationY( void ) const { return vXYZn(eY);}
@@ -282,8 +282,8 @@ public:
inline double GetActingLocationX( void ) const { return vActingXYZn(eX);}
inline double GetActingLocationY( void ) const { return vActingXYZn(eY);}
inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);}
- FGColumnVector3& GetLocation(void) { return vXYZn; }
- FGColumnVector3& GetActingLocation(void) { return vActingXYZn; }
+ const FGColumnVector3& GetLocation(void) const { return vXYZn; }
+ const FGColumnVector3& GetActingLocation(void) const { return vActingXYZn; }
//these angles are relative to body axes, not earth!!!!!
//I'm using these because pitch, roll, and yaw are easy to visualize,
@@ -293,7 +293,7 @@ public:
//They are in radians.
void SetAnglesToBody(double broll, double bpitch, double byaw);
- inline void SetAnglesToBody(FGColumnVector3 vv) {
+ inline void SetAnglesToBody(const FGColumnVector3& vv) {
SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
}
@@ -304,13 +304,13 @@ public:
double GetPitch(void) const {return vOrient(ePitch);}
double GetYaw(void) const {return vOrient(eYaw);}
- inline FGColumnVector3& GetAnglesToBody(void) {return vOrient;}
+ inline const FGColumnVector3& GetAnglesToBody(void) const {return vOrient;}
inline double GetAnglesToBody(int axis) const {return vOrient(axis);}
inline void SetTransformType(TransformType ii) { ttype=ii; }
inline TransformType GetTransformType(void) const { return ttype; }
- FGMatrix33 Transform(void);
+ const FGMatrix33& Transform(void) const;
protected:
FGFDMExec *fdmex;
diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
index f2c0167e1..7837d39ff 100644
--- a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
@@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.39 2011/10/15 13:00:57 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.41 2011/11/17 21:07:30 jentron Exp $";
static const char *IdHdr = ID_PROPELLER;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -223,6 +223,10 @@ double FGPropeller::Calculate(double EnginePower)
if (CtMach) ThrustCoeff *= CtMach->GetValue(HelicalTipMach);
if (P_Factor > 0.0001) {
+// alpha = sin(fdmex->GetAuxiliary()->Getalpha() + FGThruster::GetPitch());
+// beta = sin(fdmex->GetAuxiliary()->Getbeta() + FGThruster::GetYaw());
+// SetActingLocationY( GetLocationY() + P_Factor*alpha*Sense);
+// SetActingLocationZ( GetLocationZ() + P_Factor*beta*Sense);
SetActingLocationY( GetLocationY() + P_Factor*in.Alpha*Sense);
SetActingLocationZ( GetLocationZ() + P_Factor*in.Beta*Sense);
}
@@ -334,8 +338,8 @@ double FGPropeller::GetPowerRequired(void)
double CL = (90.0 - Pitch) / 20.0;
if (CL > 1.5) CL = 1.5;
double BladeArea = Diameter * Diameter / 32.0 * numBlades;
- vTorque(eX) = -Sense*BladeArea*Diameter*Vel*Vel*rho*0.19*CL;
- PowerRequired = fabs(vTorque(eX))*0.2*M_PI;
+ vTorque(eX) = -Sense*BladeArea*Diameter*fabs(Vel)*Vel*rho*0.19*CL;
+ PowerRequired = Sense*(vTorque(eX))*0.2*M_PI;
}
return PowerRequired;
@@ -343,7 +347,7 @@ double FGPropeller::GetPowerRequired(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGColumnVector3 FGPropeller::GetPFactor()
+FGColumnVector3 FGPropeller::GetPFactor() const
{
double px=0.0, py, pz;
@@ -355,7 +359,7 @@ FGColumnVector3 FGPropeller::GetPFactor()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGPropeller::GetThrusterLabels(int id, string delimeter)
+string FGPropeller::GetThrusterLabels(int id, const string& delimeter)
{
std::ostringstream buf;
@@ -372,7 +376,7 @@ string FGPropeller::GetThrusterLabels(int id, string delimeter)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGPropeller::GetThrusterValues(int id, string delimeter)
+string FGPropeller::GetThrusterValues(int id, const string& delimeter)
{
std::ostringstream buf;
diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.h b/src/FDM/JSBSim/models/propulsion/FGPropeller.h
index 6e918a4eb..1b353d2cb 100644
--- a/src/FDM/JSBSim/models/propulsion/FGPropeller.h
+++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.h
@@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_PROPELLER "$Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $"
+#define ID_PROPELLER "$Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -142,7 +142,7 @@ CLASS DOCUMENTATION
Various NACA Technical Notes and Reports
@author Jon S. Berndt
- @version $Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $
+ @version $Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $
@see FGEngine
@see FGThruster
*/
@@ -175,7 +175,7 @@ public:
void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
/// Returns true of this propeller is variable pitch
- bool IsVPitch(void) {return MaxPitch != MinPitch;}
+ bool IsVPitch(void) const {return MaxPitch != MinPitch;}
/** This commands the pitch of the blade to change to the value supplied.
This call is meant to be issued either from the cockpit or by the flight
@@ -207,25 +207,25 @@ public:
void SetSense(double s) { Sense = s;}
/// Retrieves the pitch of the propeller in degrees.
- double GetPitch(void) { return Pitch; }
+ double GetPitch(void) const { return Pitch; }
/// Retrieves the RPMs of the propeller
- double GetRPM(void) const { return RPM; }
+ double GetRPM(void) const { return RPM; }
/// Calculates the RPMs of the engine based on gear ratio
- double GetEngineRPM(void) const { return RPM * GearRatio; }
+ double GetEngineRPM(void) const { return RPM * GearRatio; }
/// Retrieves the propeller moment of inertia
- double GetIxx(void) { return Ixx; }
+ double GetIxx(void) const { return Ixx; }
/// Retrieves the coefficient of thrust multiplier
- double GetCtFactor(void) { return CtFactor; }
+ double GetCtFactor(void) const { return CtFactor; }
/// Retrieves the coefficient of power multiplier
- double GetCpFactor(void) { return CpFactor; }
+ double GetCpFactor(void) const { return CpFactor; }
/// Retrieves the propeller diameter
- double GetDiameter(void) { return Diameter; }
+ double GetDiameter(void) const { return Diameter; }
/// Retrieves propeller thrust table
FGTable* GetCThrustTable(void) const { return cThrust;}
@@ -238,7 +238,7 @@ public:
FGTable* GetCpMachTable(void) const { return CpMach; }
/// Retrieves the Torque in foot-pounds (Don't you love the English system?)
- double GetTorque(void) { return vTorque(eX); }
+ double GetTorque(void) const { return vTorque(eX); }
/** Retrieves the power required (or "absorbed") by the propeller -
i.e. the power required to keep spinning the propeller at the current
@@ -255,16 +255,16 @@ public:
would be slowed.
@return the thrust in pounds */
double Calculate(double EnginePower);
- FGColumnVector3 GetPFactor(void);
- string GetThrusterLabels(int id, string delimeter);
- string GetThrusterValues(int id, string delimeter);
+ FGColumnVector3 GetPFactor(void) const;
+ string GetThrusterLabels(int id, const string& delimeter);
+ string GetThrusterValues(int id, const string& delimeter);
void SetReverseCoef (double c) { Reverse_coef = c; }
- double GetReverseCoef (void) { return Reverse_coef; }
+ double GetReverseCoef (void) const { return Reverse_coef; }
void SetReverse (bool r) { Reversed = r; }
- bool GetReverse (void) { return Reversed; }
+ bool GetReverse (void) const { return Reversed; }
void SetFeather (bool f) { Feathered = f; }
- bool GetFeather (void) { return Feathered; }
+ bool GetFeather (void) const { return Feathered; }
double GetThrustCoefficient(void) const {return ThrustCoeff;}
double GetHelicalTipMach(void) const {return HelicalTipMach;}
int GetConstantSpeed(void) const {return ConstantSpeed;}
diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.cpp b/src/FDM/JSBSim/models/propulsion/FGTank.cpp
index 718185a65..6c53d56f2 100644
--- a/src/FDM/JSBSim/models/propulsion/FGTank.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGTank.cpp
@@ -47,7 +47,7 @@ using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id: FGTank.cpp,v 1.32 2011/09/18 13:04:34 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGTank.cpp,v 1.33 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_TANK;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -197,14 +197,14 @@ void FGTank::ResetToIC(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-const FGColumnVector3 FGTank::GetXYZ(void)
+FGColumnVector3 FGTank::GetXYZ(void) const
{
return vXYZ_drain + (Contents/Capacity)*(vXYZ - vXYZ_drain);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGTank::GetXYZ(int idx)
+double FGTank::GetXYZ(int idx) const
{
return vXYZ_drain(idx) + (Contents/Capacity)*(vXYZ(idx)-vXYZ_drain(idx));
}
@@ -331,7 +331,7 @@ void FGTank::CalculateInertias(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGTank::ProcessFuelName(std::string const& name)
+double FGTank::ProcessFuelName(const std::string& name)
{
if (name == "AVGAS") return 6.02;
else if (name == "JET-A") return 6.74;
diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.h b/src/FDM/JSBSim/models/propulsion/FGTank.h
index c5c97ce98..c1cfa020f 100644
--- a/src/FDM/JSBSim/models/propulsion/FGTank.h
+++ b/src/FDM/JSBSim/models/propulsion/FGTank.h
@@ -52,7 +52,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_TANK "$Id: FGTank.h,v 1.25 2011/09/18 13:04:34 bcoconni Exp $"
+#define ID_TANK "$Id: FGTank.h,v 1.26 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@@ -226,26 +226,26 @@ public:
/** Retrieves the type of tank: Fuel or Oxidizer.
@return the tank type, 0 for undefined, 1 for fuel, and 2 for oxidizer.
*/
- int GetType(void) {return Type;}
+ int GetType(void) const {return Type;}
/** Resets the tank parameters to the initial conditions */
void ResetToIC(void);
/** If the tank is set to supply fuel, this function returns true.
@return true if this tank is set to a non-zero priority.*/
- bool GetSelected(void) {return Selected;}
+ bool GetSelected(void) const {return Selected;}
/** Gets the tank fill level.
@return the fill level in percent, from 0 to 100.*/
- double GetPctFull(void) {return PctFull;}
+ double GetPctFull(void) const {return PctFull;}
/** Gets the capacity of the tank.
@return the capacity of the tank in pounds. */
- double GetCapacity(void) {return Capacity;}
+ double GetCapacity(void) const {return Capacity;}
/** Gets the capacity of the tank.
@return the capacity of the tank in gallons. */
- double GetCapacityGallons(void) {return Capacity/Density;}
+ double GetCapacityGallons(void) const {return Capacity/Density;}
/** Gets the contents of the tank.
@return the contents of the tank in pounds. */
@@ -260,24 +260,24 @@ public:
given in the configuration file.
@return the temperature of the fuel in degrees C IF an initial temperature
is given, otherwise 0.0 C is returned. */
- double GetTemperature_degC(void) {return Temperature;}
+ double GetTemperature_degC(void) const {return Temperature;}
/** Gets the temperature of the fuel.
The temperature of the fuel is calculated if an initial tempearture is
given in the configuration file.
@return the temperature of the fuel in degrees F IF an initial temperature
is given, otherwise 32 degrees F is returned. */
- double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
+ double GetTemperature(void) const {return CelsiusToFahrenheit(Temperature);}
/** Returns the density of a named fuel type.
@return the density, in lbs/gal, or 6.6 if name cannot be resolved. */
- double ProcessFuelName(std::string const& name);
+ double ProcessFuelName(const std::string& name);
- double GetIxx(void) {return Ixx;}
- double GetIyy(void) {return Iyy;}
- double GetIzz(void) {return Izz;}
+ double GetIxx(void) const {return Ixx;}
+ double GetIyy(void) const {return Iyy;}
+ double GetIzz(void) const {return Izz;}
- double GetStandpipe(void) {return Standpipe;}
+ double GetStandpipe(void) const {return Standpipe;}
int GetPriority(void) const {return Priority;}
void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; }
@@ -288,10 +288,10 @@ public:
double GetExternalFlow(void) const {return ExternalFlow;}
void SetExternalFlow(double f) { ExternalFlow = f; }
- const FGColumnVector3 GetXYZ(void);
- double GetXYZ(int idx);
+ FGColumnVector3 GetXYZ(void) const;
+ double GetXYZ(int idx) const;
- const GrainType GetGrainType(void) {return grainType;}
+ const GrainType GetGrainType(void) const {return grainType;}
double Fill(double amount);
void SetContents(double amount);
From ebcc6359b97a64321226a8ed37cf1fce9d1c14d9 Mon Sep 17 00:00:00 2001
From: Erik Hofman
Date: Fri, 25 Nov 2011 13:39:10 +0100
Subject: [PATCH 05/16] Initials sound support for AI models.
---
src/AIModel/AIBase.cxx | 49 ++++++++++++++++++++++++++++++------------
src/AIModel/AIBase.hxx | 24 +++++++++++++++++++++
src/Sound/fg_fx.cxx | 2 +-
3 files changed, 60 insertions(+), 15 deletions(-)
diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx
index 2d7edd550..52eaea041 100644
--- a/src/AIModel/AIBase.cxx
+++ b/src/AIModel/AIBase.cxx
@@ -24,6 +24,8 @@
# include
#endif
+#include
+
#include
#include
@@ -72,6 +74,8 @@ FGAIBase::FGAIBase(object_type ot, bool enableHot) :
_refID( _newAIModelID() ),
_otype(ot),
_initialized(false),
+ _aimodel(0),
+ _fxpath(""),
_fx(0)
{
@@ -139,11 +143,12 @@ FGAIBase::~FGAIBase() {
if (parent)
model_removed->setStringValue(props->getPath());
}
- delete _fx;
- _fx = 0;
delete fp;
fp = 0;
+
+// delete _fx;
+// _fx = 0;
}
/** Cleanly remove the model
@@ -216,6 +221,20 @@ void FGAIBase::update(double dt) {
velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec, pitch*speed );
_fx->set_velocity( velocity );
}
+ else if (_aimodel)
+ {
+ string fxpath = _aimodel->get_sound_path();
+ if (fxpath != "")
+ {
+ _fxpath = fxpath;
+ props->setStringValue("sim/sound/path", _fxpath.c_str());
+
+ // initialize the sound configuration
+ SGSoundMgr *smgr = globals->get_soundmgr();
+ _fx = new FGFX(smgr, "aifx:"+_name+"-"+_callsign, props);
+ _fx->init();
+ }
+ }
}
/** update LOD properties of the model */
@@ -285,7 +304,8 @@ bool FGAIBase::init(bool search_in_AI_path) {
else
_installed = true;
- osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, new FGNasalModelData(props));
+ _aimodel = new FGAIModelData(props);
+ osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, _aimodel);
if (_model.valid())
{
@@ -314,17 +334,6 @@ bool FGAIBase::init(bool search_in_AI_path) {
// Get the sound-path tag from the configuration file and store it
// in the property tree.
- string fxpath = props->getStringValue("sim/sound/path");
- if ( !fxpath.empty() )
- {
- props->setStringValue("sim/sound/path", fxpath.c_str());
-
- // initialize the sound configuration
- SGSoundMgr *smgr = globals->get_soundmgr();
- _fx = new FGFX(smgr, "aifx:"+f, props);
- _fx->init();
- }
-
_initialized = true;
} else if (!model_path.empty()) {
@@ -884,3 +893,15 @@ int FGAIBase::_newAIModelID() {
return id;
}
+
+void FGAIModelData::modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n)
+{
+ const char* fxpath = prop->getStringValue("sound/path");
+ if (fxpath) {
+ string sound_path = string(fxpath);
+ if (sound_path != "") {
+ _path = "/AI/"+sound_path;
+ }
+ }
+ _nasal->modelLoaded(path, prop, n);
+}
diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx
index 726ce303b..9990387f5 100644
--- a/src/AIModel/AIBase.hxx
+++ b/src/AIModel/AIBase.hxx
@@ -34,6 +34,7 @@
#include
+#include
#include
@@ -44,6 +45,8 @@ class SGMaterial;
class FGAIManager;
class FGAIFlightPlan;
class FGFX;
+class FGAIModelData; // define dblow
+
class FGAIBase : public SGReferenced {
@@ -226,6 +229,10 @@ private:
object_type _otype;
bool _initialized;
osg::ref_ptr _model; //The 3D model LOD object
+
+ FGAIModelData* _aimodel;
+
+ string _fxpath;
SGSharedPtr _fx;
public:
@@ -441,4 +448,21 @@ inline void FGAIBase::setMaxSpeed(double m) {
_max_speed = m;
}
+
+class FGAIModelData : public simgear::SGModelData {
+public:
+ FGAIModelData(SGPropertyNode *root = 0)
+ : _nasal( new FGNasalModelData(root) ),
+ _path("") {};
+ ~FGAIModelData() {
+ delete _nasal;
+ };
+ void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n);
+ inline string& get_sound_path() { return _path; };
+
+private:
+ FGNasalModelData *_nasal;
+ string _path;
+};
+
#endif // _FG_AIBASE_HXX
diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx
index 7aad56b0b..c8c6b49f3 100644
--- a/src/Sound/fg_fx.cxx
+++ b/src/Sound/fg_fx.cxx
@@ -79,7 +79,7 @@ FGFX::init()
string path_str = node->getStringValue("path");
if (path_str.empty()) {
- SG_LOG(SG_SOUND, SG_ALERT, "No path in /sim/sound/path");
+ SG_LOG(SG_SOUND, SG_ALERT, "No path in sim/sound/path");
return;
}
From 90c5c9f87a877e290d26f19d2a0e856983826e88 Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Fri, 25 Nov 2011 15:31:22 +0100
Subject: [PATCH 06/16] cmake: lib vs lib64 handling for simgear simgear now
always uses CMAKE_INSTALL_LIBDIR for lib installation, so also use that when
searching.
---
CMakeModules/FindSimGear.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index cd966f0d6..618f01f04 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -54,7 +54,7 @@ FIND_LIBRARY(SIMGEAR_LIBRARIES
NAMES simgear SimGear
HINTS
$ENV{SIMGEAR_DIR}
- PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -75,7 +75,7 @@ macro(find_sg_component comp libs)
FIND_LIBRARY(${compLibName}_DEBUG
NAMES ${compLib}${CMAKE_DEBUG_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
@@ -84,7 +84,7 @@ macro(find_sg_component comp libs)
FIND_LIBRARY(${compLibName}_RELEASE
NAMES ${compLib}${CMAKE_RELEASE_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
From b54defea52a18a5351a4ed04c33159892b0fa60d Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Sat, 26 Nov 2011 16:41:35 +0100
Subject: [PATCH 07/16] cmake: fix sequence of (static) library dependencies
sgmath depends on sgprops, sgprops depends on sgstructure. Also, core
libraries are enough for fgadmin.
---
CMakeLists.txt | 4 ++--
CMakeModules/FindSimGear.cmake | 7 ++++---
src/CMakeLists.txt | 4 ++--
utils/fgadmin/src/CMakeLists.txt | 4 ++--
utils/fgpanel/CMakeLists.txt | 7 ++++---
5 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1b568b0b..725d8134c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,7 +173,7 @@ find_package(Threads REQUIRED)
find_package(OpenGL REQUIRED)
find_package(OpenAL REQUIRED)
find_package(ALUT REQUIRED)
-find_package(OpenSceneGraph 2.8.1 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
+find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
if(ENABLE_FGADMIN)
find_package(FLTK)
@@ -298,7 +298,7 @@ add_subdirectory(utils)
add_subdirectory(man)
set (INSTALL_DOCS
- README
+ README
README.OpenAL
README.plib
README.OSG
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index 618f01f04..79887afdc 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -126,14 +126,15 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
io
serial
sound
- structure
+ math
props
+ structure
xml
misc
threads
debug
magvar
- math)
+ )
set(scene_comps
ephem
@@ -146,7 +147,7 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
foreach(component ${comps})
find_sg_component(${component} SIMGEAR_CORE_LIBRARIES)
endforeach()
-
+
foreach(component ${scene_comps})
find_sg_component(${component} SIMGEAR_LIBRARIES)
endforeach()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3edc66fae..06bc6e350 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,8 +16,8 @@ foreach( mylibfolder
Instrumentation
Model
MultiPlayer
- AIModel
- Navaids
+ AIModel
+ Navaids
Network
Scenery
Scripting
diff --git a/utils/fgadmin/src/CMakeLists.txt b/utils/fgadmin/src/CMakeLists.txt
index e0f623b60..6a6c76bc4 100644
--- a/utils/fgadmin/src/CMakeLists.txt
+++ b/utils/fgadmin/src/CMakeLists.txt
@@ -6,10 +6,10 @@ add_executable(fgadmin fgadmin_funcs.cxx main.cxx untarka.c)
add_dependencies(fgadmin FGAdminUI)
target_link_libraries(fgadmin FGAdminUI
- ${SIMGEAR_LIBRARIES}
+ ${SIMGEAR_CORE_LIBRARIES}
${PLIB_LIBRARIES}
${FLTK_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
)
-
+
install(TARGETS fgadmin RUNTIME DESTINATION bin)
diff --git a/utils/fgpanel/CMakeLists.txt b/utils/fgpanel/CMakeLists.txt
index 2678babe6..c90b770d6 100644
--- a/utils/fgpanel/CMakeLists.txt
+++ b/utils/fgpanel/CMakeLists.txt
@@ -6,7 +6,7 @@ if(GLUT_FOUND)
message(STATUS "found glut")
add_executable(fgpanel main.cxx
- ApplicationProperties.hxx
+ ApplicationProperties.hxx
FGGLApplication.cxx
FGGLApplication.hxx
FGPanelApplication.cxx
@@ -22,7 +22,8 @@ if(GLUT_FOUND)
panel.cxx
panel.hxx
panel_io.cxx
- panel_io.hxx)
+ panel_io.hxx
+ )
target_link_libraries(fgpanel
${PNG_LIBRARIES}
@@ -31,7 +32,7 @@ if(GLUT_FOUND)
${OPENGL_LIBRARIES}
${PLIB_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
- )
+ )
install(TARGETS fgpanel RUNTIME DESTINATION bin)
else()
From 2c8da4c122047007d73f97b00bb8641705a82f19 Mon Sep 17 00:00:00 2001
From: Erik Hofman
Date: Sun, 27 Nov 2011 10:52:28 +0100
Subject: [PATCH 08/16] fix a typo
---
src/AIModel/AIBase.hxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx
index 9990387f5..3a6e2e22d 100644
--- a/src/AIModel/AIBase.hxx
+++ b/src/AIModel/AIBase.hxx
@@ -45,7 +45,7 @@ class SGMaterial;
class FGAIManager;
class FGAIFlightPlan;
class FGFX;
-class FGAIModelData; // define dblow
+class FGAIModelData; // defined below
class FGAIBase : public SGReferenced {
From f89ad9baf0f72d613c755f4fb3704f57ff7ef973 Mon Sep 17 00:00:00 2001
From: Erik Hofman
Date: Sun, 27 Nov 2011 13:48:04 +0100
Subject: [PATCH 09/16] Move some code from the header file to the source file.
---
src/AIModel/AIBase.cxx | 11 +++++++++++
src/AIModel/AIBase.hxx | 12 ++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx
index 52eaea041..f202cfc15 100644
--- a/src/AIModel/AIBase.cxx
+++ b/src/AIModel/AIBase.cxx
@@ -894,6 +894,17 @@ int FGAIBase::_newAIModelID() {
}
+FGAIModelData::FGAIModelData(SGPropertyNode *root)
+ : _nasal( new FGNasalModelData(root) ),
+ _path("")
+{
+}
+
+FGAIModelData::~FGAIModelData()
+{
+ delete _nasal;
+}
+
void FGAIModelData::modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n)
{
const char* fxpath = prop->getStringValue("sound/path");
diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx
index 3a6e2e22d..f09a96e00 100644
--- a/src/AIModel/AIBase.hxx
+++ b/src/AIModel/AIBase.hxx
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -33,8 +34,6 @@
#include
-
-#include
#include
@@ -45,6 +44,7 @@ class SGMaterial;
class FGAIManager;
class FGAIFlightPlan;
class FGFX;
+class FGNasalModelData;
class FGAIModelData; // defined below
@@ -451,12 +451,8 @@ inline void FGAIBase::setMaxSpeed(double m) {
class FGAIModelData : public simgear::SGModelData {
public:
- FGAIModelData(SGPropertyNode *root = 0)
- : _nasal( new FGNasalModelData(root) ),
- _path("") {};
- ~FGAIModelData() {
- delete _nasal;
- };
+ FGAIModelData(SGPropertyNode *root = 0);
+ ~FGAIModelData();
void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n);
inline string& get_sound_path() { return _path; };
From 99bb79c7d59dee204bdef006808e6f8c61ed924b Mon Sep 17 00:00:00 2001
From: Erik Hofman
Date: Sun, 27 Nov 2011 15:10:44 +0100
Subject: [PATCH 10/16] Properly remove FGFX classes when not needed anymore
---
src/AIModel/AIBase.cxx | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx
index f202cfc15..d2e2fe25d 100644
--- a/src/AIModel/AIBase.cxx
+++ b/src/AIModel/AIBase.cxx
@@ -38,6 +38,7 @@
#include
#include
#include
+#include
#include
#include
@@ -144,11 +145,13 @@ FGAIBase::~FGAIBase() {
model_removed->setStringValue(props->getPath());
}
+ if (_refID != 0 && _refID != 1) {
+ SGSoundMgr *smgr = globals->get_soundmgr();
+ smgr->remove("aifx:"+_refID);
+ }
+
delete fp;
fp = 0;
-
-// delete _fx;
-// _fx = 0;
}
/** Cleanly remove the model
@@ -231,7 +234,7 @@ void FGAIBase::update(double dt) {
// initialize the sound configuration
SGSoundMgr *smgr = globals->get_soundmgr();
- _fx = new FGFX(smgr, "aifx:"+_name+"-"+_callsign, props);
+ _fx = new FGFX(smgr, "aifx:"+_refID, props);
_fx->init();
}
}
From 62810e3f9a0dd581d6dd2412406530c509c64f57 Mon Sep 17 00:00:00 2001
From: James Turner
Date: Mon, 28 Nov 2011 18:23:34 +0000
Subject: [PATCH 11/16] Re-structure the SimGear detection, to bypass
shared-library checks by default (and unless explicitly requested). Should
fix the confusion in the GUI tools about the type of SIMGEAR_LIBRARIES (i.e
it should be a list, not a path).
---
CMakeModules/FindSimGear.cmake | 103 ++++++++++++++++++---------------
1 file changed, 57 insertions(+), 46 deletions(-)
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index 79887afdc..e1becbea2 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -1,6 +1,8 @@
# Locate SimGear
# This module defines
-# SIMGEAR_LIBRARIES
+
+# SIMGEAR_CORE_LIBRARIES, a list of the core static libraries
+# SIMGEAR_LIBRARIES, a list of all the static libraries (core + scene)
# SIMGEAR_FOUND, if false, do not try to link to SimGear
# SIMGEAR_INCLUDE_DIR, where to find the headers
#
@@ -23,50 +25,8 @@
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
-# Per my request, CMake should search for frameworks first in
-# the following order:
-# ~/Library/Frameworks/SimGear.framework/Headers
-# /Library/Frameworks/SimGear.framework/Headers
-# /System/Library/Frameworks/SimGear.framework/Headers
-#
-# On OS X, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# SimGear_LIBRARIES to override this selection or set the CMake environment
-# CMAKE_INCLUDE_PATH to modify the search paths.
-
include(SelectLibraryConfigurations)
-FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
- HINTS $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES include
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /opt
-)
-
-message(STATUS ${SIMGEAR_INCLUDE_DIR})
-
-# check for dynamic framework/library
-FIND_LIBRARY(SIMGEAR_LIBRARIES
- NAMES simgear SimGear
- HINTS
- $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /opt
-)
-
-# dependent packages
-find_package(ZLIB REQUIRED)
-find_package(Threads REQUIRED)
-
macro(find_sg_component comp libs)
set(compLib "sg${comp}")
string(TOUPPER "SIMGEAR_${comp}" compLibBase)
@@ -106,10 +66,62 @@ macro(find_sg_component comp libs)
endif()
endmacro()
+FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
+ HINTS $ENV{SIMGEAR_DIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /opt
+)
+
+message(STATUS ${SIMGEAR_INCLUDE_DIR})
+
+# dependent packages
+find_package(ZLIB REQUIRED)
+find_package(Threads REQUIRED)
+
+if(SIMGEAR_SHARED)
+ message(STATUS "looking for shared Simgear libraries")
+
+ # check for dynamic framework/library (experimental!)
+ FIND_LIBRARY(SIMGEAR_SHARED_CORE_LIBRARY
+ NAMES simgearCore SimGearCore
+ HINTS
+ $ENV{SIMGEAR_DIR}
+ PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /opt
+ )
+
+ FIND_LIBRARY(SIMGEAR_SHARED_SCENE_LIBRARY
+ NAMES simgearScene SimGearScene
+ HINTS
+ $ENV{SIMGEAR_DIR}
+ PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /opt
+ )
+
+ set(SIMGEAR_CORE_LIBRARIES ${SIMGEAR_SHARED_CORE_LIBRARY})
+ set(SIMGEAR_LIBRARIES ${SIMGEAR_SHARED_SCENE_LIBRARY} ${SIMGEAR_SHARED_CORE_LIBRARY})
+ set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES "")
+
+else(SIMGEAR_SHARED)
-if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
set(SIMGEAR_LIBRARIES "") # clear value
set(SIMGEAR_CORE_LIBRARIES "") # clear value
+ message(STATUS "looking for static Simgear libraries")
# note the order here affects the order Simgear libraries are
# linked in, and hence ability to link when using a traditional
@@ -173,8 +185,7 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
endif(have_rt)
endif(NOT clock_gettime_in_libc)
endif(NOT MSVC)
-
-endif()
+endif(SIMGEAR_SHARED)
# now we've found SimGear, check its version
From f054f156934150ef132317825b5964774a5b472c Mon Sep 17 00:00:00 2001
From: James Turner
Date: Tue, 29 Nov 2011 10:24:33 +0000
Subject: [PATCH 12/16] Fixes for linking with shared SimGear.
---
CMakeModules/FindSimGear.cmake | 16 +++++++++++-----
src/Instrumentation/HUD/HUD_runway.cxx | 2 +-
src/Main/CMakeLists.txt | 4 +---
utils/GPSsmooth/CMakeLists.txt | 3 +++
4 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index e1becbea2..3d7b271bb 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -116,6 +116,7 @@ if(SIMGEAR_SHARED)
set(SIMGEAR_CORE_LIBRARIES ${SIMGEAR_SHARED_CORE_LIBRARY})
set(SIMGEAR_LIBRARIES ${SIMGEAR_SHARED_SCENE_LIBRARY} ${SIMGEAR_SHARED_CORE_LIBRARY})
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES "")
+ set(SIMGEAR_SCENE_LIBRARY_DEPENDENCIES "")
else(SIMGEAR_SHARED)
@@ -127,17 +128,13 @@ else(SIMGEAR_SHARED)
# linked in, and hence ability to link when using a traditional
# linker such as GNU ld on Linux
set(comps
- tsync
environment
nasal
bucket
- bvh
- util
route
timing
io
serial
- sound
math
props
structure
@@ -149,12 +146,16 @@ else(SIMGEAR_SHARED)
)
set(scene_comps
+ tsync
ephem
sky
material
tgdb
model
- screen)
+ screen
+ bvh
+ util
+ sound)
foreach(component ${comps})
find_sg_component(${component} SIMGEAR_CORE_LIBRARIES)
@@ -171,6 +172,11 @@ else(SIMGEAR_SHARED)
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY})
+ set(SIMGEAR_SCENE_LIBRARY_DEPENDENCIES
+ ${ALUT_LIBRARY}
+ ${OPENAL_LIBRARY}
+ ${LIBSVN_LIBRARIES})
+
if(WIN32)
list(APPEND SIMGEAR_CORE_LIBRARY_DEPENDENCIES ws2_32.lib)
endif(WIN32)
diff --git a/src/Instrumentation/HUD/HUD_runway.cxx b/src/Instrumentation/HUD/HUD_runway.cxx
index 6f05a706a..42f2e44ac 100644
--- a/src/Instrumentation/HUD/HUD_runway.cxx
+++ b/src/Instrumentation/HUD/HUD_runway.cxx
@@ -25,7 +25,7 @@
#include
#include
-#include
+#include
#include
#include
diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt
index e3e06aa8c..18bb7f9dc 100644
--- a/src/Main/CMakeLists.txt
+++ b/src/Main/CMakeLists.txt
@@ -73,14 +73,12 @@ target_link_libraries(fgfs
${FG_LIBS}
${SIMGEAR_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES}
- ${ALUT_LIBRARY}
- ${OPENAL_LIBRARY}
${OPENGL_LIBRARIES}
${PLIB_LIBRARIES}
${JPEG_LIBRARY}
- ${LIBSVN_LIBRARIES}
${HLA_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
+ ${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
${PLATFORM_LIBS}
)
diff --git a/utils/GPSsmooth/CMakeLists.txt b/utils/GPSsmooth/CMakeLists.txt
index ecfdde70f..47bc1d54f 100644
--- a/utils/GPSsmooth/CMakeLists.txt
+++ b/utils/GPSsmooth/CMakeLists.txt
@@ -13,6 +13,7 @@ target_link_libraries(GPSsmooth
${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
+ ${ZLIB_LIBRARY}
${WINMM_LIBRARY}
)
@@ -21,6 +22,7 @@ target_link_libraries(MIDGsmooth
${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY}
${WINMM_LIBRARY}
+ ${ZLIB_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
)
@@ -29,6 +31,7 @@ target_link_libraries(UGsmooth
${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY}
${WINMM_LIBRARY}
+ ${ZLIB_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
)
From f35685471242981cbd8a2b6a867f723102bdd626 Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Wed, 30 Nov 2011 19:56:44 +0100
Subject: [PATCH 13/16] Set correct installation folder for documentation Also
fix build when ".gitignore" is absent (i.e. building a cleaned tar-ball).
---
CMakeLists.txt | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 725d8134c..bb023c0e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,9 +5,16 @@ include (CheckCSourceCompiles)
include (CheckCXXSourceCompiles)
include (CheckIncludeFile)
-
project(FlightGear)
+if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
+ # use official include provided by latest CMake
+ include(GNUInstallDirs)
+else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
+ # backward compatibility: use our own module for older cmake versions
+ include(OldGNUInstallDirs)
+endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
+
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
@@ -18,9 +25,15 @@ file(READ version versionFile)
string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
#packaging
+if(EXISTS ${PROJECT_SOURCE_DIR}/.gitignore)
+ file(READ .gitignore CPACK_SOURCE_IGNORE_FILES)
+else()
+ # clean tar-balls do not contain SCM (.git/.gitignore/...) files.
+ set(CPACK_SOURCE_IGNORE_FILES
+ "^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
+endif()
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
-file(READ .gitignore CPACK_SOURCE_IGNORE_FILES)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${FLIGHTGEAR_VERSION} )
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
@@ -30,8 +43,6 @@ SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
set(CPACK_SOURCE_GENERATOR TBZ2 ZIP)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTERNAL "tarball basename")
-#set(CPACK_SOURCE_IGNORE_FILES
-# "^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)
@@ -304,7 +315,7 @@ set (INSTALL_DOCS
README.OSG
README.SimGear)
-INSTALL(FILES ${INSTALL_DOCS} DESTINATION doc OPTIONAL)
+INSTALL(FILES ${INSTALL_DOCS} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
#-----------------------------------------------------------------------------
### uninstall target
From cdc65753f06237eb3aa560339f29b06304eab5eb Mon Sep 17 00:00:00 2001
From: James Turner
Date: Wed, 30 Nov 2011 19:19:49 +0000
Subject: [PATCH 14/16] Refactor SimGear detection to correctly select debug vs
release builds in shared library mode.
---
CMakeModules/FindSimGear.cmake | 86 ++++++++++++++++------------------
1 file changed, 40 insertions(+), 46 deletions(-)
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index 3d7b271bb..84ee6649f 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -27,13 +27,11 @@
include(SelectLibraryConfigurations)
-macro(find_sg_component comp libs)
- set(compLib "sg${comp}")
- string(TOUPPER "SIMGEAR_${comp}" compLibBase)
- set( compLibName ${compLibBase}_LIBRARY )
-
- FIND_LIBRARY(${compLibName}_DEBUG
- NAMES ${compLib}${CMAKE_DEBUG_POSTFIX}
+macro(find_sg_library libName varName libs)
+ set(libVarName "${varName}_LIBRARY")
+
+ FIND_LIBRARY(${libVarName}_DEBUG
+ NAMES ${libName}${CMAKE_DEBUG_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
@@ -41,8 +39,8 @@ macro(find_sg_component comp libs)
/usr
/opt
)
- FIND_LIBRARY(${compLibName}_RELEASE
- NAMES ${compLib}${CMAKE_RELEASE_POSTFIX}
+ FIND_LIBRARY(${libVarName}_RELEASE
+ NAMES ${libName}${CMAKE_RELEASE_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
@@ -50,14 +48,22 @@ macro(find_sg_component comp libs)
/usr
/opt
)
- select_library_configurations( ${compLibBase} )
+
+ # message(STATUS "before: Simgear ${${libVarName}_RELEASE} ")
+ # message(STATUS "before: Simgear ${${libVarName}_DEBUG} ")
+
+ select_library_configurations( ${varName} )
- set(componentLibRelease ${${compLibName}_RELEASE})
- #message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
- set(componentLibDebug ${${compLibName}_DEBUG})
- #message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
- if (NOT ${compLibName}_DEBUG)
- if (NOT ${compLibName}_RELEASE)
+ # message(STATUS "after:Simgear ${${libVarName}_RELEASE} ")
+ # message(STATUS "after:Simgear ${${libVarName}_DEBUG} ")
+
+ set(componentLibRelease ${${libVarName}_RELEASE})
+ # message(STATUS "Simgear ${libVarName}_RELEASE ${componentLibRelease}")
+ set(componentLibDebug ${${libVarName}_DEBUG})
+ # message(STATUS "Simgear ${libVarName}_DEBUG ${componentLibDebug}")
+
+ if (NOT ${libVarName}_DEBUG)
+ if (NOT ${libVarName}_RELEASE)
#message(STATUS "found ${componentLib}")
list(APPEND ${libs} ${componentLibRelease})
endif()
@@ -66,6 +72,13 @@ macro(find_sg_component comp libs)
endif()
endmacro()
+macro(find_sg_component comp libs)
+ set(compLib "sg${comp}")
+ string(TOUPPER "SIMGEAR_${comp}" libVar)
+
+ find_sg_library(${compLib} ${libVar} ${libs})
+endmacro()
+
FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES include
@@ -77,7 +90,7 @@ FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
/opt
)
-message(STATUS ${SIMGEAR_INCLUDE_DIR})
+# message(STATUS ${SIMGEAR_INCLUDE_DIR})
# dependent packages
find_package(ZLIB REQUIRED)
@@ -86,38 +99,16 @@ find_package(Threads REQUIRED)
if(SIMGEAR_SHARED)
message(STATUS "looking for shared Simgear libraries")
- # check for dynamic framework/library (experimental!)
- FIND_LIBRARY(SIMGEAR_SHARED_CORE_LIBRARY
- NAMES simgearCore SimGearCore
- HINTS
- $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /opt
- )
+ find_sg_library(SimGearCore SIMGEAR_CORE SIMGEAR_CORE_LIBRARIES)
+ find_sg_library(SimGearScene SIMGEAR_SCENE SIMGEAR_LIBRARIES)
- FIND_LIBRARY(SIMGEAR_SHARED_SCENE_LIBRARY
- NAMES simgearScene SimGearScene
- HINTS
- $ENV{SIMGEAR_DIR}
- PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /opt
- )
-
- set(SIMGEAR_CORE_LIBRARIES ${SIMGEAR_SHARED_CORE_LIBRARY})
- set(SIMGEAR_LIBRARIES ${SIMGEAR_SHARED_SCENE_LIBRARY} ${SIMGEAR_SHARED_CORE_LIBRARY})
+
+ list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES "")
set(SIMGEAR_SCENE_LIBRARY_DEPENDENCIES "")
+ # message(STATUS "core lib ${SIMGEAR_CORE_LIBRARIES}")
+ # message(STATUS "all libs ${SIMGEAR_LIBRARIES}")
else(SIMGEAR_SHARED)
set(SIMGEAR_LIBRARIES "") # clear value
@@ -165,9 +156,12 @@ else(SIMGEAR_SHARED)
find_sg_component(${component} SIMGEAR_LIBRARIES)
endforeach()
- # again link order matters - scene libraires depend on core ones
+
+ # again link order matters - scene libraries depend on core ones
list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
+ #message(STATUS "all libs ${SIMGEAR_LIBRARIES}")
+
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY})
From 32c4cfa768b37b4ed3179dc49984982a23d9d2d0 Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Wed, 30 Nov 2011 21:45:22 +0100
Subject: [PATCH 15/16] Fix shared library build for metar executable
---
src/Main/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt
index 18bb7f9dc..827e09f80 100644
--- a/src/Main/CMakeLists.txt
+++ b/src/Main/CMakeLists.txt
@@ -88,6 +88,7 @@ add_executable(metar metar_main.cxx)
target_link_libraries(metar
${SIMGEAR_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
+ ${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
${PLATFORM_LIBS}
)
From 4845037bd76074e51e947fe2d30cb5c5b933d417 Mon Sep 17 00:00:00 2001
From: ThorstenB
Date: Wed, 30 Nov 2011 23:33:03 +0100
Subject: [PATCH 16/16] Fix build with CMake 2.6.4 Set search path early
enough, so fallback module for CMake 2.6 is found.
---
CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb023c0e9..ffea91c25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,9 @@ include (CheckIncludeFile)
project(FlightGear)
+# We have some custom .cmake scripts not in the official distribution.
+set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
+
if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
# use official include provided by latest CMake
include(GNUInstallDirs)
@@ -46,9 +49,6 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTE
include (CPack)
-# We have some custom .cmake scripts not in the official distribution.
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
-
if (FG_DATA_DIR)
message(STATUS "Using explicit data-dir: ${FG_DATA_DIR}")
else()