diff --git a/conf/modules/fdm_jsbsim.xml b/conf/modules/fdm_jsbsim.xml
index 032ba95647..b02ab74148 100644
--- a/conf/modules/fdm_jsbsim.xml
+++ b/conf/modules/fdm_jsbsim.xml
@@ -5,28 +5,38 @@
JSBSim FDM backend for NPS simulator
- Use the paparazzi-jsbsim package if it is installed, otherwise look for JSBsim under /opt/jsbsim
+ Use the paparazzi-jsbsim package if it is installed, otherwise look for JSBsim under /usr
- JSBSim doc: http://wiki.paparazziuav.org/wiki/JSBSim
+ JSBSim website: https://jsbsim-team.github.io/jsbsim-reference-manual/
+ JSBSim source: https://github.com/JSBSim-Team/jsbsim
+ JSBSim/PPRZ doc: http://wiki.paparazziuav.org/wiki/JSBSim
NPS doc: http://wiki.paparazziuav.org/wiki/NPS
-
+
+
-
+
+
ifeq ($(FIND_JSBSIM_VIA_PKG_CONFIG), yes)
nps.CFLAGS += $(shell pkg-config JSBSim --cflags)
nps.LDFLAGS += $(shell pkg-config JSBSim --libs)
+ ifeq ($(shell pkg-config JSBSim --modversion), 1.0)
+ nps.CFLAGS += -DNPS_JSBSIM_USE_SGPATH=FALSE
+ else
+ nps.CFLAGS += -DNPS_JSBSIM_USE_SGPATH=$(JSBSIM_USE_SGPATH)
+ endif
else
FIND_JSBSIM_VIA_PKG_CONFIG = no
nps.CFLAGS += -I$(JSBSIM_INC)
nps.LDFLAGS += -L$(JSBSIM_LIB) -lJSBSim
+ nps.CFLAGS += -DNPS_JSBSIM_USE_SGPATH=$(JSBSIM_USE_SGPATH)
endif
diff --git a/sw/simulator/nps/nps_fdm_jsbsim.cpp b/sw/simulator/nps/nps_fdm_jsbsim.cpp
index 2b73b76528..48d7439eeb 100644
--- a/sw/simulator/nps/nps_fdm_jsbsim.cpp
+++ b/sw/simulator/nps/nps_fdm_jsbsim.cpp
@@ -73,6 +73,13 @@
#define PascalOfPsf(_p) ((_p) * 47.8802588889)
#define CelsiusOfRankine(_r) (((_r) - 491.67) / 1.8)
+/// Macro to build file path according to the lib version
+#if NPS_JSBSIM_USE_SGPATH
+#define JSBSIM_PATH(_x) SGPath(_x)
+#else
+#define JSBSIM_PATH(_x) _x
+#endif
+
/** Name of the JSBSim model.
* Defaults to the AIRFRAME_NAME
*/
@@ -558,9 +565,9 @@ static void init_jsbsim(double dt)
FDMExec->DisableOutput();
FDMExec->SetDebugLevel(0); // No DEBUG messages
- if (! FDMExec->LoadModel(rootdir + "aircraft",
- rootdir + "engine",
- rootdir + "systems",
+ if (! FDMExec->LoadModel(JSBSIM_PATH(rootdir + "aircraft"),
+ JSBSIM_PATH(rootdir + "engine"),
+ JSBSIM_PATH(rootdir + "systems"),
NPS_JSBSIM_MODEL,
false)) {
#ifdef DEBUG
@@ -580,7 +587,7 @@ static void init_jsbsim(double dt)
FGInitialCondition *IC = FDMExec->GetIC();
if (!jsbsim_ic_name.empty()) {
- if (! IC->Load(jsbsim_ic_name)) {
+ if (! IC->Load(JSBSIM_PATH(jsbsim_ic_name))) {
#ifdef DEBUG
cerr << "Initialization unsuccessful" << endl;
#endif