Merge remote-tracking branch 'remotes/origin/next' into sambas/diffnext
Conflicts: flight/Libraries/CoordinateConversions.c flight/Libraries/paths.c flight/Modules/System/systemmod.c flight/PiOS/STM32F4xx/pios_sys.c flight/targets/boards/coptercontrol/pios_board.h flight/targets/boards/revolution/pios_board.h flight/targets/boards/revoproto/pios_board.h
7
.gitattributes
vendored
@ -2,8 +2,11 @@
|
||||
# Line endings normalization: http://wiki.openpilot.org/display/Doc/Coding+Style
|
||||
# You need at least git 1.7.2 for this to work (previous versions ignore text and eol attributes).
|
||||
#
|
||||
# Make sure you have committed all local changes first. Then use the following bash commands
|
||||
# to normalize your local repository to be able to merge it with a mainline:
|
||||
# To merge your old branch with new normalized version use the following git option:
|
||||
# git merge ... -X renormalize
|
||||
#
|
||||
# To reformat your local branch completely make sure you have committed all local changes first.
|
||||
# Then use the following bash commands:
|
||||
#
|
||||
# Minimal normalization:
|
||||
# git rm --cached -r .
|
||||
|
92
Makefile
@ -190,31 +190,22 @@ uavobjects_clean:
|
||||
export PIOS := $(ROOT_DIR)/flight/PiOS
|
||||
export FLIGHTLIB := $(ROOT_DIR)/flight/Libraries
|
||||
export OPMODULEDIR := $(ROOT_DIR)/flight/Modules
|
||||
export OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects
|
||||
export OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk
|
||||
export HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs
|
||||
export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
|
||||
export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
|
||||
export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen
|
||||
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
||||
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
|
||||
|
||||
# Define supported board lists
|
||||
ALL_BOARDS := coptercontrol pipxtreme revolution revomini osd simposix
|
||||
ALL_BOARDS_BU := coptercontrol pipxtreme simposix
|
||||
|
||||
# Friendly names of each board (used to find source tree)
|
||||
coptercontrol_friendly := CopterControl
|
||||
pipxtreme_friendly := PipXtreme
|
||||
revolution_friendly := Revolution
|
||||
revomini_friendly := RevoMini
|
||||
osd_friendly := OSD
|
||||
simposix_friendly := SimPosix
|
||||
ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix
|
||||
ALL_BOARDS_BU := coptercontrol oplinkmini
|
||||
|
||||
# Short names of each board (used to display board name in parallel builds)
|
||||
coptercontrol_short := 'cc '
|
||||
pipxtreme_short := 'pipx'
|
||||
oplinkmini_short := 'oplm'
|
||||
revolution_short := 'revo'
|
||||
revomini_short := 'rm '
|
||||
osd_short := 'osd '
|
||||
revoproto_short := 'revp'
|
||||
simposix_short := 'posx'
|
||||
|
||||
# SimPosix only builds on Linux so drop it from the list for
|
||||
@ -259,8 +250,7 @@ endif
|
||||
# TEMPLATES (used to generate build rules)
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Name of board used in source tree (e.g. CopterControl)
|
||||
# $(3) = Short name for board (e.g CC)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define FW_TEMPLATE
|
||||
.PHONY: $(1) fw_$(1)
|
||||
$(1): fw_$(1)_opfw
|
||||
@ -269,13 +259,12 @@ fw_$(1): fw_$(1)_opfw
|
||||
fw_$(1)_%: uavobjects_flight
|
||||
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/$(2) && \
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(3) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=fw \
|
||||
HWDEFSINC=$(HWDEFS)/$(1) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/$(2) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
||||
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
||||
TARGET=fw_$(1) \
|
||||
$$*
|
||||
@ -288,7 +277,7 @@ fw_$(1)_clean:
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Name of board used in source tree (e.g. CopterControl)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define BL_TEMPLATE
|
||||
.PHONY: bl_$(1)
|
||||
bl_$(1): bl_$(1)_bin
|
||||
@ -297,13 +286,12 @@ bl_$(1)_bino: bl_$(1)_bin
|
||||
bl_$(1)_%:
|
||||
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/$(2) && \
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(3) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=bl \
|
||||
HWDEFSINC=$(HWDEFS)/$(1) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/$(2) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
||||
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
||||
TARGET=bl_$(1) \
|
||||
$$*
|
||||
@ -329,19 +317,19 @@ bl_$(1)_clean:
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define BU_TEMPLATE
|
||||
.PHONY: bu_$(1)
|
||||
bu_$(1): bu_$(1)_opfw
|
||||
|
||||
bu_$(1)_%: bl_$(1)_bino
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/BootloaderUpdater && \
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(3) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=bu \
|
||||
HWDEFSINC=$(HWDEFS)/$(1) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/BootloaderUpdater \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
||||
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
||||
TARGET=bu_$(1) \
|
||||
$$*
|
||||
@ -353,19 +341,20 @@ bu_$(1)_clean:
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define EF_TEMPLATE
|
||||
.PHONY: ef_$(1)
|
||||
ef_$(1): ef_$(1)_bin
|
||||
|
||||
ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/EntireFlash && \
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(3) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=ef \
|
||||
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/EntireFlash \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
||||
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
||||
TARGET=ef_$(1) \
|
||||
$$*
|
||||
@ -416,16 +405,16 @@ all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
|
||||
|
||||
# Expand the firmware rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
|
||||
|
||||
# Expand the bootloader rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
|
||||
|
||||
# Expand the bootloader updater rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
|
||||
|
||||
# Expand the entire-flash rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
|
||||
|
||||
.PHONY: sim_win32
|
||||
sim_win32: sim_win32_exe
|
||||
@ -441,7 +430,7 @@ sim_osx: sim_osx_elf
|
||||
sim_osx_%: uavobjects_flight
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
|
||||
$(V1) $(MAKE) --no-print-directory \
|
||||
-C $(ROOT_DIR)/flight/targets/Revolution --file=$(ROOT_DIR)/flight/targets/Revolution/Makefile.osx $*
|
||||
-C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
|
||||
|
||||
##############################
|
||||
#
|
||||
@ -790,6 +779,28 @@ package: all_fw all_ground uavobjects_matlab
|
||||
$(foreach fw_targ, $(PACKAGE_ELF_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.elf,))
|
||||
$(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@
|
||||
|
||||
##############################
|
||||
#
|
||||
# Source code formatting
|
||||
#
|
||||
##############################
|
||||
|
||||
# $(1) = Uncrustify target (e.g flight or ground)
|
||||
# $(2) = Target root directory
|
||||
define UNCRUSTIFY_TEMPLATE
|
||||
|
||||
.PHONY: uncrustify_$(1)
|
||||
uncrustify_$(1):
|
||||
@$(ECHO) "Auto-formatting $(1) source code"
|
||||
$(V1) UNCRUSTIFY_CONFIG="make/templates/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
|
||||
endef
|
||||
|
||||
$(eval $(call UNCRUSTIFY_TEMPLATE,flight,$(ROOT_DIR)/flight))
|
||||
$(eval $(call UNCRUSTIFY_TEMPLATE,ground,$(ROOT_DIR)/ground))
|
||||
|
||||
.PHONY: uncrustify_all
|
||||
uncrustify_all: $(addprefix uncrustify_,flight ground)
|
||||
|
||||
##############################
|
||||
#
|
||||
# Build info
|
||||
@ -825,6 +836,7 @@ help:
|
||||
@$(ECHO) " qt_sdk_install - Install the QT development tools"
|
||||
@$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)"
|
||||
@$(ECHO) " python_install - Install the Python interpreter (Windows only)"
|
||||
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
||||
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
||||
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
||||
@$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
|
||||
@ -919,6 +931,10 @@ help:
|
||||
@$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package"
|
||||
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Code Formatting]"
|
||||
@$(ECHO) " uncrustify_<source> - Reformat <source> code. <source> can be flight or ground"
|
||||
@$(ECHO) " uncrustify_all - Reformat all source code"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
|
||||
|
@ -1 +1 @@
|
||||
Check the wiki: http://wiki.openpilot.org/display/Doc/OpenPilot+Developer+Manual
|
||||
Check the wiki: http://wiki.openpilot.org/display/Doc/OpenPilot+Developer+Manual
|
0
artwork/3D Model/components/clevis1/clevis1.3ds
Executable file → Normal file
0
artwork/3D Model/components/clevis1/screenshot.jpg
Executable file → Normal file
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
0
artwork/3D Model/components/control_horn1/control_horn1.3ds
Executable file → Normal file
0
artwork/3D Model/components/control_horn1/screenshot.jpg
Executable file → Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
0
artwork/3D Model/components/esc1/esc1.3ds
Executable file → Normal file
0
artwork/3D Model/components/esc1/screenshot.jpg
Executable file → Normal file
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
0
artwork/3D Model/components/esc1/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
0
artwork/3D Model/components/motor1/motor1.3ds
Executable file → Normal file
0
artwork/3D Model/components/motor1/screenshot.jpg
Executable file → Normal file
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
0
artwork/3D Model/components/motor1/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
artwork/3D Model/components/servo1/screenshot.jpg
Executable file → Normal file
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
0
artwork/3D Model/components/servo1/servo1.3ds
Executable file → Normal file
0
artwork/3D Model/components/servo1/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
0
artwork/3D Model/helis/t-rex/t-rex_450_xl.3ds
Executable file → Normal file
0
artwork/3D Model/helis/t-rex/t-rex_450_xl.jpg
Executable file → Normal file
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
0
artwork/3D Model/helis/t-rex/t-rex_450_xl.wav
Executable file → Normal file
0
artwork/3D Model/helis/t-rex/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
0
artwork/3D Model/multi/aeroquad/aeroquad.jpg
Executable file → Normal file
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
0
artwork/3D Model/multi/aeroquad/aeroquad_+.3ds
Executable file → Normal file
0
artwork/3D Model/multi/aeroquad/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
0
artwork/3D Model/multi/easy_quad/boards.jpg
Executable file → Normal file
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
0
artwork/3D Model/multi/easy_quad/easy_quad_X.3ds
Executable file → Normal file
0
artwork/3D Model/multi/easy_quad/easy_quad_X.jpg
Executable file → Normal file
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
0
artwork/3D Model/multi/easy_quad/logo.jpg
Executable file → Normal file
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
0
artwork/3D Model/multi/easy_quad/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
artwork/3D Model/multi/gaui_330x/gaui_330x.3ds
Executable file → Normal file
0
artwork/3D Model/multi/gaui_330x/gaui_330x.jpg
Executable file → Normal file
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 134 KiB |
0
artwork/3D Model/multi/gaui_330x/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
0
artwork/3D Model/multi/mikrokopter/MK_Hexa.3ds
Executable file → Normal file
0
artwork/3D Model/multi/mikrokopter/MK_Hexa.jpg
Executable file → Normal file
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
0
artwork/3D Model/multi/mikrokopter/MK_L4-ME.3ds
Executable file → Normal file
0
artwork/3D Model/multi/mikrokopter/MK_L4-ME.jpg
Executable file → Normal file
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
0
artwork/3D Model/multi/mikrokopter/MK_Okto.3ds
Executable file → Normal file
0
artwork/3D Model/multi/mikrokopter/MK_Okto.jpg
Executable file → Normal file
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
0
artwork/3D Model/multi/mikrokopter/MK_Okto2.3ds
Executable file → Normal file
0
artwork/3D Model/multi/mikrokopter/MK_Okto2.jpg
Executable file → Normal file
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
0
artwork/3D Model/multi/mikrokopter/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
0
artwork/3D Model/multi/scorpion_tricopter/scorpion_tricopter.3ds
Executable file → Normal file
0
artwork/3D Model/multi/scorpion_tricopter/scorpion_tricopter.jpg
Executable file → Normal file
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
0
artwork/3D Model/multi/scorpion_tricopter/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 209 KiB |
0
artwork/3D Model/multi/test_quad/TEXTURE.PNG
Executable file → Normal file
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
0
artwork/3D Model/multi/test_quad/test_quad_+-old.3ds
Executable file → Normal file
0
artwork/3D Model/multi/test_quad/test_quad_+-old.jpg
Executable file → Normal file
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
0
artwork/3D Model/multi/test_quad/test_quad_+.3ds
Executable file → Normal file
0
artwork/3D Model/multi/test_quad/test_quad_+.jpg
Executable file → Normal file
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
0
artwork/3D Model/multi/test_quad/test_quad_X-old.3ds
Executable file → Normal file
0
artwork/3D Model/multi/test_quad/test_quad_X-old.jpg
Executable file → Normal file
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
0
artwork/3D Model/multi/test_quad/test_quad_X.3ds
Executable file → Normal file
0
artwork/3D Model/multi/test_quad/test_quad_X.jpg
Executable file → Normal file
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
0
artwork/3D Model/planes/Easystar/easystar.3ds
Executable file → Normal file
0
artwork/3D Model/planes/Easystar/easystar.jpg
Executable file → Normal file
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
0
artwork/3D Model/planes/Easystar/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 484 KiB After Width: | Height: | Size: 484 KiB |
0
artwork/3D Model/planes/firecracker/firecracker.3ds
Executable file → Normal file
0
artwork/3D Model/planes/firecracker/firecracker.jpg
Executable file → Normal file
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
0
artwork/3D Model/planes/firecracker/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 641 KiB After Width: | Height: | Size: 641 KiB |
0
artwork/3D Model/planes/funjet/funjet.3ds
Executable file → Normal file
0
artwork/3D Model/planes/funjet/funjet.jpg
Executable file → Normal file
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
0
artwork/3D Model/planes/funjet/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
0
artwork/3D Model/planes/zagi/texture.jpg
Executable file → Normal file
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
0
artwork/3D Model/planes/zagi/zagi.3ds
Executable file → Normal file
0
artwork/3D Model/planes/zagi/zagi.jpg
Executable file → Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
0
artwork/Dials/deluxe/lineardial-horizontal.svg
Executable file → Normal file
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
0
artwork/Dials/deluxe/lineardial-vertical.svg
Executable file → Normal file
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
0
artwork/PFD/pfd.svg
Executable file → Normal file
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
@ -29,11 +29,10 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <pios_math.h>
|
||||
#include "CoordinateConversions.h"
|
||||
|
||||
#define F_PI 3.14159265358979323846f
|
||||
#define RAD2DEG (180.0f/ F_PI)
|
||||
#define DEG2RAD (F_PI /180.0f)
|
||||
#define MIN_ALLOWABLE_MAGNITUDE 1e-30f
|
||||
|
||||
// ****** convert Lat,Lon,Alt to ECEF ************
|
||||
void LLA2ECEF(float LLA[3], float ECEF[3])
|
||||
@ -43,10 +42,10 @@ void LLA2ECEF(float LLA[3], float ECEF[3])
|
||||
float sinLat, sinLon, cosLat, cosLon;
|
||||
float N;
|
||||
|
||||
sinLat = sinf(DEG2RAD * LLA[0]);
|
||||
sinLon = sinf(DEG2RAD * LLA[1]);
|
||||
cosLat = cosf(DEG2RAD * LLA[0]);
|
||||
cosLon = cosf(DEG2RAD * LLA[1]);
|
||||
sinLat = sinf(DEG2RAD(LLA[0]));
|
||||
sinLon = sinf(DEG2RAD(LLA[1]));
|
||||
cosLat = cosf(DEG2RAD(LLA[0]));
|
||||
cosLon = cosf(DEG2RAD(LLA[1]));
|
||||
|
||||
N = a / sqrtf(1.0f - e * e * sinLat * sinLat); //prime vertical radius of curvature
|
||||
|
||||
@ -73,10 +72,10 @@ uint16_t ECEF2LLA(float ECEF[3], float LLA[3])
|
||||
float Lat, N, NplusH, delta, esLat;
|
||||
uint16_t iter;
|
||||
#define MAX_ITER 10 // should not take more than 5 for valid coordinates
|
||||
#define ACCURACY 1.0e-11 // used to be e-14, but we don't need sub micrometer exact calculations
|
||||
#define ACCURACY 1.0e-11f // used to be e-14, but we don't need sub micrometer exact calculations
|
||||
|
||||
LLA[1] = RAD2DEG * atan2f(y, x);
|
||||
Lat = DEG2RAD * LLA[0];
|
||||
LLA[1] = RAD2DEG(atan2f(y, x));
|
||||
Lat = DEG2RAD(LLA[0]);
|
||||
esLat = e * sinf(Lat);
|
||||
N = a / sqrtf(1 - esLat * esLat);
|
||||
NplusH = N + LLA[2];
|
||||
@ -93,7 +92,7 @@ uint16_t ECEF2LLA(float ECEF[3], float LLA[3])
|
||||
iter += 1;
|
||||
}
|
||||
|
||||
LLA[0] = RAD2DEG * Lat;
|
||||
LLA[0] = RAD2DEG(Lat);
|
||||
LLA[2] = NplusH - N;
|
||||
|
||||
return (iter < MAX_ITER);
|
||||
@ -104,10 +103,10 @@ void RneFromLLA(float LLA[3], float Rne[3][3])
|
||||
{
|
||||
float sinLat, sinLon, cosLat, cosLon;
|
||||
|
||||
sinLat = (float)sinf(DEG2RAD * LLA[0]);
|
||||
sinLon = (float)sinf(DEG2RAD * LLA[1]);
|
||||
cosLat = (float)cosf(DEG2RAD * LLA[0]);
|
||||
cosLon = (float)cosf(DEG2RAD * LLA[1]);
|
||||
sinLat = (float)sinf(DEG2RAD(LLA[0]));
|
||||
sinLon = (float)sinf(DEG2RAD(LLA[1]));
|
||||
cosLat = (float)cosf(DEG2RAD(LLA[0]));
|
||||
cosLon = (float)cosf(DEG2RAD(LLA[1]));
|
||||
|
||||
Rne[0][0] = -sinLat * cosLon;
|
||||
Rne[0][1] = -sinLat * sinLon;
|
||||
@ -135,9 +134,9 @@ void Quaternion2RPY(const float q[4], float rpy[3])
|
||||
R23 = 2.0f * (q[2] * q[3] + q[0] * q[1]);
|
||||
R33 = q0s - q1s - q2s + q3s;
|
||||
|
||||
rpy[1] = RAD2DEG * asinf(-R13); // pitch always between -pi/2 to pi/2
|
||||
rpy[2] = RAD2DEG * atan2f(R12, R11);
|
||||
rpy[0] = RAD2DEG * atan2f(R23, R33);
|
||||
rpy[1] = RAD2DEG(asinf(-R13)); // pitch always between -pi/2 to pi/2
|
||||
rpy[2] = RAD2DEG(atan2f(R12, R11));
|
||||
rpy[0] = RAD2DEG(atan2f(R23, R33));
|
||||
|
||||
//TODO: consider the cases where |R13| ~= 1, |pitch| ~= pi/2
|
||||
}
|
||||
@ -148,9 +147,9 @@ void RPY2Quaternion(const float rpy[3], float q[4])
|
||||
float phi, theta, psi;
|
||||
float cphi, sphi, ctheta, stheta, cpsi, spsi;
|
||||
|
||||
phi = DEG2RAD * rpy[0] / 2.0f;
|
||||
theta = DEG2RAD * rpy[1] / 2.0f;
|
||||
psi = DEG2RAD * rpy[2] / 2.0f;
|
||||
phi = DEG2RAD(rpy[0] / 2);
|
||||
theta = DEG2RAD(rpy[1] / 2);
|
||||
psi = DEG2RAD(rpy[2] / 2);
|
||||
cphi = cosf(phi);
|
||||
sphi = sinf(phi);
|
||||
ctheta = cosf(theta);
|
||||
@ -294,13 +293,13 @@ uint8_t RotFrom2Vectors(const float v1b[3], const float v1e[3], const float v2b[
|
||||
|
||||
// The first rows of rot matrices chosen in direction of v1
|
||||
mag = VectorMagnitude(v1b);
|
||||
if (fabs(mag) < 1e-30)
|
||||
if (fabsf(mag) < MIN_ALLOWABLE_MAGNITUDE)
|
||||
return (-1);
|
||||
for (i=0;i<3;i++)
|
||||
Rib[0][i]=v1b[i]/mag;
|
||||
|
||||
mag = VectorMagnitude(v1e);
|
||||
if (fabs(mag) < 1e-30)
|
||||
if (fabsf(mag) < MIN_ALLOWABLE_MAGNITUDE)
|
||||
return (-1);
|
||||
for (i=0;i<3;i++)
|
||||
Rie[0][i]=v1e[i]/mag;
|
||||
@ -308,14 +307,14 @@ uint8_t RotFrom2Vectors(const float v1b[3], const float v1e[3], const float v2b[
|
||||
// The second rows of rot matrices chosen in direction of v1xv2
|
||||
CrossProduct(v1b,v2b,&Rib[1][0]);
|
||||
mag = VectorMagnitude(&Rib[1][0]);
|
||||
if (fabs(mag) < 1e-30)
|
||||
if (fabsf(mag) < MIN_ALLOWABLE_MAGNITUDE)
|
||||
return (-1);
|
||||
for (i=0;i<3;i++)
|
||||
Rib[1][i]=Rib[1][i]/mag;
|
||||
|
||||
CrossProduct(v1e,v2e,&Rie[1][0]);
|
||||
mag = VectorMagnitude(&Rie[1][0]);
|
||||
if (fabs(mag) < 1e-30)
|
||||
if (fabsf(mag) < MIN_ALLOWABLE_MAGNITUDE)
|
||||
return (-1);
|
||||
for (i=0;i<3;i++)
|
||||
Rie[1][i]=Rie[1][i]/mag;
|
||||
|
0
flight/Libraries/PyMite/.no-auto-format
Normal file
@ -57,7 +57,8 @@
|
||||
//#define MALLOC(x) malloc(x)
|
||||
//#define FREE(x) free(x)
|
||||
|
||||
// const should hopefully keep them in the flash region
|
||||
// http://reviews.openpilot.org/cru/OPReview-436#c6476 :
|
||||
// first column not used but it will be optimized out by compiler
|
||||
static const float CoeffFile[91][6] = { {0, 0, 0, 0, 0, 0},
|
||||
{1, 0, -29496.6, 0.0, 11.6, 0.0},
|
||||
{1, 1, -1586.3, 4944.4, 16.5, -25.9},
|
||||
@ -204,11 +205,11 @@ int WMM_GetMagVector(float Lat, float Lon, float AltEllipsoid, uint16_t Month, u
|
||||
// ***********
|
||||
// range check supplied params
|
||||
|
||||
if (Lat < -90) return -1; // error
|
||||
if (Lat > 90) return -2; // error
|
||||
if (Lat < -90.0f) return -1; // error
|
||||
if (Lat > 90.0f) return -2; // error
|
||||
|
||||
if (Lon < -180) return -3; // error
|
||||
if (Lon > 180) return -4; // error
|
||||
if (Lon < -180.0f) return -3; // error
|
||||
if (Lon > 180.0f) return -4; // error
|
||||
|
||||
// ***********
|
||||
// allocated required memory
|
||||
@ -242,7 +243,7 @@ int WMM_GetMagVector(float Lat, float Lon, float AltEllipsoid, uint16_t Month, u
|
||||
{
|
||||
CoordGeodetic->lambda = Lon;
|
||||
CoordGeodetic->phi = Lat;
|
||||
CoordGeodetic->HeightAboveEllipsoid = AltEllipsoid/1000.0; // convert to km
|
||||
CoordGeodetic->HeightAboveEllipsoid = AltEllipsoid/1000.0f; // convert to km
|
||||
|
||||
// Convert from geodeitic to Spherical Equations: 17-18, WMM Technical report
|
||||
if (WMM_GeodeticToSpherical(CoordGeodetic, CoordSpherical) < 0)
|
||||
@ -293,9 +294,9 @@ int WMM_GetMagVector(float Lat, float Lon, float AltEllipsoid, uint16_t Month, u
|
||||
Ellip = NULL;
|
||||
}
|
||||
|
||||
B[0] = GeoMagneticElements->X * 1e-2;
|
||||
B[1] = GeoMagneticElements->Y * 1e-2;
|
||||
B[2] = GeoMagneticElements->Z * 1e-2;
|
||||
B[0] = GeoMagneticElements->X * 1e-2f;
|
||||
B[1] = GeoMagneticElements->Y * 1e-2f;
|
||||
B[2] = GeoMagneticElements->Z * 1e-2f;
|
||||
|
||||
return returned;
|
||||
}
|
||||
@ -433,8 +434,8 @@ int WMM_ComputeSphericalHarmonicVariables(WMMtype_CoordSpherical *CoordSpherical
|
||||
float cos_lambda, sin_lambda;
|
||||
uint16_t m, n;
|
||||
|
||||
cos_lambda = cos(DEG2RAD(CoordSpherical->lambda));
|
||||
sin_lambda = sin(DEG2RAD(CoordSpherical->lambda));
|
||||
cos_lambda = cosf(DEG2RAD(CoordSpherical->lambda));
|
||||
sin_lambda = sinf(DEG2RAD(CoordSpherical->lambda));
|
||||
|
||||
/* for n = 0 ... model_order, compute (Radius of Earth / Spherica radius r)^(n+2)
|
||||
for n 1..nMax-1 (this is much faster than calling pow MAX_N+1 times). */
|
||||
@ -444,12 +445,12 @@ int WMM_ComputeSphericalHarmonicVariables(WMMtype_CoordSpherical *CoordSpherical
|
||||
SphVariables->RelativeRadiusPower[n] = SphVariables->RelativeRadiusPower[n - 1] * (Ellip->re / CoordSpherical->r);
|
||||
|
||||
/*
|
||||
Compute cos(m*lambda), sin(m*lambda) for m = 0 ... nMax
|
||||
cos(a + b) = cos(a)*cos(b) - sin(a)*sin(b)
|
||||
sin(a + b) = cos(a)*sin(b) + sin(a)*cos(b)
|
||||
Compute cosf(m*lambda), sinf(m*lambda) for m = 0 ... nMax
|
||||
cosf(a + b) = cosf(a)*cosf(b) - sinf(a)*sinf(b)
|
||||
sinf(a + b) = cosf(a)*sinf(b) + sinf(a)*cosf(b)
|
||||
*/
|
||||
SphVariables->cos_mlambda[0] = 1.0;
|
||||
SphVariables->sin_mlambda[0] = 0.0;
|
||||
SphVariables->cos_mlambda[0] = 1.0f;
|
||||
SphVariables->sin_mlambda[0] = 0.0f;
|
||||
|
||||
SphVariables->cos_mlambda[1] = cos_lambda;
|
||||
SphVariables->sin_mlambda[1] = sin_lambda;
|
||||
@ -480,9 +481,9 @@ int WMM_AssociatedLegendreFunction(WMMtype_CoordSpherical * CoordSpherical, uint
|
||||
|
||||
*/
|
||||
{
|
||||
float sin_phi = sin(DEG2RAD(CoordSpherical->phig)); /* sin (geocentric latitude) */
|
||||
float sin_phi = sinf(DEG2RAD(CoordSpherical->phig)); /* sinf (geocentric latitude) */
|
||||
|
||||
if (nMax <= 16 || (1 - fabs(sin_phi)) < 1.0e-10) /* If nMax is less tha 16 or at the poles */
|
||||
if (nMax <= 16 || (1 - fabsf(sin_phi)) < 1.0e-10f) /* If nMax is less tha 16 or at the poles */
|
||||
{
|
||||
if (WMM_PcupLow(LegendreFunction->Pcup, LegendreFunction->dPcup, sin_phi, nMax) < 0)
|
||||
return -1; // error
|
||||
@ -508,7 +509,7 @@ int WMM_Summation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
|
||||
dV ^ 1 dV ^ 1 dV ^
|
||||
grad V = -- r + - -- t + -------- -- p
|
||||
dr r dt r sin(t) dp
|
||||
dr r dt r sinf(t) dp
|
||||
|
||||
INPUT : LegendreFunction
|
||||
MagneticModel
|
||||
@ -535,7 +536,7 @@ int WMM_Summation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
index = (n * (n + 1) / 2 + m);
|
||||
|
||||
/* nMax (n+2) n m m m
|
||||
Bz = -SUM (a/r) (n+1) SUM [g cos(m p) + h sin(m p)] P (sin(phi))
|
||||
Bz = -SUM (a/r) (n+1) SUM [g cosf(m p) + h sinf(m p)] P (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Equation 12 in the WMM Technical report. Derivative with respect to radius.*/
|
||||
MagneticResults->Bz -=
|
||||
@ -545,7 +546,7 @@ int WMM_Summation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
* (float)(n + 1) * LegendreFunction->Pcup[index];
|
||||
|
||||
/* 1 nMax (n+2) n m m m
|
||||
By = SUM (a/r) (m) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
By = SUM (a/r) (m) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Equation 11 in the WMM Technical report. Derivative with respect to longitude, divided by radius. */
|
||||
MagneticResults->By +=
|
||||
@ -554,7 +555,7 @@ int WMM_Summation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
SphVariables->sin_mlambda[m] - WMM_get_main_field_coeff_h(index) * SphVariables->cos_mlambda[m])
|
||||
* (float)(m) * LegendreFunction->Pcup[index];
|
||||
/* nMax (n+2) n m m m
|
||||
Bx = - SUM (a/r) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
Bx = - SUM (a/r) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Equation 10 in the WMM Technical report. Derivative with respect to latitude, divided by radius. */
|
||||
|
||||
@ -567,8 +568,8 @@ int WMM_Summation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
}
|
||||
}
|
||||
|
||||
cos_phi = cos(DEG2RAD(CoordSpherical->phig));
|
||||
if (fabs(cos_phi) > 1.0e-10)
|
||||
cos_phi = cosf(DEG2RAD(CoordSpherical->phig));
|
||||
if (fabsf(cos_phi) > 1.0e-10f)
|
||||
{
|
||||
MagneticResults->By = MagneticResults->By / cos_phi;
|
||||
}
|
||||
@ -617,7 +618,7 @@ int WMM_SecVarSummation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
index = (n * (n + 1) / 2 + m);
|
||||
|
||||
/* nMax (n+2) n m m m
|
||||
Bz = -SUM (a/r) (n+1) SUM [g cos(m p) + h sin(m p)] P (sin(phi))
|
||||
Bz = -SUM (a/r) (n+1) SUM [g cosf(m p) + h sinf(m p)] P (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Derivative with respect to radius.*/
|
||||
MagneticResults->Bz -=
|
||||
@ -627,7 +628,7 @@ int WMM_SecVarSummation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
* (float)(n + 1) * LegendreFunction->Pcup[index];
|
||||
|
||||
/* 1 nMax (n+2) n m m m
|
||||
By = SUM (a/r) (m) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
By = SUM (a/r) (m) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Derivative with respect to longitude, divided by radius. */
|
||||
MagneticResults->By +=
|
||||
@ -636,7 +637,7 @@ int WMM_SecVarSummation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
SphVariables->sin_mlambda[m] - WMM_get_secular_var_coeff_h(index) * SphVariables->cos_mlambda[m])
|
||||
* (float)(m) * LegendreFunction->Pcup[index];
|
||||
/* nMax (n+2) n m m m
|
||||
Bx = - SUM (a/r) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
Bx = - SUM (a/r) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Derivative with respect to latitude, divided by radius. */
|
||||
|
||||
@ -647,8 +648,8 @@ int WMM_SecVarSummation(WMMtype_LegendreFunction * LegendreFunction,
|
||||
* LegendreFunction->dPcup[index];
|
||||
}
|
||||
}
|
||||
cos_phi = cos(DEG2RAD(CoordSpherical->phig));
|
||||
if (fabs(cos_phi) > 1.0e-10)
|
||||
cos_phi = cosf(DEG2RAD(CoordSpherical->phig));
|
||||
if (fabsf(cos_phi) > 1.0e-10f)
|
||||
{
|
||||
MagneticResults->By = MagneticResults->By / cos_phi;
|
||||
}
|
||||
@ -695,11 +696,11 @@ int WMM_RotateMagneticVector(WMMtype_CoordSpherical * CoordSpherical,
|
||||
*/
|
||||
{
|
||||
/* Difference between the spherical and Geodetic latitudes */
|
||||
float Psi = (M_PI / 180) * (CoordSpherical->phig - CoordGeodetic->phi);
|
||||
float Psi = (M_PI_F / 180) * (CoordSpherical->phig - CoordGeodetic->phi);
|
||||
|
||||
/* Rotate spherical field components to the Geodeitic system */
|
||||
MagneticResultsGeo->Bz = MagneticResultsSph->Bx * sin(Psi) + MagneticResultsSph->Bz * cos(Psi);
|
||||
MagneticResultsGeo->Bx = MagneticResultsSph->Bx * cos(Psi) - MagneticResultsSph->Bz * sin(Psi);
|
||||
MagneticResultsGeo->Bz = MagneticResultsSph->Bx * sinf(Psi) + MagneticResultsSph->Bz * cosf(Psi);
|
||||
MagneticResultsGeo->Bx = MagneticResultsSph->Bx * cosf(Psi) - MagneticResultsSph->Bz * sinf(Psi);
|
||||
MagneticResultsGeo->By = MagneticResultsSph->By;
|
||||
|
||||
return 0;
|
||||
@ -727,10 +728,10 @@ int WMM_CalculateGeoMagneticElements(WMMtype_MagneticResults * MagneticResultsGe
|
||||
GeoMagneticElements->Y = MagneticResultsGeo->By;
|
||||
GeoMagneticElements->Z = MagneticResultsGeo->Bz;
|
||||
|
||||
GeoMagneticElements->H = sqrt(MagneticResultsGeo->Bx * MagneticResultsGeo->Bx + MagneticResultsGeo->By * MagneticResultsGeo->By);
|
||||
GeoMagneticElements->F = sqrt(GeoMagneticElements->H * GeoMagneticElements->H + MagneticResultsGeo->Bz * MagneticResultsGeo->Bz);
|
||||
GeoMagneticElements->Decl = RAD2DEG(atan2(GeoMagneticElements->Y, GeoMagneticElements->X));
|
||||
GeoMagneticElements->Incl = RAD2DEG(atan2(GeoMagneticElements->Z, GeoMagneticElements->H));
|
||||
GeoMagneticElements->H = sqrtf(MagneticResultsGeo->Bx * MagneticResultsGeo->Bx + MagneticResultsGeo->By * MagneticResultsGeo->By);
|
||||
GeoMagneticElements->F = sqrtf(GeoMagneticElements->H * GeoMagneticElements->H + MagneticResultsGeo->Bz * MagneticResultsGeo->Bz);
|
||||
GeoMagneticElements->Decl = RAD2DEG(atan2f(GeoMagneticElements->Y, GeoMagneticElements->X));
|
||||
GeoMagneticElements->Incl = RAD2DEG(atan2f(GeoMagneticElements->Z, GeoMagneticElements->H));
|
||||
|
||||
return 0; // OK
|
||||
}
|
||||
@ -762,10 +763,10 @@ int WMM_CalculateSecularVariation(WMMtype_MagneticResults * MagneticVariation, W
|
||||
(MagneticElements->X * MagneticElements->Xdot +
|
||||
MagneticElements->Y * MagneticElements->Ydot + MagneticElements->Z * MagneticElements->Zdot) / MagneticElements->F;
|
||||
MagneticElements->Decldot =
|
||||
180.0 / M_PI * (MagneticElements->X * MagneticElements->Ydot -
|
||||
180.0f / M_PI_F * (MagneticElements->X * MagneticElements->Ydot -
|
||||
MagneticElements->Y * MagneticElements->Xdot) / (MagneticElements->H * MagneticElements->H);
|
||||
MagneticElements->Incldot =
|
||||
180.0 / M_PI * (MagneticElements->H * MagneticElements->Zdot -
|
||||
180.0f / M_PI_F * (MagneticElements->H * MagneticElements->Zdot -
|
||||
MagneticElements->Z * MagneticElements->Hdot) / (MagneticElements->F * MagneticElements->F);
|
||||
MagneticElements->GVdot = MagneticElements->Decldot;
|
||||
|
||||
@ -776,7 +777,7 @@ int WMM_PcupHigh(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
|
||||
/* This function evaluates all of the Schmidt-semi normalized associated Legendre
|
||||
functions up to degree nMax. The functions are initially scaled by
|
||||
10^280 sin^m in order to minimize the effects of underflow at large m
|
||||
10^280 sinf^m in order to minimize the effects of underflow at large m
|
||||
near the poles (see Holmes and Featherstone 2002, J. Geodesy, 76, 279-299).
|
||||
Note that this function performs the same operation as WMM_PcupLow.
|
||||
However this function also can be used for high degree (large nMax) models.
|
||||
@ -784,7 +785,7 @@ int WMM_PcupHigh(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
Calling Parameters:
|
||||
INPUT
|
||||
nMax: Maximum spherical harmonic degree to compute.
|
||||
x: cos(colatitude) or sin(latitude).
|
||||
x: cosf(colatitude) or sinf(latitude).
|
||||
|
||||
OUTPUT
|
||||
Pcup: A vector of all associated Legendgre polynomials evaluated at
|
||||
@ -800,9 +801,9 @@ int WMM_PcupHigh(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
|
||||
Change from the previous version
|
||||
The prevous version computes the derivatives as
|
||||
dP(n,m)(x)/dx, where x = sin(latitude) (or cos(colatitude) ).
|
||||
dP(n,m)(x)/dx, where x = sinf(latitude) (or cosf(colatitude) ).
|
||||
However, the WMM Geomagnetic routines requires dP(n,m)(x)/dlatitude.
|
||||
Hence the derivatives are multiplied by sin(latitude).
|
||||
Hence the derivatives are multiplied by sinf(latitude).
|
||||
Removed the options for CS phase and normalizations.
|
||||
|
||||
Note: In geomagnetism, the derivatives of ALF are usually found with
|
||||
@ -842,7 +843,7 @@ int WMM_PcupHigh(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
scalef = 1.0e-280;
|
||||
|
||||
for (n = 0; n <= 2 * nMax + 1; ++n)
|
||||
PreSqr[n] = sqrt((float)(n));
|
||||
PreSqr[n] = sqrtf((float)(n));
|
||||
|
||||
k = 2;
|
||||
|
||||
@ -860,10 +861,10 @@ int WMM_PcupHigh(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
k = k + 2;
|
||||
}
|
||||
|
||||
/*z = sin (geocentric latitude) */
|
||||
z = sqrt((1.0 - x) * (1.0 + x));
|
||||
/*z = sinf (geocentric latitude) */
|
||||
z = sqrtf((1.0f - x) * (1.0f + x));
|
||||
pm2 = 1.0;
|
||||
Pcup[0] = 1.0;
|
||||
Pcup[0] = 1.0f;
|
||||
dPcup[0] = 0.0;
|
||||
if (nMax == 0)
|
||||
{
|
||||
@ -945,7 +946,7 @@ int WMM_PcupLow(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
Calling Parameters:
|
||||
INPUT
|
||||
nMax: Maximum spherical harmonic degree to compute.
|
||||
x: cos(colatitude) or sin(latitude).
|
||||
x: cosf(colatitude) or sinf(latitude).
|
||||
|
||||
OUTPUT
|
||||
Pcup: A vector of all associated Legendgre polynomials evaluated at
|
||||
@ -975,8 +976,8 @@ int WMM_PcupLow(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
Pcup[0] = 1.0;
|
||||
dPcup[0] = 0.0;
|
||||
|
||||
/*sin (geocentric latitude) - sin_phi */
|
||||
z = sqrt((1.0 - x) * (1.0 + x));
|
||||
/*sinf (geocentric latitude) - sin_phi */
|
||||
z = sqrtf((1.0f - x) * (1.0f + x));
|
||||
|
||||
/* First, Compute the Gauss-normalized associated Legendre functions */
|
||||
for (n = 1; n <= nMax; n++)
|
||||
@ -1033,7 +1034,7 @@ int WMM_PcupLow(float *Pcup, float *dPcup, float x, uint16_t nMax)
|
||||
{
|
||||
index = (n * (n + 1) / 2 + m);
|
||||
index1 = (n * (n + 1) / 2 + m - 1);
|
||||
schmidtQuasiNorm[index] = schmidtQuasiNorm[index1] * sqrt((float)((n - m + 1) * (m == 1 ? 2 : 1)) / (float)(n + m));
|
||||
schmidtQuasiNorm[index] = schmidtQuasiNorm[index1] * sqrtf((float)((n - m + 1) * (m == 1 ? 2 : 1)) / (float)(n + m));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1086,7 +1087,7 @@ int WMM_SummationSpecial(WMMtype_SphericalHarmonicVariables *
|
||||
schmidtQuasiNorm1 = 1.0;
|
||||
|
||||
MagneticResults->By = 0.0;
|
||||
sin_phi = sin(DEG2RAD(CoordSpherical->phig));
|
||||
sin_phi = sinf(DEG2RAD(CoordSpherical->phig));
|
||||
|
||||
for (n = 1; n <= MagneticModel->nMax; n++)
|
||||
{
|
||||
@ -1097,7 +1098,7 @@ int WMM_SummationSpecial(WMMtype_SphericalHarmonicVariables *
|
||||
|
||||
index = (n * (n + 1) / 2 + 1);
|
||||
schmidtQuasiNorm2 = schmidtQuasiNorm1 * (float)(2 * n - 1) / (float)n;
|
||||
schmidtQuasiNorm3 = schmidtQuasiNorm2 * sqrt((float)(n * 2) / (float)(n + 1));
|
||||
schmidtQuasiNorm3 = schmidtQuasiNorm2 * sqrtf((float)(n * 2) / (float)(n + 1));
|
||||
schmidtQuasiNorm1 = schmidtQuasiNorm2;
|
||||
if (n == 1)
|
||||
{
|
||||
@ -1110,7 +1111,7 @@ int WMM_SummationSpecial(WMMtype_SphericalHarmonicVariables *
|
||||
}
|
||||
|
||||
/* 1 nMax (n+2) n m m m
|
||||
By = SUM (a/r) (m) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
By = SUM (a/r) (m) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Equation 11 in the WMM Technical report. Derivative with respect to longitude, divided by radius. */
|
||||
|
||||
@ -1152,13 +1153,13 @@ int WMM_SecVarSummationSpecial(WMMtype_SphericalHarmonicVariables *
|
||||
schmidtQuasiNorm1 = 1.0;
|
||||
|
||||
MagneticResults->By = 0.0;
|
||||
sin_phi = sin(DEG2RAD(CoordSpherical->phig));
|
||||
sin_phi = sinf(DEG2RAD(CoordSpherical->phig));
|
||||
|
||||
for (n = 1; n <= MagneticModel->nMaxSecVar; n++)
|
||||
{
|
||||
index = (n * (n + 1) / 2 + 1);
|
||||
schmidtQuasiNorm2 = schmidtQuasiNorm1 * (float)(2 * n - 1) / (float)n;
|
||||
schmidtQuasiNorm3 = schmidtQuasiNorm2 * sqrt((float)(n * 2) / (float)(n + 1));
|
||||
schmidtQuasiNorm3 = schmidtQuasiNorm2 * sqrtf((float)(n * 2) / (float)(n + 1));
|
||||
schmidtQuasiNorm1 = schmidtQuasiNorm2;
|
||||
if (n == 1)
|
||||
{
|
||||
@ -1171,7 +1172,7 @@ int WMM_SecVarSummationSpecial(WMMtype_SphericalHarmonicVariables *
|
||||
}
|
||||
|
||||
/* 1 nMax (n+2) n m m m
|
||||
By = SUM (a/r) (m) SUM [g cos(m p) + h sin(m p)] dP (sin(phi))
|
||||
By = SUM (a/r) (m) SUM [g cosf(m p) + h sinf(m p)] dP (sinf(phi))
|
||||
n=1 m=0 n n n */
|
||||
/* Derivative with respect to longitude, divided by radius. */
|
||||
|
||||
@ -1291,7 +1292,7 @@ int WMM_DateToYear(uint16_t month, uint16_t day, uint16_t year)
|
||||
temp += MonthDays[i - 1];
|
||||
temp += day;
|
||||
|
||||
decimal_date = year + (temp - 1) / (365.0 + ExtraDay);
|
||||
decimal_date = year + (temp - 1) / (365.0f + ExtraDay);
|
||||
|
||||
return 0; // OK
|
||||
}
|
||||
@ -1304,21 +1305,21 @@ int WMM_GeodeticToSpherical(WMMtype_CoordGeodetic * CoordGeodetic, WMMtype_Coord
|
||||
{
|
||||
float CosLat, SinLat, rc, xp, zp; // all local variables
|
||||
|
||||
CosLat = cos(DEG2RAD(CoordGeodetic->phi));
|
||||
SinLat = sin(DEG2RAD(CoordGeodetic->phi));
|
||||
CosLat = cosf(DEG2RAD(CoordGeodetic->phi));
|
||||
SinLat = sinf(DEG2RAD(CoordGeodetic->phi));
|
||||
|
||||
// compute the local radius of curvature on the WGS-84 reference ellipsoid
|
||||
rc = Ellip->a / sqrt(1.0 - Ellip->epssq * SinLat * SinLat);
|
||||
rc = Ellip->a / sqrtf(1.0f - Ellip->epssq * SinLat * SinLat);
|
||||
|
||||
// compute ECEF Cartesian coordinates of specified point (for longitude=0)
|
||||
|
||||
xp = (rc + CoordGeodetic->HeightAboveEllipsoid) * CosLat;
|
||||
zp = (rc * (1.0 - Ellip->epssq) + CoordGeodetic->HeightAboveEllipsoid) * SinLat;
|
||||
zp = (rc * (1.0f - Ellip->epssq) + CoordGeodetic->HeightAboveEllipsoid) * SinLat;
|
||||
|
||||
// compute spherical radius and angle lambda and phi of specified point
|
||||
|
||||
CoordSpherical->r = sqrt(xp * xp + zp * zp);
|
||||
CoordSpherical->phig = RAD2DEG(asin(zp / CoordSpherical->r)); // geocentric latitude
|
||||
CoordSpherical->r = sqrtf(xp * xp + zp * zp);
|
||||
CoordSpherical->phig = RAD2DEG(asinf(zp / CoordSpherical->r)); // geocentric latitude
|
||||
CoordSpherical->lambda = CoordGeodetic->lambda; // longitude
|
||||
|
||||
return 0; // OK
|
||||
|
@ -27,7 +27,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include <openpilot.h>
|
||||
#include "inc/alarms.h"
|
||||
|
||||
// Private constants
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#ifndef WMMINTERNAL_H_
|
||||
#define WMMINTERNAL_H_
|
||||
#include <pios_math.h>
|
||||
|
||||
// internal constants
|
||||
#define TRUE ((uint16_t)1)
|
||||
@ -35,8 +36,6 @@
|
||||
#define NUMTERMS 91 // ((WMM_MAX_MODEL_DEGREES+1)*(WMM_MAX_MODEL_DEGREES+2)/2);
|
||||
#define NUMPCUP 92 // NUMTERMS +1
|
||||
#define NUMPCUPS 13 // WMM_MAX_MODEL_DEGREES +1
|
||||
#define RAD2DEG(rad) ((rad)*(180.0L/M_PI))
|
||||
#define DEG2RAD(deg) ((deg)*(M_PI/180.0L))
|
||||
|
||||
// internal structure definitions
|
||||
typedef struct {
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef ALARMS_H
|
||||
#define ALARMS_H
|
||||
|
||||
#include "systemalarms.h"
|
||||
#include <systemalarms.h>
|
||||
#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED
|
||||
|
||||
int32_t AlarmsInitialize(void);
|
||||
|
@ -26,11 +26,12 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <systemalarms.h>
|
||||
|
||||
#ifndef SANITYCHECK_H
|
||||
#define SANITYCHECK_H
|
||||
|
||||
#include <systemalarms.h>
|
||||
|
||||
#define SANITYCHECK_STATUS_ERROR_NONE SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE
|
||||
#define SANITYCHECK_STATUS_ERROR_FLIGHTMODE SYSTEMALARMS_EXTENDEDALARMSTATUS_FLIGHTMODE
|
||||
|
||||
|
0
flight/Libraries/insgps16state.c
Executable file → Normal file
@ -32,6 +32,7 @@
|
||||
#include "math.h"
|
||||
#include "stdbool.h"
|
||||
#include "stdint.h"
|
||||
#include <pios_math.h>
|
||||
|
||||
#define FLASH_TABLE
|
||||
#ifdef FLASH_TABLE
|
||||
@ -81,7 +82,7 @@ int sin_lookup_initalize()
|
||||
return -1;
|
||||
|
||||
for(uint32_t i = 0; i < 180; i++)
|
||||
sin_table[i] = sinf((float)i * 2 * M_PI / 360.0f);
|
||||
sin_table[i] = sinf(DEG2RAD((float)i));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -126,7 +127,7 @@ float cos_lookup_deg(float angle)
|
||||
*/
|
||||
float sin_lookup_rad(float angle)
|
||||
{
|
||||
int degrees = angle * 180.0f / M_PI;
|
||||
int degrees = angle * 180.0f / M_PI_F;
|
||||
return sin_lookup_deg(degrees);
|
||||
}
|
||||
|
||||
@ -137,6 +138,6 @@ float sin_lookup_rad(float angle)
|
||||
*/
|
||||
float cos_lookup_rad(float angle)
|
||||
{
|
||||
int degrees = angle * 180.0f / M_PI;
|
||||
int degrees = angle * 180.0f / M_PI_F;
|
||||
return cos_lookup_deg(degrees);
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ uint8_t Data0;
|
||||
uint8_t Data1;
|
||||
uint8_t Data2;
|
||||
uint8_t Data3;
|
||||
uint32_t Opt[3];
|
||||
|
||||
uint8_t offset = 0;
|
||||
uint32_t aux;
|
||||
//Download vars
|
||||
@ -133,6 +135,14 @@ void processComand(uint8_t *xReceive_Buffer) {
|
||||
Data1 = xReceive_Buffer[DATA + 1];
|
||||
Data2 = xReceive_Buffer[DATA + 2];
|
||||
Data3 = xReceive_Buffer[DATA + 3];
|
||||
for( uint32_t i=0; i < 3; i++ )
|
||||
{
|
||||
Opt[i] = xReceive_Buffer[DATA + 4 * (i+1) ] << 24 |
|
||||
xReceive_Buffer[DATA + 4 * (i+1) + 1] << 16 |
|
||||
xReceive_Buffer[DATA + 4 * (i+1) + 2] << 8 |
|
||||
xReceive_Buffer[DATA + 4 * (i+1) + 3];
|
||||
}
|
||||
|
||||
Command = Command & 0b00011111;
|
||||
|
||||
if (EchoReqFlag == 1) {
|
||||
@ -296,10 +306,16 @@ void processComand(uint8_t *xReceive_Buffer) {
|
||||
sendData(Buffer + 1, 63);
|
||||
break;
|
||||
case JumpFW:
|
||||
if (Data == 0x5AFE) {
|
||||
if (Data == 0x5AFE)
|
||||
{
|
||||
/* Force board into safe mode */
|
||||
PIOS_IAP_WriteBootCount(0xFFFF);
|
||||
}
|
||||
// pass any Opt value to the firmware
|
||||
PIOS_IAP_WriteBootCmd(0, Opt[0]);
|
||||
PIOS_IAP_WriteBootCmd(1, Opt[1]);
|
||||
PIOS_IAP_WriteBootCmd(2, Opt[2]);
|
||||
|
||||
FLASH_Lock();
|
||||
JumpToApp = 1;
|
||||
break;
|
||||
@ -339,8 +355,8 @@ void processComand(uint8_t *xReceive_Buffer) {
|
||||
downType = Data0;
|
||||
downPacketTotal = Count;
|
||||
downSizeOfLastPacket = Data1;
|
||||
if (isBiggerThanAvailable(downType, (downPacketTotal - 1) * 14 * 4
|
||||
+ downSizeOfLastPacket * 4) == 1) {
|
||||
if (isBiggerThanAvailable(downType, (downPacketTotal - 1) * 14
|
||||
+ downSizeOfLastPacket) == 1) {
|
||||
DeviceState = outsideDevCapabilities;
|
||||
Aditionals = (uint32_t) Command;
|
||||
|
||||
@ -383,8 +399,8 @@ void processComand(uint8_t *xReceive_Buffer) {
|
||||
|
||||
}
|
||||
if (EchoReqFlag == 1) {
|
||||
echoBuffer[0] = echoBuffer[0] | (1 << 6);
|
||||
sendData(echoBuffer, 63);
|
||||
echoBuffer[1] = echoBuffer[1] | EchoAnsFlag;
|
||||
sendData(echoBuffer + 1, 63);
|
||||
}
|
||||
return;
|
||||
}
|
@ -94,7 +94,7 @@ static void path_endpoint(float * start_point, float * end_point, float * cur_po
|
||||
dist_diff = sqrtf(diff_north * diff_north + diff_east * diff_east);
|
||||
dist_path = sqrtf(path_north * path_north + path_east * path_east);
|
||||
|
||||
if (dist_diff < 1e-6) {
|
||||
if (dist_diff < 1e-6f ) {
|
||||
status->fractional_progress = 1;
|
||||
status->error = 0;
|
||||
status->path_direction[0] = status->path_direction[1] = 0;
|
||||
@ -135,7 +135,7 @@ static void path_vector(float * start_point, float * end_point, float * cur_poin
|
||||
dot = path_north * diff_north + path_east * diff_east;
|
||||
dist_path = sqrtf(path_north * path_north + path_east * path_east);
|
||||
|
||||
if (dist_path < 1e-6) {
|
||||
if (dist_path < 1e-6f){
|
||||
// if the path is too short, we cannot determine vector direction.
|
||||
// Fly towards the endpoint to prevent flying away,
|
||||
// but assume progress=1 either way.
|
||||
@ -190,7 +190,7 @@ static void path_circle(float * start_point, float * end_point, float * cur_poin
|
||||
radius = sqrtf(powf(radius_north, 2) + powf(radius_east, 2));
|
||||
cradius = sqrtf(powf(diff_north, 2) + powf(diff_east, 2));
|
||||
|
||||
if (cradius < 1e-6) {
|
||||
if (cradius < 1e-6f) {
|
||||
// cradius is zero, just fly somewhere and make sure correction is still a normal
|
||||
status->fractional_progress = 1;
|
||||
status->error = radius;
|
||||
|
0
flight/Libraries/rscode/.no-auto-format
Normal file
@ -35,7 +35,7 @@
|
||||
#include "gpsvelocity.h"
|
||||
#include "attitudeactual.h"
|
||||
#include "CoordinateConversions.h"
|
||||
|
||||
#include <pios_math.h>
|
||||
|
||||
|
||||
// Private constants
|
||||
@ -44,9 +44,6 @@
|
||||
#define SAMPLING_DELAY_MS_GPS 100 //Needs to be settable in a UAVO
|
||||
#define GPS_AIRSPEED_TIME_CONSTANT_MS 500.0f //Needs to be settable in a UAVO
|
||||
|
||||
#define F_PI 3.141526535897932f
|
||||
#define DEG2RAD (F_PI/180.0f)
|
||||
|
||||
// Private types
|
||||
struct GPSGlobals {
|
||||
float RbeCol1_old[3];
|
||||
@ -117,7 +114,7 @@ void gps_airspeedGet(float *v_air_GPS)
|
||||
float cosDiff=(Rbe[0][0]*gps->RbeCol1_old[0]) + (Rbe[0][1]*gps->RbeCol1_old[1]) + (Rbe[0][2]*gps->RbeCol1_old[2]);
|
||||
|
||||
//If there's more than a 5 degree difference between two fuselage measurements, then we have sufficient delta to continue.
|
||||
if (fabs(cosDiff) < cos(5.0f*DEG2RAD)) {
|
||||
if (fabsf(cosDiff) < cosf(DEG2RAD(5.0f))) {
|
||||
GPSVelocityData gpsVelData;
|
||||
GPSVelocityGet(&gpsVelData);
|
||||
|
||||
|
@ -58,6 +58,8 @@
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "CoordinateConversions.h"
|
||||
#include <pios_board_info.h>
|
||||
#include <pios_math.h>
|
||||
|
||||
|
||||
// Private constants
|
||||
#define STACK_SIZE_BYTES 540
|
||||
@ -67,7 +69,6 @@
|
||||
#define UPDATE_RATE 25.0f
|
||||
#define GYRO_NEUTRAL 1665
|
||||
|
||||
#define PI_MOD(x) (fmod(x + M_PI, M_PI * 2) - M_PI)
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
@ -334,7 +335,7 @@ static int32_t updateSensors(AccelsData * accels, GyrosData * gyros)
|
||||
float throttle;
|
||||
FlightStatusArmedGet(&armed);
|
||||
ManualControlCommandThrottleGet(&throttle); // Until flight status indicates airborne
|
||||
if ((armed == FLIGHTSTATUS_ARMED_ARMED) && (throttle > 0)) {
|
||||
if ((armed == FLIGHTSTATUS_ARMED_ARMED) && (throttle > 0.0f)) {
|
||||
trim_samples++;
|
||||
// Store the digitally scaled version since that is what we use for bias
|
||||
trim_accels[0] += accels->x;
|
||||
@ -513,10 +514,10 @@ static void updateAttitude(AccelsData * accelsData, GyrosData * gyrosData)
|
||||
// Work out time derivative from INSAlgo writeup
|
||||
// Also accounts for the fact that gyros are in deg/s
|
||||
float qdot[4];
|
||||
qdot[0] = (-q[1] * gyros[0] - q[2] * gyros[1] - q[3] * gyros[2]) * dT * M_PI / 180 / 2;
|
||||
qdot[1] = (q[0] * gyros[0] - q[3] * gyros[1] + q[2] * gyros[2]) * dT * M_PI / 180 / 2;
|
||||
qdot[2] = (q[3] * gyros[0] + q[0] * gyros[1] - q[1] * gyros[2]) * dT * M_PI / 180 / 2;
|
||||
qdot[3] = (-q[2] * gyros[0] + q[1] * gyros[1] + q[0] * gyros[2]) * dT * M_PI / 180 / 2;
|
||||
qdot[0] = (-q[1] * gyros[0] - q[2] * gyros[1] - q[3] * gyros[2]) * dT * (M_PI_F / 180.0f / 2.0f);
|
||||
qdot[1] = (q[0] * gyros[0] - q[3] * gyros[1] + q[2] * gyros[2]) * dT * (M_PI_F / 180.0f / 2.0f);
|
||||
qdot[2] = (q[3] * gyros[0] + q[0] * gyros[1] - q[1] * gyros[2]) * dT * (M_PI_F / 180.0f / 2.0f);
|
||||
qdot[3] = (-q[2] * gyros[0] + q[1] * gyros[1] + q[0] * gyros[2]) * dT * (M_PI_F / 180.0f / 2.0f);
|
||||
|
||||
// Take a time step
|
||||
q[0] = q[0] + qdot[0];
|
||||
@ -541,7 +542,7 @@ static void updateAttitude(AccelsData * accelsData, GyrosData * gyrosData)
|
||||
|
||||
// If quaternion has become inappropriately short or is nan reinit.
|
||||
// THIS SHOULD NEVER ACTUALLY HAPPEN
|
||||
if((fabs(qmag) < 1e-3) || (qmag != qmag)) {
|
||||
if((fabsf(qmag) < 1e-3f) || (qmag != qmag)) {
|
||||
q[0] = 1;
|
||||
q[1] = 0;
|
||||
q[2] = 0;
|
||||
@ -571,7 +572,7 @@ static void settingsUpdatedCb(UAVObjEvent * objEv) {
|
||||
|
||||
// Calculate accel filter alpha, in the same way as for gyro data in stabilization module.
|
||||
const float fakeDt = 0.0025;
|
||||
if (attitudeSettings.AccelTau < 0.0001) {
|
||||
if (attitudeSettings.AccelTau < 0.0001f) {
|
||||
accel_alpha = 0; // not trusting this to resolve to 0
|
||||
accel_filter_enabled = false;
|
||||
} else {
|
||||
|
@ -70,15 +70,12 @@
|
||||
#include "revosettings.h"
|
||||
#include "velocityactual.h"
|
||||
#include "CoordinateConversions.h"
|
||||
|
||||
#include <pios_math.h>
|
||||
// Private constants
|
||||
#define STACK_SIZE_BYTES 2048
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+3)
|
||||
#define FAILSAFE_TIMEOUT_MS 10
|
||||
|
||||
#define F_PI 3.14159265358979323846f
|
||||
#define PI_MOD(x) (fmodf(x + F_PI, F_PI * 2) - F_PI)
|
||||
|
||||
// low pass filter configuration to calculate offset
|
||||
// of barometric altitude sensor
|
||||
// reasoning: updates at: 10 Hz, tau= 300 s settle time
|
||||
@ -303,9 +300,9 @@ static int32_t updateAttitudeComplementary(bool first_run)
|
||||
AttitudeActualData attitudeActual;
|
||||
AttitudeActualGet(&attitudeActual);
|
||||
init = 0;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / F_PI;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / M_PI_F;
|
||||
|
||||
RPY2Quaternion(&attitudeActual.Roll,&attitudeActual.q1);
|
||||
AttitudeActualSet(&attitudeActual);
|
||||
@ -415,10 +412,10 @@ static int32_t updateAttitudeComplementary(bool first_run)
|
||||
// Work out time derivative from INSAlgo writeup
|
||||
// Also accounts for the fact that gyros are in deg/s
|
||||
float qdot[4];
|
||||
qdot[0] = (-q[1] * gyrosData.x - q[2] * gyrosData.y - q[3] * gyrosData.z) * dT * F_PI / 180 / 2;
|
||||
qdot[1] = (q[0] * gyrosData.x - q[3] * gyrosData.y + q[2] * gyrosData.z) * dT * F_PI / 180 / 2;
|
||||
qdot[2] = (q[3] * gyrosData.x + q[0] * gyrosData.y - q[1] * gyrosData.z) * dT * F_PI / 180 / 2;
|
||||
qdot[3] = (-q[2] * gyrosData.x + q[1] * gyrosData.y + q[0] * gyrosData.z) * dT * F_PI / 180 / 2;
|
||||
qdot[0] = (-q[1] * gyrosData.x - q[2] * gyrosData.y - q[3] * gyrosData.z) * dT * M_PI_F / 180 / 2;
|
||||
qdot[1] = (q[0] * gyrosData.x - q[3] * gyrosData.y + q[2] * gyrosData.z) * dT * M_PI_F / 180 / 2;
|
||||
qdot[2] = (q[3] * gyrosData.x + q[0] * gyrosData.y - q[1] * gyrosData.z) * dT * M_PI_F / 180 / 2;
|
||||
qdot[3] = (-q[2] * gyrosData.x + q[1] * gyrosData.y + q[0] * gyrosData.z) * dT * M_PI_F / 180 / 2;
|
||||
|
||||
// Take a time step
|
||||
q[0] = q[0] + qdot[0];
|
||||
@ -641,7 +638,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
INSSetBaroVar(revoCalibration.baro_var);
|
||||
|
||||
// Initialize the gyro bias from the settings
|
||||
float gyro_bias[3] = {gyrosBias.x * F_PI / 180.0f, gyrosBias.y * F_PI / 180.0f, gyrosBias.z * F_PI / 180.0f};
|
||||
float gyro_bias[3] = {gyrosBias.x * M_PI_F / 180.0f, gyrosBias.y * M_PI_F / 180.0f, gyrosBias.z * M_PI_F / 180.0f};
|
||||
INSSetGyroBias(gyro_bias);
|
||||
|
||||
xQueueReceive(magQueue, &ev, 100 / portTICK_RATE_MS);
|
||||
@ -649,9 +646,9 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
|
||||
// Set initial attitude
|
||||
AttitudeActualData attitudeActual;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / F_PI;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / M_PI_F;
|
||||
RPY2Quaternion(&attitudeActual.Roll,&attitudeActual.q1);
|
||||
AttitudeActualSet(&attitudeActual);
|
||||
|
||||
@ -676,7 +673,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
INSSetMagNorth(homeLocation.Be);
|
||||
|
||||
// Initialize the gyro bias from the settings
|
||||
float gyro_bias[3] = {gyrosBias.x * F_PI / 180.0f, gyrosBias.y * F_PI / 180.0f, gyrosBias.z * F_PI / 180.0f};
|
||||
float gyro_bias[3] = {gyrosBias.x * M_PI_F / 180.0f, gyrosBias.y * M_PI_F / 180.0f, gyrosBias.z * M_PI_F / 180.0f};
|
||||
INSSetGyroBias(gyro_bias);
|
||||
|
||||
GPSPositionData gpsPosition;
|
||||
@ -693,9 +690,9 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
|
||||
// Set initial attitude
|
||||
AttitudeActualData attitudeActual;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / F_PI;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / F_PI;
|
||||
attitudeActual.Roll = atan2f(-accelsData.y, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Pitch = atan2f(accelsData.x, -accelsData.z) * 180.0f / M_PI_F;
|
||||
attitudeActual.Yaw = atan2f(-magData.y, magData.x) * 180.0f / M_PI_F;
|
||||
RPY2Quaternion(&attitudeActual.Roll,&attitudeActual.q1);
|
||||
AttitudeActualSet(&attitudeActual);
|
||||
|
||||
@ -711,9 +708,9 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
dT = PIOS_DELAY_DiffuS(ins_last_time) / 1.0e6f;
|
||||
|
||||
GyrosBiasGet(&gyrosBias);
|
||||
float gyros[3] = {(gyrosData.x + gyrosBias.x) * F_PI / 180.0f,
|
||||
(gyrosData.y + gyrosBias.y) * F_PI / 180.0f,
|
||||
(gyrosData.z + gyrosBias.z) * F_PI / 180.0f};
|
||||
float gyros[3] = {(gyrosData.x + gyrosBias.x) * M_PI_F / 180.0f,
|
||||
(gyrosData.y + gyrosBias.y) * M_PI_F / 180.0f,
|
||||
(gyrosData.z + gyrosBias.z) * M_PI_F / 180.0f};
|
||||
INSStatePrediction(gyros, &accelsData.x, dT);
|
||||
|
||||
AttitudeActualData attitude;
|
||||
@ -750,18 +747,18 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
// If the gyro bias setting was updated we should reset
|
||||
// the state estimate of the EKF
|
||||
if(gyroBiasSettingsUpdated) {
|
||||
float gyro_bias[3] = {gyrosBias.x * F_PI / 180.0f, gyrosBias.y * F_PI / 180.0f, gyrosBias.z * F_PI / 180.0f};
|
||||
float gyro_bias[3] = {gyrosBias.x * M_PI_F / 180.0f, gyrosBias.y * M_PI_F / 180.0f, gyrosBias.z * M_PI_F / 180.0f};
|
||||
INSSetGyroBias(gyro_bias);
|
||||
gyroBiasSettingsUpdated = false;
|
||||
}
|
||||
|
||||
// Because the sensor module remove the bias we need to add it
|
||||
// back in here so that the INS algorithm can track it correctly
|
||||
float gyros[3] = {gyrosData.x * F_PI / 180.0f, gyrosData.y * F_PI / 180.0f, gyrosData.z * F_PI / 180.0f};
|
||||
float gyros[3] = {gyrosData.x * M_PI_F / 180.0f, gyrosData.y * M_PI_F / 180.0f, gyrosData.z * M_PI_F / 180.0f};
|
||||
if (revoCalibration.BiasCorrectedRaw == REVOCALIBRATION_BIASCORRECTEDRAW_TRUE) {
|
||||
gyros[0] += gyrosBias.x * F_PI / 180.0f;
|
||||
gyros[1] += gyrosBias.y * F_PI / 180.0f;
|
||||
gyros[2] += gyrosBias.z * F_PI / 180.0f;
|
||||
gyros[0] += gyrosBias.x * M_PI_F / 180.0f;
|
||||
gyros[1] += gyrosBias.y * M_PI_F / 180.0f;
|
||||
gyros[2] += gyrosBias.z * M_PI_F / 180.0f;
|
||||
}
|
||||
|
||||
// Advance the state estimate
|
||||
@ -795,8 +792,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
|
||||
if (0) { // Old code to take horizontal velocity from GPS Position update
|
||||
sensors |= HORIZ_SENSORS;
|
||||
vel[0] = gpsData.Groundspeed * cosf(gpsData.Heading * F_PI / 180.0f);
|
||||
vel[1] = gpsData.Groundspeed * sinf(gpsData.Heading * F_PI / 180.0f);
|
||||
vel[0] = gpsData.Groundspeed * cosf(gpsData.Heading * M_PI_F / 180.0f);
|
||||
vel[1] = gpsData.Groundspeed * sinf(gpsData.Heading * M_PI_F / 180.0f);
|
||||
vel[2] = 0;
|
||||
}
|
||||
// Transform the GPS position into NED coordinates
|
||||
@ -870,9 +867,9 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
|
||||
// Copy the gyro bias into the UAVO except when it was updated
|
||||
// from the settings during the calculation, then consume it
|
||||
// next cycle
|
||||
gyrosBias.x = Nav.gyro_bias[0] * 180.0f / F_PI;
|
||||
gyrosBias.y = Nav.gyro_bias[1] * 180.0f / F_PI;
|
||||
gyrosBias.z = Nav.gyro_bias[2] * 180.0f / F_PI;
|
||||
gyrosBias.x = Nav.gyro_bias[0] * 180.0f / M_PI_F;
|
||||
gyrosBias.y = Nav.gyro_bias[1] * 180.0f / M_PI_F;
|
||||
gyrosBias.z = Nav.gyro_bias[2] * 180.0f / M_PI_F;
|
||||
GyrosBiasSet(&gyrosBias);
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ void applyFeedForward(uint8_t index, float dT_millis, float *attitude, CameraSta
|
||||
if (index == CAMERASTABSETTINGS_INPUT_ROLL) {
|
||||
float pitch;
|
||||
AttitudeActualPitchGet(&pitch);
|
||||
gimbalTypeCorrection = (cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_PITCH] - fabs(pitch))
|
||||
gimbalTypeCorrection = (cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_PITCH] - fabsf(pitch))
|
||||
/ cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_PITCH];
|
||||
}
|
||||
break;
|
||||
@ -303,7 +303,7 @@ void applyFeedForward(uint8_t index, float dT_millis, float *attitude, CameraSta
|
||||
if (index == CAMERASTABSETTINGS_INPUT_PITCH) {
|
||||
float roll;
|
||||
AttitudeActualRollGet(&roll);
|
||||
gimbalTypeCorrection = (cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_ROLL] - fabs(roll))
|
||||
gimbalTypeCorrection = (cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_ROLL] - fabsf(roll))
|
||||
/ cameraStab->OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_ROLL];
|
||||
}
|
||||
break;
|
||||
|
@ -66,16 +66,12 @@
|
||||
#include "velocitydesired.h"
|
||||
#include "velocityactual.h"
|
||||
#include "CoordinateConversions.h"
|
||||
|
||||
#include <pios_math.h>
|
||||
#include <pios_constants.h>
|
||||
// Private constants
|
||||
#define MAX_QUEUE_SIZE 4
|
||||
#define STACK_SIZE_BYTES 1548
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+2)
|
||||
#define F_PI 3.14159265358979323846f
|
||||
#define RAD2DEG (180.0f/F_PI)
|
||||
#define DEG2RAD (F_PI/180.0f)
|
||||
#define GEE 9.81f
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static bool followerEnabled = false;
|
||||
@ -293,7 +289,7 @@ static void updatePathVelocity()
|
||||
break;
|
||||
}
|
||||
// make sure groundspeed is not zero
|
||||
if (groundspeed<1e-2) groundspeed=1e-2;
|
||||
if (groundspeed<1e-2f) groundspeed=1e-2f;
|
||||
|
||||
// calculate velocity - can be zero if waypoints are too close
|
||||
VelocityDesiredData velocityDesired;
|
||||
@ -313,8 +309,8 @@ static void updatePathVelocity()
|
||||
// difference between correction_direction and velocityactual >90 degrees and
|
||||
// difference between path_direction and velocityactual >90 degrees ( 4th sector, facing away from eerything )
|
||||
// fix: ignore correction, steer in path direction until the situation has become better (condition doesn't apply anymore)
|
||||
float angle1=RAD2DEG * ( atan2f(progress.path_direction[1],progress.path_direction[0]) - atan2f(velocityActual.East,velocityActual.North));
|
||||
float angle2=RAD2DEG * ( atan2f(progress.correction_direction[1],progress.correction_direction[0]) - atan2f(velocityActual.East,velocityActual.North));
|
||||
float angle1=RAD2DEG( atan2f(progress.path_direction[1],progress.path_direction[0]) - atan2f(velocityActual.East,velocityActual.North));
|
||||
float angle2=RAD2DEG( atan2f(progress.correction_direction[1],progress.correction_direction[0]) - atan2f(velocityActual.East,velocityActual.North));
|
||||
if (angle1<-180.0f) angle1+=360.0f;
|
||||
if (angle1>180.0f) angle1-=360.0f;
|
||||
if (angle2<-180.0f) angle2+=360.0f;
|
||||
@ -470,7 +466,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
result = 0;
|
||||
}
|
||||
|
||||
if (indicatedAirspeedActual<1e-6) {
|
||||
if (indicatedAirspeedActual<1e-6f) {
|
||||
// prevent division by zero, abort without controlling anything. This guidance mode is not suited for takeoff or touchdown, or handling stationary planes
|
||||
// also we cannot handle planes flying backwards, lets just wait until the nose drops
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_LOWSPEED] = 1;
|
||||
@ -583,8 +579,8 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
/**
|
||||
* Compute desired roll command
|
||||
*/
|
||||
if (groundspeedDesired> 1e-6) {
|
||||
bearingError = RAD2DEG * (atan2f(velocityDesired.East,velocityDesired.North) - atan2f(velocityActual.East,velocityActual.North));
|
||||
if (groundspeedDesired> 1e-6f) {
|
||||
bearingError = RAD2DEG(atan2f(velocityDesired.East,velocityDesired.North) - atan2f(velocityActual.East,velocityActual.North));
|
||||
} else {
|
||||
// if we are not supposed to move, run in a circle
|
||||
bearingError = -90.0f;
|
||||
|
@ -2,12 +2,12 @@
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotModules OpenPilot Modules
|
||||
* @{
|
||||
* @addtogroup PipXtremeModule PipXtreme Module
|
||||
* @addtogroup OPLinkModule OPLink Module
|
||||
* @{
|
||||
*
|
||||
* @file pipxtrememod.h
|
||||
* @file oplinkmod.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @brief The PipXtreme system module
|
||||
* @brief The OPLink system module
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
@ -27,9 +27,9 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef PIPXTREMEMOD_H
|
||||
#define PIPXTREMEMOD_H
|
||||
#ifndef OPLINKMOD_H
|
||||
#define OPLINKMOD_H
|
||||
|
||||
int32_t PipXtremeModInitialize(void);
|
||||
int32_t OPLinkModInitialize(void);
|
||||
|
||||
#endif // PIPXTREMEMOD_H
|
||||
#endif // OPLINKMOD_H
|
@ -2,20 +2,20 @@
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotModules OpenPilot Modules
|
||||
* @brief The OpenPilot Modules do the majority of the control in OpenPilot. The
|
||||
* @ref PipXtremeModule The PipXtreme Module is the equivalanet of the System
|
||||
* Module for the PipXtreme modem. it starts all the other modules.
|
||||
* @ref OPLinkModule The OPLink Module is the equivalanet of the System
|
||||
* Module for the OPLink modem. it starts all the other modules.
|
||||
# This is done through the @ref PIOS "PIOS Hardware abstraction layer",
|
||||
# which then contains hardware specific implementations
|
||||
* (currently only STM32 supported)
|
||||
*
|
||||
* @{
|
||||
* @addtogroup PipXtremeModule PipXtreme Module
|
||||
* @addtogroup OPLinkModule OPLink Module
|
||||
* @brief Initializes PIOS and other modules runs monitoring
|
||||
* After initializing all the modules runs basic monitoring and
|
||||
* alarms.
|
||||
* @{
|
||||
*
|
||||
* @file pipxtrememod.c
|
||||
* @file oplinkmod.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @brief System module
|
||||
*
|
||||
@ -43,7 +43,6 @@
|
||||
#include <pios_rfm22b.h>
|
||||
#include <pios_board_info.h>
|
||||
#include <oplinksettings.h>
|
||||
#include "systemmod.h"
|
||||
|
||||
// Private constants
|
||||
#define SYSTEM_UPDATE_PERIOD_MS 1000
|
||||
@ -72,13 +71,13 @@ static void systemTask(void *parameters);
|
||||
* Create the module task.
|
||||
* \returns 0 on success or -1 if initialization failed
|
||||
*/
|
||||
int32_t PipXtremeModStart(void)
|
||||
int32_t OPLinkModStart(void)
|
||||
{
|
||||
// Initialize vars
|
||||
stackOverflow = false;
|
||||
mallocFailed = false;
|
||||
// Create pipxtreme system task
|
||||
xTaskCreate(systemTask, (signed char *)"PipXtreme", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &systemTaskHandle);
|
||||
// Create oplink system task
|
||||
xTaskCreate(systemTask, (signed char *)"OPLink", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &systemTaskHandle);
|
||||
// Register task
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_SYSTEM, systemTaskHandle);
|
||||
|
||||
@ -89,7 +88,7 @@ int32_t PipXtremeModStart(void)
|
||||
* Initialize the module, called on startup.
|
||||
* \returns 0 on success or -1 if initialization failed
|
||||
*/
|
||||
int32_t PipXtremeModInitialize(void)
|
||||
int32_t OPLinkModInitialize(void)
|
||||
{
|
||||
|
||||
// Must registers objects here for system thread because ObjectManager started in OpenPilotInit
|
||||
@ -111,12 +110,12 @@ int32_t PipXtremeModInitialize(void)
|
||||
OPLinkStatusSet(&oplinkStatus);
|
||||
|
||||
// Call the module start function.
|
||||
PipXtremeModStart();
|
||||
OPLinkModStart();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_INITCALL(PipXtremeModInitialize, 0)
|
||||
MODULE_INITCALL(OPLinkModInitialize, 0)
|
||||
|
||||
/**
|
||||
* System task, periodically executes every SYSTEM_UPDATE_PERIOD_MS
|
||||
@ -152,7 +151,7 @@ static void systemTask(void *parameters)
|
||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||
#endif /* PIOS_LED_HEARTBEAT */
|
||||
|
||||
// Update the PipXstatus UAVO
|
||||
// Update the OPLinkStatus UAVO
|
||||
OPLinkStatusData oplinkStatus;
|
||||
OPLinkStatusGet(&oplinkStatus);
|
||||
|
@ -334,7 +334,7 @@ static uint8_t conditionTimeOut() {
|
||||
toWaypoint = waypointActive.Index;
|
||||
toStarttime = PIOS_DELAY_GetRaw();
|
||||
}
|
||||
if (PIOS_DELAY_DiffuS(toStarttime) >= 1e6 * pathAction.ConditionParameters[0]) {
|
||||
if (PIOS_DELAY_DiffuS(toStarttime) >= 1e6f * pathAction.ConditionParameters[0]) {
|
||||
// make sure we reinitialize even if the same waypoint comes twice
|
||||
toWaypoint = 0xFFFF;
|
||||
return true;
|
||||
|
@ -46,20 +46,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include <openpilot.h>
|
||||
|
||||
#include "homelocation.h"
|
||||
#include "magnetometer.h"
|
||||
#include "magbias.h"
|
||||
#include "accels.h"
|
||||
#include "gyros.h"
|
||||
#include "gyrosbias.h"
|
||||
#include "attitudeactual.h"
|
||||
#include "attitudesettings.h"
|
||||
#include "revocalibration.h"
|
||||
#include "flightstatus.h"
|
||||
#include "CoordinateConversions.h"
|
||||
#include <homelocation.h>
|
||||
#include <magnetometer.h>
|
||||
#include <magbias.h>
|
||||
#include <accels.h>
|
||||
#include <gyros.h>
|
||||
#include <gyrosbias.h>
|
||||
#include <attitudeactual.h>
|
||||
#include <attitudesettings.h>
|
||||
#include <revocalibration.h>
|
||||
#include <flightstatus.h>
|
||||
#include <CoordinateConversions.h>
|
||||
|
||||
#include <pios_math.h>
|
||||
#include <pios_board_info.h>
|
||||
|
||||
// Private constants
|
||||
@ -67,8 +68,6 @@
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+3)
|
||||
#define SENSOR_PERIOD 2
|
||||
|
||||
#define F_PI 3.14159265358979323846f
|
||||
#define PI_MOD(x) (fmodf(x + F_PI, F_PI * 2) - F_PI)
|
||||
// Private types
|
||||
|
||||
|
||||
@ -302,7 +301,7 @@ static void SensorsTask(void *parameters)
|
||||
{
|
||||
struct pios_mpu6000_data mpu6000_data;
|
||||
xQueueHandle queue = PIOS_MPU6000_GetQueue();
|
||||
|
||||
|
||||
while(xQueueReceive(queue, (void *) &mpu6000_data, gyro_samples == 0 ? 10 : 0) != errQUEUE_EMPTY)
|
||||
{
|
||||
gyro_accum[0] += mpu6000_data.gyro_x;
|
||||
@ -316,7 +315,7 @@ static void SensorsTask(void *parameters)
|
||||
gyro_samples ++;
|
||||
accel_samples ++;
|
||||
}
|
||||
|
||||
|
||||
if (gyro_samples == 0) {
|
||||
PIOS_MPU6000_ReadGyros(&mpu6000_data);
|
||||
error = true;
|
||||
@ -498,8 +497,8 @@ static void magOffsetEstimation(MagnetometerData *mag)
|
||||
B_e[1] = R[0][1] * mag->x + R[1][1] * mag->y + R[2][1] * mag->z;
|
||||
B_e[2] = R[0][2] * mag->x + R[1][2] * mag->y + R[2][2] * mag->z;
|
||||
|
||||
float cy = cosf(attitude.Yaw * M_PI / 180.0f);
|
||||
float sy = sinf(attitude.Yaw * M_PI / 180.0f);
|
||||
float cy = cosf(DEG2RAD(attitude.Yaw));
|
||||
float sy = sinf(DEG2RAD(attitude.Yaw));
|
||||
|
||||
xy[0] = cy * B_e[0] + sy * B_e[1];
|
||||
xy[1] = -sy * B_e[0] + cy * B_e[1];
|
||||
|
@ -305,7 +305,7 @@ static void stabilizationTask(void* parameters)
|
||||
if (reinit)
|
||||
pids[PID_RATE_ROLL + i].iAccumulator = 0;
|
||||
|
||||
if(fabs(attitudeDesiredAxis[i]) > max_axislock_rate) {
|
||||
if(fabsf(attitudeDesiredAxis[i]) > max_axislock_rate) {
|
||||
// While getting strong commands act like rate mode
|
||||
rateDesiredAxis[i] = attitudeDesiredAxis[i];
|
||||
axis_lock_accum[i] = 0;
|
||||
@ -494,7 +494,7 @@ static void SettingsUpdatedCb(UAVObjEvent * ev)
|
||||
// update rates on OP (~300 Hz) and CC (~475 Hz) is negligible for this
|
||||
// calculation
|
||||
const float fakeDt = 0.0025;
|
||||
if(settings.GyroTau < 0.0001)
|
||||
if(settings.GyroTau < 0.0001f)
|
||||
gyro_alpha = 0; // not trusting this to resolve to 0
|
||||
else
|
||||
gyro_alpha = expf(-fakeDt / settings.GyroTau);
|
||||
|
@ -55,7 +55,7 @@ int stabilization_virtual_flybar(float gyro, float command, float *output, float
|
||||
|
||||
// Command signal can indicate how much to disregard the gyro feedback (fast flips)
|
||||
if (settings->VbarGyroSuppress > 0) {
|
||||
gyro_gain = (1.0f - fabs(command) * settings->VbarGyroSuppress / 100.0f);
|
||||
gyro_gain = (1.0f - fabsf(command) * settings->VbarGyroSuppress / 100.0f);
|
||||
gyro_gain = (gyro_gain < 0) ? 0 : gyro_gain;
|
||||
}
|
||||
|
||||
|
0
flight/PiOS.osx/osx/Libraries/.no-auto-format
Normal file
0
flight/PiOS.win32/win32/Libraries/.no-auto-format
Normal file
@ -1,334 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @{
|
||||
* @file pios_board.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef STM3210E_OP_H_
|
||||
#define STM3210E_OP_H_
|
||||
|
||||
|
||||
|
||||
//------------------------
|
||||
// Timers and Channels Used
|
||||
//------------------------
|
||||
/*
|
||||
Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
|
||||
------+-----------+-----------+-----------+----------
|
||||
TIM1 | RC In 3 | RC In 6 | RC In 5 |
|
||||
TIM2 | --------------- PIOS_DELAY -----------------
|
||||
TIM3 | RC In 7 | RC In 8 | RC In 1 | RC In 2
|
||||
TIM4 | Servo 1 | Servo 2 | Servo 3 | Servo 4
|
||||
TIM5 | RC In 4 | | |
|
||||
TIM6 | ----------- PIOS_PWM (Supervisor) ----------
|
||||
TIM7 | | | |
|
||||
TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8
|
||||
------+-----------+-----------+-----------+----------
|
||||
*/
|
||||
|
||||
//------------------------
|
||||
// DMA Channels Used
|
||||
//------------------------
|
||||
/* Channel 1 - ADC */
|
||||
/* Channel 2 - SPI1 RX */
|
||||
/* Channel 3 - SPI1 TX */
|
||||
/* Channel 4 - SPI2 RX */
|
||||
/* Channel 5 - SPI2 TX */
|
||||
/* Channel 6 - */
|
||||
/* Channel 7 - */
|
||||
/* Channel 8 - */
|
||||
/* Channel 9 - */
|
||||
/* Channel 10 - */
|
||||
/* Channel 11 - */
|
||||
/* Channel 12 - */
|
||||
|
||||
//------------------------
|
||||
// BOOTLOADER_SETTINGS
|
||||
//------------------------
|
||||
#define BOARD_READABLE TRUE
|
||||
#define BOARD_WRITABLE TRUE
|
||||
#define MAX_DEL_RETRYS 3
|
||||
|
||||
//------------------------
|
||||
// WATCHDOG_SETTINGS
|
||||
//------------------------
|
||||
#define PIOS_WATCHDOG_TIMEOUT 250
|
||||
#define PIOS_WDG_REGISTER BKP_DR4
|
||||
#define PIOS_WDG_ACTUATOR 0x0001
|
||||
#define PIOS_WDG_STABILIZATION 0x0002
|
||||
#define PIOS_WDG_AHRS 0x0004
|
||||
#define PIOS_WDG_MANUAL 0x0008
|
||||
|
||||
//------------------------
|
||||
// TELEMETRY
|
||||
//------------------------
|
||||
#define TELEM_QUEUE_SIZE 20
|
||||
#define PIOS_TELEM_STACK_SIZE 624
|
||||
|
||||
//------------------------
|
||||
// PIOS_LED
|
||||
//------------------------
|
||||
#define PIOS_LED_HEARTBEAT 0
|
||||
#define PIOS_LED_ALARM 1
|
||||
|
||||
//------------------------
|
||||
// PIOS_SPI
|
||||
// See also pios_board.c
|
||||
//------------------------
|
||||
#define PIOS_SPI_MAX_DEVS 2
|
||||
|
||||
//------------------------
|
||||
// PIOS_I2C
|
||||
// See also pios_board.c
|
||||
//------------------------
|
||||
#define PIOS_I2C_MAX_DEVS 1
|
||||
extern uint32_t pios_i2c_main_adapter_id;
|
||||
#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_main_adapter_id)
|
||||
#define PIOS_I2C_ESC_ADAPTER (pios_i2c_main_adapter_id)
|
||||
#define PIOS_I2C_BMP085_ADAPTER (pios_i2c_main_adapter_id)
|
||||
|
||||
//------------------------
|
||||
// PIOS_BMP085
|
||||
//------------------------
|
||||
#define PIOS_BMP085_HAS_GPIOS
|
||||
#define PIOS_BMP085_EOC_GPIO_PORT GPIOC
|
||||
#define PIOS_BMP085_EOC_GPIO_PIN GPIO_Pin_15
|
||||
#define PIOS_BMP085_EOC_PORT_SOURCE GPIO_PortSourceGPIOC
|
||||
#define PIOS_BMP085_EOC_PIN_SOURCE GPIO_PinSource15
|
||||
#define PIOS_BMP085_EOC_CLK RCC_APB2Periph_GPIOC
|
||||
#define PIOS_BMP085_EOC_EXTI_LINE EXTI_Line15
|
||||
#define PIOS_BMP085_EOC_IRQn EXTI15_10_IRQn
|
||||
#define PIOS_BMP085_EOC_PRIO PIOS_IRQ_PRIO_LOW
|
||||
#define PIOS_BMP085_XCLR_GPIO_PORT GPIOC // Not actually connected on OP mainboard
|
||||
#define PIOS_BMP085_XCLR_GPIO_PIN GPIO_Pin_14 // Not actually connected on OP mainboard
|
||||
//#define PIOS_BMP085_OVERSAMPLING 2
|
||||
#define PIOS_BMP085_OVERSAMPLING 3
|
||||
|
||||
//-------------------------
|
||||
// PIOS_USART
|
||||
//
|
||||
// See also pios_board.c
|
||||
//-------------------------
|
||||
#define PIOS_USART_MAX_DEVS 3
|
||||
|
||||
//-------------------------
|
||||
// PIOS_COM
|
||||
//
|
||||
// See also pios_board.c
|
||||
//-------------------------
|
||||
#define PIOS_COM_MAX_DEVS 4
|
||||
|
||||
extern uint32_t pios_com_telem_rf_id;
|
||||
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
|
||||
|
||||
extern uint32_t pios_com_gps_id;
|
||||
#define PIOS_COM_GPS (pios_com_gps_id)
|
||||
|
||||
extern uint32_t pios_com_telem_usb_id;
|
||||
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
|
||||
|
||||
#ifdef PIOS_ENABLE_AUX_UART
|
||||
extern uint32_t pios_com_aux_id;
|
||||
#define PIOS_COM_AUX (pios_com_aux_id)
|
||||
#define PIOS_COM_DEBUG PIOS_COM_AUX
|
||||
#endif
|
||||
|
||||
//-------------------------
|
||||
// System Settings
|
||||
//-------------------------
|
||||
#define PIOS_MASTER_CLOCK 72000000
|
||||
#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2)
|
||||
|
||||
//-------------------------
|
||||
// Interrupt Priorities
|
||||
//-------------------------
|
||||
#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
|
||||
#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
|
||||
#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
|
||||
#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
|
||||
|
||||
//------------------------
|
||||
// PIOS_RCVR
|
||||
// See also pios_board.c
|
||||
//------------------------
|
||||
#define PIOS_RCVR_MAX_DEVS 1
|
||||
#define PIOS_RCVR_MAX_CHANNELS 12
|
||||
|
||||
//-------------------------
|
||||
// Receiver PPM input
|
||||
//-------------------------
|
||||
#define PIOS_PPM_MAX_DEVS 1
|
||||
#define PIOS_PPM_NUM_INPUTS 12
|
||||
|
||||
//-------------------------
|
||||
// Receiver PWM input
|
||||
//-------------------------
|
||||
#define PIOS_PWM_MAX_DEVS 1
|
||||
#define PIOS_PWM_NUM_INPUTS 8
|
||||
|
||||
//-------------------------
|
||||
// Receiver DSM input
|
||||
//-------------------------
|
||||
#define PIOS_DSM_MAX_DEVS 1
|
||||
#define PIOS_DSM_NUM_INPUTS 12
|
||||
|
||||
//-------------------------
|
||||
// Receiver S.Bus input
|
||||
//-------------------------
|
||||
#define PIOS_SBUS_MAX_DEVS 0
|
||||
#define PIOS_SBUS_NUM_INPUTS (16+2)
|
||||
|
||||
//-------------------------
|
||||
// Servo outputs
|
||||
//-------------------------
|
||||
#define PIOS_SERVO_UPDATE_HZ 50
|
||||
#define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
|
||||
|
||||
//--------------------------
|
||||
// Timer controller settings
|
||||
//--------------------------
|
||||
#define PIOS_TIM_MAX_DEVS 3
|
||||
|
||||
//-------------------------
|
||||
// ADC
|
||||
// PIOS_ADC_PinGet(0) = Temperature Sensor (On-board)
|
||||
// PIOS_ADC_PinGet(1) = Power Sensor (Current)
|
||||
// PIOS_ADC_PinGet(2) = Power Sensor (Voltage)
|
||||
// PIOS_ADC_PinGet(3) = On-board 5v Rail Sensor
|
||||
// PIOS_ADC_PinGet(4) = Auxiliary Input 1
|
||||
// PIOS_ADC_PinGet(5) = Auxiliary Input 2
|
||||
// PIOS_ADC_PinGet(6) = Auxiliary Input 3
|
||||
//-------------------------
|
||||
//#define PIOS_ADC_OVERSAMPLING_RATE 1
|
||||
#define PIOS_ADC_USE_TEMP_SENSOR 1
|
||||
#define PIOS_ADC_TEMP_SENSOR_ADC ADC1
|
||||
#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1
|
||||
#define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA1 (Power Sense - Voltage)
|
||||
#define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_1 // ADC123_IN1
|
||||
#define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_1
|
||||
#define PIOS_ADC_PIN1_ADC ADC1
|
||||
#define PIOS_ADC_PIN1_ADC_NUMBER 2
|
||||
#define PIOS_ADC_PIN2_GPIO_PORT GPIOC // PC3 (Power Sense - Current)
|
||||
#define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_3 // ADC123_IN13
|
||||
#define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_13
|
||||
#define PIOS_ADC_PIN2_ADC ADC2
|
||||
#define PIOS_ADC_PIN2_ADC_NUMBER 1
|
||||
#define PIOS_ADC_PIN3_GPIO_PORT GPIOC // PC5 (Onboard 5v Sensor) PC5
|
||||
#define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_5 // ADC12_IN15
|
||||
#define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_15
|
||||
#define PIOS_ADC_PIN3_ADC ADC2
|
||||
#define PIOS_ADC_PIN3_ADC_NUMBER 2
|
||||
#define PIOS_ADC_PIN4_GPIO_PORT GPIOC // PC0 (AUX 1)
|
||||
#define PIOS_ADC_PIN4_GPIO_PIN GPIO_Pin_0 // ADC123_IN10
|
||||
#define PIOS_ADC_PIN4_GPIO_CHANNEL ADC_Channel_10
|
||||
#define PIOS_ADC_PIN4_ADC ADC1
|
||||
#define PIOS_ADC_PIN4_ADC_NUMBER 3
|
||||
#define PIOS_ADC_PIN5_GPIO_PORT GPIOC // PC1 (AUX 2)
|
||||
#define PIOS_ADC_PIN5_GPIO_PIN GPIO_Pin_1 // ADC123_IN11
|
||||
#define PIOS_ADC_PIN5_GPIO_CHANNEL ADC_Channel_11
|
||||
#define PIOS_ADC_PIN5_ADC ADC2
|
||||
#define PIOS_ADC_PIN5_ADC_NUMBER 3
|
||||
#define PIOS_ADC_PIN6_GPIO_PORT GPIOC // PC2 (AUX 3)
|
||||
#define PIOS_ADC_PIN6_GPIO_PIN GPIO_Pin_2 // ADC123_IN12
|
||||
#define PIOS_ADC_PIN6_GPIO_CHANNEL ADC_Channel_12
|
||||
#define PIOS_ADC_PIN6_ADC ADC1
|
||||
#define PIOS_ADC_PIN6_ADC_NUMBER 4
|
||||
#define PIOS_ADC_NUM_PINS 6
|
||||
#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT, PIOS_ADC_PIN4_GPIO_PORT, PIOS_ADC_PIN5_GPIO_PORT, PIOS_ADC_PIN6_GPIO_PORT }
|
||||
#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN, PIOS_ADC_PIN4_GPIO_PIN, PIOS_ADC_PIN5_GPIO_PIN, PIOS_ADC_PIN6_GPIO_PIN }
|
||||
#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL, PIOS_ADC_PIN4_GPIO_CHANNEL, PIOS_ADC_PIN5_GPIO_CHANNEL, PIOS_ADC_PIN6_GPIO_CHANNEL }
|
||||
#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC, PIOS_ADC_PIN4_ADC, PIOS_ADC_PIN5_ADC, PIOS_ADC_PIN6_ADC }
|
||||
#define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER, PIOS_ADC_PIN4_ADC_NUMBER, PIOS_ADC_PIN5_ADC_NUMBER, PIOS_ADC_PIN6_ADC_NUMBER }
|
||||
#define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR)
|
||||
#define PIOS_ADC_NUM_ADC_CHANNELS 2
|
||||
#define PIOS_ADC_USE_ADC2 1
|
||||
#define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE)
|
||||
#define PIOS_ADC_ADCCLK RCC_PCLK2_Div8
|
||||
/* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */
|
||||
/* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */
|
||||
/* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */
|
||||
/* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */
|
||||
#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5
|
||||
/* Sample time: */
|
||||
/* With an ADCCLK = 14 MHz and a sampling time of 293.5 cycles: */
|
||||
/* Tconv = 239.5 + 12.5 = 252 cycles = 18?s */
|
||||
/* (1 / (ADCCLK / CYCLES)) = Sample Time (?S) */
|
||||
#define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW
|
||||
#define PIOS_ADC_MAX_OVERSAMPLING 10
|
||||
#define PIOS_ADC_RATE (72.0e6 / 1 / 8 / 252 / (PIOS_ADC_NUM_ADC_CHANNELS >> PIOS_ADC_USE_ADC2))
|
||||
|
||||
//-------------------------
|
||||
// GPIO
|
||||
//-------------------------
|
||||
#define PIOS_GPIO_1_PORT GPIOC
|
||||
#define PIOS_GPIO_1_PIN GPIO_Pin_0
|
||||
#define PIOS_GPIO_1_GPIO_CLK RCC_APB2Periph_GPIOC
|
||||
#define PIOS_GPIO_2_PORT GPIOC
|
||||
#define PIOS_GPIO_2_PIN GPIO_Pin_1
|
||||
#define PIOS_GPIO_2_GPIO_CLK RCC_APB2Periph_GPIOC
|
||||
#define PIOS_GPIO_3_PORT GPIOC
|
||||
#define PIOS_GPIO_3_PIN GPIO_Pin_2
|
||||
#define PIOS_GPIO_3_GPIO_CLK RCC_APB2Periph_GPIOC
|
||||
#define PIOS_GPIO_4_PORT GPIOD
|
||||
#define PIOS_GPIO_4_PIN GPIO_Pin_2
|
||||
#define PIOS_GPIO_4_GPIO_CLK RCC_APB2Periph_GPIOD
|
||||
#define PIOS_GPIO_PORTS { PIOS_GPIO_1_PORT, PIOS_GPIO_2_PORT, PIOS_GPIO_3_PORT, PIOS_GPIO_4_PORT }
|
||||
#define PIOS_GPIO_PINS { PIOS_GPIO_1_PIN, PIOS_GPIO_2_PIN, PIOS_GPIO_3_PIN, PIOS_GPIO_4_PIN }
|
||||
#define PIOS_GPIO_CLKS { PIOS_GPIO_1_GPIO_CLK, PIOS_GPIO_2_GPIO_CLK, PIOS_GPIO_3_GPIO_CLK, PIOS_GPIO_4_GPIO_CLK }
|
||||
#define PIOS_GPIO_NUM 4
|
||||
|
||||
//-------------------------
|
||||
// USB
|
||||
//-------------------------
|
||||
#define PIOS_USB_ENABLED 1
|
||||
#define PIOS_USB_DETECT_GPIO_PORT GPIOC
|
||||
#define PIOS_USB_MAX_DEVS 1
|
||||
#define PIOS_USB_HID_MAX_DEVS 1
|
||||
#define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_4
|
||||
|
||||
/**
|
||||
* glue macros for file IO
|
||||
* STM32 uses DOSFS for file IO
|
||||
*/
|
||||
#define PIOS_FOPEN_READ(filename,file) DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_READ, PIOS_SDCARD_Sector, &file) != DFS_OK
|
||||
|
||||
#define PIOS_FOPEN_WRITE(filename,file) DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_WRITE, PIOS_SDCARD_Sector, &file) != DFS_OK
|
||||
|
||||
#define PIOS_FREAD(file,bufferadr,length,resultadr) DFS_ReadFile(file, PIOS_SDCARD_Sector, (uint8_t*)bufferadr, resultadr, length) != DFS_OK
|
||||
|
||||
#define PIOS_FWRITE(file,bufferadr,length,resultadr) DFS_WriteFile(file, PIOS_SDCARD_Sector, (uint8_t*)bufferadr, resultadr, length)
|
||||
|
||||
#define PIOS_FCLOSE(file) DFS_Close(&file)
|
||||
|
||||
#define PIOS_FUNLINK(filename) DFS_UnlinkFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, PIOS_SDCARD_Sector)
|
||||
|
||||
|
||||
|
||||
#endif /* STM3210E_OP_H_ */
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -1,24 +0,0 @@
|
||||
#ifndef PIOS_BOARD_H_
|
||||
#define PIOS_BOARD_H_
|
||||
|
||||
#ifdef USE_STM3210E_OP
|
||||
#include "STM3210E_OP.h"
|
||||
#elif USE_STM32103CB_PIPXTREME
|
||||
#include "STM32103CB_PIPXTREME_Rev1.h"
|
||||
#elif USE_STM32103CB_CC_Rev1
|
||||
#include "STM32103CB_CC_Rev1.h"
|
||||
#elif USE_STM32F2xx_INS
|
||||
#include "STM32F2xx_INS.h"
|
||||
#elif USE_STM32F4xx_OP
|
||||
#include "STM32F4xx_Revolution.h"
|
||||
#elif USE_STM32F4xx_OSD
|
||||
#include "STM32F4xx_OSD.h"
|
||||
#elif USE_STM32F4xx_RM
|
||||
#include "STM32F4xx_RevoMini.h"
|
||||
#elif USE_SIM_POSIX
|
||||
#include "sim_posix.h"
|
||||
#else
|
||||
#error Board definition has not been provided.
|
||||
#endif
|
||||
|
||||
#endif /* PIOS_BOARD_H_ */
|
0
flight/PiOS/Common/Libraries/.no-auto-format
Normal file
@ -1,54 +1,75 @@
|
||||
/*
|
||||
FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* If you are: *
|
||||
* *
|
||||
* + New to FreeRTOS, *
|
||||
* + Wanting to learn FreeRTOS or multitasking in general quickly *
|
||||
* + Looking for basic training, *
|
||||
* + Wanting to improve your FreeRTOS skills and productivity *
|
||||
* *
|
||||
* then take a look at the FreeRTOS eBook *
|
||||
* *
|
||||
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* A pdf reference manual is also available. Both are usually delivered *
|
||||
* to your inbox within 20 minutes to two hours when purchased between 8am *
|
||||
* and 8pm GMT (although please allow up to 24 hours in case of *
|
||||
* exceptional circumstances). Thank you for your support! *
|
||||
* *
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
***NOTE*** The exception to the GPL is included to allow you to distribute
|
||||
a combined work that includes FreeRTOS without being obliged to provide the
|
||||
source code for proprietary components outside of the FreeRTOS kernel.
|
||||
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel.
|
||||
|
||||
FreeRTOS 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
|
||||
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||
on the FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||
fully thread aware and reentrant UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems, who sell the code with commercial support,
|
||||
indemnification and middleware, under the OpenRTOS brand.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
*/
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
@ -70,7 +91,7 @@ static xList xDelayedCoRoutineList1; /*< Delayed co-routines. */
|
||||
static xList xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
||||
static xList * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */
|
||||
static xList * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
||||
static xList xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
|
||||
static xList xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
|
||||
|
||||
/* Other file private variables. --------------------------------*/
|
||||
corCRCB * pxCurrentCoRoutine = NULL;
|
||||
@ -94,7 +115,7 @@ static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks =
|
||||
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
|
||||
} \
|
||||
vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility to ready all the lists used by the scheduler. This is called
|
||||
@ -160,10 +181,10 @@ corCRCB *pxCoRoutine;
|
||||
in a list. */
|
||||
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
|
||||
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
|
||||
|
||||
|
||||
/* Event lists are always in priority order. */
|
||||
listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );
|
||||
|
||||
|
||||
/* Now the co-routine has been initialised it can be added to the ready
|
||||
list at the correct priority. */
|
||||
prvAddCoRoutineToReadyQueue( pxCoRoutine );
|
||||
@ -171,11 +192,11 @@ corCRCB *pxCoRoutine;
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@ -190,7 +211,7 @@ portTickType xTimeToWake;
|
||||
/* We must remove ourselves from the ready list before adding
|
||||
ourselves to the blocked list as the same list item is used for
|
||||
both lists. */
|
||||
vListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
uxListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
|
||||
/* The list item will be inserted in wake time order. */
|
||||
listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
|
||||
@ -222,20 +243,20 @@ static void prvCheckPendingReadyList( void )
|
||||
/* Are there any co-routines waiting to get moved to the ready list? These
|
||||
are co-routines that have been readied by an ISR. The ISR cannot access
|
||||
the ready lists itself. */
|
||||
while( !listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) )
|
||||
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
corCRCB *pxUnblockedCRCB;
|
||||
|
||||
/* The pending ready list can be accessed by an ISR. */
|
||||
portDISABLE_INTERRUPTS();
|
||||
{
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
|
||||
vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
{
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
|
||||
uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
}
|
||||
portENABLE_INTERRUPTS();
|
||||
|
||||
vListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
|
||||
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
|
||||
uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
|
||||
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
@ -263,13 +284,15 @@ corCRCB *pxCRCB;
|
||||
}
|
||||
|
||||
/* See if this tick has made a timeout expire. */
|
||||
while( ( pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ) ) != NULL )
|
||||
{
|
||||
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
|
||||
{
|
||||
/* Timeout not yet expired. */
|
||||
break;
|
||||
}
|
||||
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
|
||||
|
||||
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
|
||||
{
|
||||
/* Timeout not yet expired. */
|
||||
break;
|
||||
}
|
||||
|
||||
portDISABLE_INTERRUPTS();
|
||||
{
|
||||
@ -278,18 +301,18 @@ corCRCB *pxCRCB;
|
||||
have been moved to the pending ready list and the following
|
||||
line is still valid. Also the pvContainer parameter will have
|
||||
been set to NULL so the following lines are also valid. */
|
||||
vListRemove( &( pxCRCB->xGenericListItem ) );
|
||||
uxListRemove( &( pxCRCB->xGenericListItem ) );
|
||||
|
||||
/* Is the co-routine waiting on an event also? */
|
||||
if( pxCRCB->xEventListItem.pvContainer )
|
||||
{
|
||||
vListRemove( &( pxCRCB->xEventListItem ) );
|
||||
/* Is the co-routine waiting on an event also? */
|
||||
if( pxCRCB->xEventListItem.pvContainer )
|
||||
{
|
||||
uxListRemove( &( pxCRCB->xEventListItem ) );
|
||||
}
|
||||
}
|
||||
portENABLE_INTERRUPTS();
|
||||
|
||||
prvAddCoRoutineToReadyQueue( pxCRCB );
|
||||
}
|
||||
prvAddCoRoutineToReadyQueue( pxCRCB );
|
||||
}
|
||||
}
|
||||
|
||||
xLastTickCount = xCoRoutineTickCount;
|
||||
@ -352,9 +375,10 @@ corCRCB *pxUnblockedCRCB;
|
||||
signed portBASE_TYPE xReturn;
|
||||
|
||||
/* This function is called from within an interrupt. It can only access
|
||||
event lists and the pending ready list. */
|
||||
event lists and the pending ready list. This function assumes that a
|
||||
check has already been made to ensure pxEventList is not empty. */
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||
vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
|
||||
|
||||
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )
|
109
flight/PiOS/Common/Libraries/FreeRTOS/Source/include/FreeRTOS.h
Executable file → Normal file
@ -1,6 +1,8 @@
|
||||
/*
|
||||
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
@ -27,41 +29,47 @@
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
|
||||
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
kernel.
|
||||
|
||||
FreeRTOS 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
|
||||
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||
on the FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong? *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||
fully thread aware and reentrant UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems, who sell the code with commercial support,
|
||||
indemnification and middleware, under the OpenRTOS brand.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
*/
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
@ -79,6 +87,12 @@
|
||||
/* Application specific configuration options. */
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
/* configUSE_PORT_OPTIMISED_TASK_SELECTION must be defined before portable.h
|
||||
is included as it is used by the port layer. */
|
||||
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#endif
|
||||
|
||||
/* Definitions specific to the port being used. */
|
||||
#include "portable.h"
|
||||
|
||||
@ -121,11 +135,11 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
#error Missing definition: INCLUDE_uxTaskPriorityGet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelete
|
||||
#ifndef INCLUDE_vTaskDelete
|
||||
#error Missing definition: INCLUDE_vTaskDelete should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskSuspend
|
||||
#ifndef INCLUDE_vTaskSuspend
|
||||
#error Missing definition: INCLUDE_vTaskSuspend should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
@ -153,6 +167,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
#define INCLUDE_xQueueGetMutexHolder 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xSemaphoreGetMutexHolder
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_pcTaskGetTaskName
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#endif
|
||||
@ -165,6 +183,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_eTaskGetState
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#endif
|
||||
@ -304,7 +326,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
|
||||
#ifndef traceTASK_PRIORITY_DISINHERIT
|
||||
/* Called when a task releases a mutex, the holding of which had resulted in
|
||||
the task inheriting the priority of a higher priority task.
|
||||
the task inheriting the priority of a higher priority task.
|
||||
pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
|
||||
mutex. uxOriginalPriority is the task's configured (base) priority. */
|
||||
#define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
|
||||
@ -336,7 +358,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#endif
|
||||
|
||||
#ifndef traceQUEUE_CREATE
|
||||
#ifndef traceQUEUE_CREATE
|
||||
#define traceQUEUE_CREATE( pxNewQueue )
|
||||
#endif
|
||||
|
||||
@ -518,5 +540,36 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
#define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
|
||||
#endif
|
||||
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
||||
#endif
|
||||
|
||||
#ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
|
||||
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||
#endif
|
||||
|
||||
#if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
|
||||
#error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_TICKLESS_IDLE
|
||||
#define configUSE_TICKLESS_IDLE 0
|
||||
#endif
|
||||
|
||||
#ifndef configPRE_SLEEP_PROCESSING
|
||||
#define configPRE_SLEEP_PROCESSING( x )
|
||||
#endif
|
||||
|
||||
#ifndef configPOST_SLEEP_PROCESSING
|
||||
#define configPOST_SLEEP_PROCESSING( x )
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_QUEUE_SETS
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#endif
|
||||
|
||||
/* For backward compatability. */
|
||||
#define eTaskStateGet eTaskGetState
|
||||
|
||||
#endif /* INC_FREERTOS_H */
|
||||
|
||||
|
54
flight/PiOS/Common/Libraries/FreeRTOS/Source/include/StackMacros.h
Executable file → Normal file
@ -1,6 +1,8 @@
|
||||
/*
|
||||
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
@ -27,41 +29,47 @@
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
|
||||
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
kernel.
|
||||
|
||||
FreeRTOS 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
|
||||
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||
on the FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong? *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||
fully thread aware and reentrant UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems, who sell the code with commercial support,
|
||||
indemnification and middleware, under the OpenRTOS brand.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
*/
|
||||
|
||||
#ifndef STACK_MACROS_H
|
||||
|
54
flight/PiOS/Common/Libraries/FreeRTOS/Source/include/croutine.h
Executable file → Normal file
@ -1,6 +1,8 @@
|
||||
/*
|
||||
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
@ -27,41 +29,47 @@
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
|
||||
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
kernel.
|
||||
|
||||
FreeRTOS 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
|
||||
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||
on the FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong? *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||
fully thread aware and reentrant UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems, who sell the code with commercial support,
|
||||
indemnification and middleware, under the OpenRTOS brand.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
*/
|
||||
|
||||
#ifndef CO_ROUTINE_H
|
||||
|