-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sim] moving the old ocaml simulator to NPS (#3167)
- the exact same basic model is now a NPS FDM - sim target still woks, it is just an alias to NPS with the proper FDM - the old ocaml files are removed - AHRS and INS are bypassed, since the accelerations are not well calculated by the model
- Loading branch information
1 parent
dfb08fa
commit 41451d5
Showing
52 changed files
with
376 additions
and
2,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,158 +1 @@ | ||
# Hey Emacs, this is a -*- makefile -*- | ||
# | ||
# 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 common Makefile for the sim target. | ||
# | ||
|
||
# this should not be needed | ||
SRC_ARCH = arch/sim | ||
|
||
include $(PAPARAZZI_SRC)/sw/Makefile.ocaml | ||
|
||
CC = gcc | ||
SIMDIR = $(PAPARAZZI_SRC)/sw/simulator | ||
CAMLINCLUDES = -I $(LIBPPRZDIR) -I $(SIMDIR) -I $(OBJDIR) | ||
PKG = -package glibivy,pprz | ||
LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz,pprzlink | ||
SIMSITLML = $(OBJDIR)/simsitl.ml | ||
SITLCMA = $(SIMDIR)/sitl.cma | ||
OPT ?= 2 | ||
|
||
# Launch with "make Q=''" to get full command display | ||
Q=@ | ||
|
||
# | ||
# End of configuration part. | ||
# | ||
|
||
INCLUDES += -I $(shell $(OCAMLC) -where) | ||
|
||
CFLAGS = -W -Wall | ||
CFLAGS += $(INCLUDES) | ||
CFLAGS += $($(TARGET).CFLAGS) | ||
CFLAGS += $(USER_CFLAGS) $(BOARD_CFLAGS) | ||
CFLAGS += -fPIC | ||
CFLAGS += -O$(OPT) | ||
CFLAGS += -g | ||
CFLAGS += -std=gnu99 | ||
CFLAGS += $(shell pkg-config --cflags-only-I ivy-glib) | ||
CFLAGS += -D_GNU_SOURCE | ||
CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=1 | ||
|
||
LDFLAGS = -lm | ||
LDFLAGS += $(BOARD_LDFLAGS) | ||
|
||
LIBFLAGS = -shared | ||
|
||
UNAME = $(shell uname -s) | ||
ifeq ($(UNAME),Darwin) | ||
LIBFLAGS = -dynamiclib -undefined suppress -flat_namespace | ||
endif | ||
|
||
# build sim in custom mode for ARM systems for now... | ||
MNAME = $(shell uname -m) | ||
ifneq (,$(findstring arm,$(MNAME))) | ||
SIMSITLCUSTOM=TRUE | ||
endif | ||
|
||
ifdef SIMSITLCUSTOM | ||
CAMLINCLUDES += $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format glibivy) | ||
CAMLCMAS = unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma | ||
endif | ||
|
||
|
||
# | ||
# General rules | ||
# | ||
|
||
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs)) | ||
$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o) | ||
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o) | ||
|
||
all compile: $(OBJDIR) $(OBJDIR)/simsitl | ||
|
||
$(OBJDIR): | ||
@echo CREATING object dir $(OBJDIR) | ||
@test -d $(OBJDIR) || mkdir -p $(OBJDIR) | ||
|
||
# shared library of the C autopilot part | ||
# Note: On darwin the file should actually have the .dylib ending but ocamlc | ||
# only assumes that .so files are shared libraries, even though this is only | ||
# correct on linux. | ||
autopilot.so : $($(TARGET).objs) | ||
@echo BUILD $@ | ||
$(Q)$(CC) $(LIBFLAGS) $^ -o $(OBJDIR)/$@ | ||
|
||
ifdef SIMSITLCUSTOM | ||
$(OBJDIR)/simsitl : $($(TARGET).objs) $(SITLCMA) $(SIMSITLML) | ||
@echo LD $@ | ||
$(Q)$(OCAMLC) -g -custom $(CAMLINCLUDES) -o $@ $(CAMLCMAS) $^ | ||
else | ||
$(OBJDIR)/simsitl : autopilot.so $(SITLCMA) $(SIMSITLML) | ||
@echo LD $@ | ||
$(Q)$(OCAMLC) -g $(CAMLINCLUDES) -o $@ $(LINKPKG) $^ -dllpath $(OBJDIR) -dllpath $(SIMDIR) | ||
endif | ||
|
||
|
||
# The id of the A/C is hardcoded in the code (to be improved with dynlink ?) | ||
$(SIMSITLML) : $(SIMDIR)/simsitl.ml | ||
@echo "Sim.ac_name := \"$(AIRCRAFT)\"" > $@ | ||
@cat $< >> $@ | ||
|
||
%.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) -MMD $(CFLAGS) -c -o $@ $< | ||
|
||
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac | ||
@echo CC $@ | ||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@) | ||
$(Q)$(CC) -MMD $(CFLAGS) -c -o $@ $< | ||
|
||
.PHONY: all compile | ||
|
||
# | ||
# Dependencies | ||
# | ||
|
||
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d)) | ||
|
||
ifneq ($(MAKECMDGOALS),clean) | ||
-include $(DEPS) | ||
endif | ||
include $(PAPARAZZI_SRC)/conf/Makefile.nps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE module SYSTEM "module.dtd"> | ||
|
||
<module name="fdm_fixedwing_sim" dir="fdm"> | ||
<doc> | ||
<description> | ||
Basic fixedwing FDM for NPS simulator | ||
|
||
This flight dynamic model is the copy of the legacy simulator that was written in OCaml. | ||
Its only purpose is to allow to test the flight plans with a very simple airplane model. | ||
</description> | ||
</doc> | ||
<header/> | ||
<makefile target="sim|nps|hitl"> | ||
<define name="NPS_BYPASS_AHRS" value="TRUE"/> | ||
<define name="NPS_BYPASS_INS" value="TRUE"/> | ||
<file name="nps_fdm_fixedwing_sim.c" dir="nps"/> | ||
</makefile> | ||
</module> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.