diff --git a/Makefile.ac b/Makefile.ac
index d896d137e3..10bbb69ea9 100644
--- a/Makefile.ac
+++ b/Makefile.ac
@@ -159,6 +159,9 @@ BOOTLOADER_DEVICE=/dev/ttyUSB0
tiny_bl.upload:
lpc21isp -control $(AIRBORNE)/arm7/test/bootloader/bl.hex $(BOOTLOADER_DEVICE) 38400 12000
+jsbsim jsbsim.compile: ac_h
+ cd $(AIRBORNE); $(MAKE) TARGET=jsbsim ARCHI=jsbsim all
+
sim: ac_h
cd $(AIRBORNE); $(MAKE) TARGET=sim ARCHI=sim all
diff --git a/conf/Makefile.jsbsim b/conf/Makefile.jsbsim
new file mode 100644
index 0000000000..c62f59c42f
--- /dev/null
+++ b/conf/Makefile.jsbsim
@@ -0,0 +1,100 @@
+# Hey Emacs, this is a -*- makefile -*-
+#
+# $Id: Makefile.sim 3505 2009-06-17 12:59:32Z hecto $
+# Copyright (C) 2006 Pascal Brisset, Antoine Drouin
+#
+# This file is part of paparazzi.
+#
+# paparazzi is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# paparazzi is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with paparazzi; see the file COPYING. If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+#
+# This is the Makefile for the JSBSim target.
+# Compilator: g++
+#
+
+SRC_ARCH = sim
+
+CC = g++
+SIMDIR = $(PAPARAZZI_SRC)/sw/simulator
+
+# Launch with "make Q=''" to get full command display
+Q=@
+
+#
+# Compilation flags
+#
+
+CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -O2
+
+LDFLAGS = -lm $($(TARGET).LDFLAGS)
+
+#
+# General rules
+#
+
+$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
+$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o)
+$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
+
+all compile: $(OBJDIR)/simsitl
+
+
+$(OBJDIR)/simsitl : $($(TARGET).objs)
+ @echo LD $@
+ $(Q)$(CC) $(CFLAGS) -o $@ $($(TARGET).objs) $(LDFLAGS)
+
+
+%.s: %.c
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+%.s: %.cpp
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+$(OBJDIR)/%.s: %.c
+ @echo CC $@
+ $(Q)test -d $(dir $@) || mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+$(OBJDIR)/%.s: %.cpp
+ @echo CC $@
+ $(Q)test -d $(dir $@) || mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+$(OBJDIR)/%.o: %.c $(OBJDIR)/../Makefile.ac
+ @echo CC $@
+ $(Q)test -d $(dir $@) || mkdir -p $(dir $@)
+ $(Q)$(CC) $(CFLAGS) -c -o $@ $<
+
+$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac
+ @echo CC++ $@
+ $(Q)test -d $(dir $@) || mkdir -p $(dir $@)
+ $(Q)$(CC) $(CFLAGS) -c -o $@ $<
+
+
+#
+# Dependencies
+#
+$(OBJDIR)/.depend:
+ @test -d $(OBJDIR) || mkdir -p $(OBJDIR)
+ @echo DEPEND $@
+ $(Q)$(CC) -MM -MG $(CFLAGS) $($(TARGET).srcs) | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $@
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),erase)
+-include $(OBJDIR)/.depend
+endif
+endif
diff --git a/conf/airframes/ENAC/fixed-wing/spocII.xml b/conf/airframes/ENAC/fixed-wing/spocII.xml
index aa6f66252a..1978a6c42d 100644
--- a/conf/airframes/ENAC/fixed-wing/spocII.xml
+++ b/conf/airframes/ENAC/fixed-wing/spocII.xml
@@ -193,13 +193,19 @@
-
+
+
+
+
+
+
+
+
+
CONFIG = \"tiny_2_1_1.h\"
@@ -258,6 +264,16 @@ sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
sim.srcs += nav_line.c nav_survey_rectangle.c
+# Config for JSBSim simulation
+include $(PAPARAZZI_SRC)/conf/autopilot/sitl_jsbsim.makefile
+
+jsbsim.CFLAGS += -I/home/cocoleon/usr/include/JSBSim
+jsbsim.LDFLAGS += -L/home/cocoleon/usr/lib/
+
+jsbsim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
+jsbsim.srcs += nav_line.c nav_survey_rectangle.c
+jsbsim.srcs += $(SIMDIR)/sim_ac_fw.c
+
# a test program to setup actuators
setup_actuators.ARCHDIR = $(ARCHI)
diff --git a/conf/autopilot/sitl_jsbsim.makefile b/conf/autopilot/sitl_jsbsim.makefile
index 1cf89cf4b6..d367467f29 100644
--- a/conf/autopilot/sitl_jsbsim.makefile
+++ b/conf/autopilot/sitl_jsbsim.makefile
@@ -1,15 +1,16 @@
-SIM_TYPE = JSBSIM
-sim.ARCHDIR = $(ARCHI)
-sim.ARCH = sitl
-sim.TARGET = autopilot
-sim.TARGETDIR = autopilot
+jsbsim.ARCHDIR = $(ARCHI)
+jsbsim.ARCH = sitl
+jsbsim.TARGET = autopilot
+jsbsim.TARGETDIR = autopilot
# external libraries
-sim.CFLAGS = -I$(SIMDIR) -I/usr/include `pkg-config glib-2.0 --cflags`
-sim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lpcre -lglibivy -L/usr/lib -lJSBSim
+jsbsim.CFLAGS = -I$(SIMDIR) -I/usr/include `pkg-config glib-2.0 --cflags`
+jsbsim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lpcre -lglibivy -L/usr/lib -lJSBSim
-sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DINFRARED -DNAV -DLED -DWIND_INFO
-sim.srcs = $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/jsbsim_ir.c $(SRC_ARCH)/jsbsim_transport.c $(SRC_ARCH)/ivy_transport.c
-sim.srcs += latlong.c radio_control.c downlink.c commands.c gps.c inter_mcu.c infrared.c fw_h_ctl.c fw_v_ctl.c nav.c estimator.c sys_time.c main_fbw.c main_ap.c datalink.c
-sim.srcs += $(SIMDIR)/sim_ac_jsbsim.c
-#$(SIMDIR)/sim_ac_fw.c
+jsbsim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DINFRARED -DNAV -DLED -DWIND_INFO
+jsbsim.srcs = $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/jsbsim_ir.c $(SRC_ARCH)/jsbsim_transport.c $(SRC_ARCH)/ivy_transport.c
+jsbsim.srcs += latlong.c radio_control.c downlink.c commands.c gps.c inter_mcu.c infrared.c fw_h_ctl.c fw_v_ctl.c nav.c estimator.c sys_time.c main_fbw.c main_ap.c datalink.c
+jsbsim.srcs += $(SIMDIR)/sim_ac_jsbsim.c
+# Choose in your airframe file type of airframe
+# jsbsim.srcs += $(SIMDIR)/sim_ac_fw.c
+# jsbsim.srcs += $(SIMDIR)/sim_ac_booz.c
diff --git a/conf/simulator/Corsica/Corsica.xml b/conf/simulator/Corsica/Corsica.xml
index 2daa051a8f..f14f9af76c 100644
--- a/conf/simulator/Corsica/Corsica.xml
+++ b/conf/simulator/Corsica/Corsica.xml
@@ -52,8 +52,68 @@
-
-
+
+
+
+ 0.07
+ -0.6
+ -0.01
+
+ 0.8
+ 0.5
+ 0.02
+ 30
+ 5
+ 0.0
+ LEFT
+ 0
+
+
+
+ 0.07
+ 0.6
+ -0.01
+
+ 0.8
+ 0.5
+ 0.02
+ 30
+ 5
+ 0.0
+ RIGHT
+ 0
+
+
+
+ 0.6
+ 0.0
+ -0.01
+
+ 0.8
+ 0.5
+ 0.02
+ 6
+ 5
+ 360.0
+ NONE
+ 0
+
+
+
+ 0.01
+ 0.0
+ -0.01
+
+ 0.8
+ 0.5
+ 0.02
+ 6
+ 5
+ 360.0
+ NONE
+ 0
+
+
@@ -82,6 +142,14 @@
1.0
+
+
+ 0.7
+ 0.0
+ 0.0
+
+ 0.001
+
diff --git a/conf/simulator/Corsica/Corsica2010.xml b/conf/simulator/Corsica/Corsica2010.xml
deleted file mode 100644
index 2daa051a8f..0000000000
--- a/conf/simulator/Corsica/Corsica2010.xml
+++ /dev/null
@@ -1,388 +0,0 @@
-
-
-
-
-
- Murat Bronz
- 18/03/2010
- Version
- Corsica10 Prototype
-
-
-
- 0.21
- 1.5
- 0.14
- 0.026
- 0.6
- 0.011
- 0.6
-
- 0
- 0
- 0
-
-
- 0
- 0
- 0
-
-
- 0
- 0
- 0
-
-
-
-
- 0.125
- 0.032
- 0.156
- 0
- -0.003
- 0
- 2.0
-
- 0.067
- 0
- 0
-
-
-
-
-
-
-
-
-
-
- -0.02
- 0
- 0
-
-
- 0.0
- 0
- 0
-
- 0
-
-
- -0.02
- 0
- 0
-
-
- 0.0
- 0.0
- 0.0
-
- 1.0
-
-
-
-
-
-
-
-
- fcs/elevator-cmd-norm
- fcs/pitch-trim-cmd-norm
-
- -1
- 1
-
-
-
-
- fcs/pitch-trim-sum
-
- -0.5
- 0.5
-
-
-
-
-
- fcs/elevator-pos-rad
-
- -0.5
- 0.5
-
-
- -1
- 1
-
-
-
-
-
- fcs/aileron-cmd-norm
- fcs/roll-trim-cmd-norm
-
- -1
- 1
-
-
-
-
- fcs/roll-trim-sum
-
- -0.5
- 0.5
-
-
-
-
-
- -fcs/roll-trim-sum
-
- -0.5
- 0.5
-
-
-
-
-
- fcs/left-aileron-pos-rad
-
- -0.5
- 0.5
-
-
- -1
- 1
-
-
-
-
-
- fcs/right-aileron-pos-rad
-
- -0.5
- 0.5
-
-
- -1
- 1
-
-
-
-
-
-
-
-
-
-
-
-
- Drag_at_zero_lift
-
- aero/qbar-psf
- metrics/Sw-sqft
-
- aero/alpha-deg
-
- -10.0 0.02748
- -8.0 0.02243
- -6.0 0.02335
- -4.0 0.02770
- -2.0 0.03369
- 0.0 0.04284
- 2.0 0.05454
- 4.0 0.06868
- 6.0 0.08515
- 8.0 0.1055
- 10.0 0.1595
-
-
-
-
-
-
- Drag_due_to_Elevator_Deflection
-
- aero/qbar-psf
- metrics/Sw-sqft
- fcs/elevator-pos-deg
- 0.000094
-
-
-
-
-
-
- Side_force_due_to_beta
-
- aero/qbar-psf
- metrics/Sw-sqft
- aero/beta-rad
- -0.141391
-
-
-
-
-
-
- Lift_due_to_alpha
-
- aero/qbar-psf
- metrics/Sw-sqft
- aero/alpha-rad
- 5.1460
-
-
-
- Lift_due_to_Elevator_Deflection
-
- aero/qbar-psf
- metrics/Sw-sqft
- fcs/elevator-pos-deg
- 0.003644
-
-
-
-
-
-
- Roll_moment_due_to_beta
-
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- aero/beta-rad
- -0.04235
-
-
-
- Roll_moment_due_to_roll_rate
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- aero/bi2vel
- velocities/p-aero-rad_sec
- -0.561207
-
-
-
- Roll_moment_due_to_yaw_rate
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- aero/bi2vel
- velocities/r-aero-rad_sec
- 0.17269
-
-
-
- Roll_moment_due_to_aileron
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- fcs/right-aileron-pos-deg
- -0.004076
-
-
-
-
-
-
- Pitch_moment_due_to_alpha
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/cbarw-ft
- aero/alpha-rad
- -0.523384
-
-
-
- Pitch_moment_due_to_elevator
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/cbarw-ft
- fcs/elevator-pos-deg
- -0.014833
-
-
-
- Pitch_moment_due_to_pitch_rate
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/cbarw-ft
- aero/ci2vel
- velocities/q-aero-rad_sec
- -15.281710
-
-
-
- Pitch_moment_due_to_alpha_rate
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/cbarw-ft
- aero/ci2vel
- aero/alphadot-rad_sec
- -7.0000
-
-
-
-
-
-
- Yaw_moment_due_to_beta
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- aero/beta-rad
- 0.039729
-
-
-
- Yaw_moment_due_to_yaw_rate
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- aero/bi2vel
- velocities/r-aero-rad_sec
- -0.048425
-
-
-
- Adverse_yaw
-
- aero/qbar-psf
- metrics/Sw-sqft
- metrics/bw-ft
- fcs/right-aileron-pos-deg
- 0.00026
-
-
-
-
-
diff --git a/sw/simulator/launchsitl b/sw/simulator/launchsitl
index eb8115140d..3897a35cdc 100755
--- a/sw/simulator/launchsitl
+++ b/sw/simulator/launchsitl
@@ -12,14 +12,22 @@ let () =
try
let rec loop = fun i ->
if Sys.argv.(i) = "-a" && (i+1) < n then
- let ac = Sys.argv.(i+1) in
- (* Shift other args *)
- for j = i+2 to n-1 do Sys.argv.(j-2) <- Sys.argv.(j) done;
- ac
+ let ac = Sys.argv.(i+1) in
+ (* Shift other args *)
+ for j = i+2 to n-1 do Sys.argv.(j-2) <- Sys.argv.(j) done;
+ ac
else if i = n then raise Not_found
else loop (i+1) in
let ac = loop 0 in
- let com = paparazzi_home // "var" // ac // "sim/simsitl" in
+ (*let rec sim_type = fun i ->
+ if Sys.argv.(i) = "-jsbsim" then
+ "jsbsim"
+ else if i = n then "sim"
+ else loop (i+1) in
+ let sim = sim_type 0 in*)
+ let sim = "jsbsim" in
+ let com = paparazzi_home // "var" // ac // sim // "simsitl" in
+ prerr_endline com;
if not (Sys.file_exists com) then begin
Printf.fprintf stderr "Error: '%s' is missing. Build target sim for A/C %s ?\n" com ac;
exit 1
diff --git a/sw/simulator/sim_ac_jsbsim.c b/sw/simulator/sim_ac_jsbsim.c
index 193437fd77..7a50d2d180 100644
--- a/sw/simulator/sim_ac_jsbsim.c
+++ b/sw/simulator/sim_ac_jsbsim.c
@@ -112,7 +112,7 @@ int main ( int argc, char** argv) {
static void ivy_transport_init(void) {
- IvyInit ("Paparazzi sim " + AC_ID, "READY", NULL, NULL, NULL, NULL);
+ IvyInit ("Paparazzi jsbsim " + AC_ID, "READY", NULL, NULL, NULL, NULL);
IvyStart(ivyBus.c_str());
}
@@ -147,6 +147,9 @@ static void sim_parse_options(int argc, char** argv) {
else if (argument == "-norc") {
// Compatibility with ocaml
}
+ else if (argument == "-jsbsim") {
+ // Compatibility with ocaml
+ }
else if (argument == "-b") {
ivyBus = string(argv[++i]);
}