Merge branch 'rel-15.09'
43
.gitignore
vendored
@ -4,6 +4,10 @@
|
||||
/build
|
||||
/3rdparty
|
||||
|
||||
# Ignore user config
|
||||
config
|
||||
|
||||
|
||||
# Exclude temporary and system files
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
@ -12,7 +16,7 @@ GRTAGS
|
||||
GSYMS
|
||||
GTAGS
|
||||
core
|
||||
*~
|
||||
*~
|
||||
|
||||
# flight
|
||||
/flight/*.pnproj
|
||||
@ -25,29 +29,24 @@ core
|
||||
/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser
|
||||
|
||||
# ground
|
||||
openpilotgcs-build-desktop
|
||||
ground/openpilotgcs/.cproject
|
||||
ground/openpilotgcs/.project
|
||||
ground/openpilotgcs/.settings
|
||||
gcs-build-desktop
|
||||
ground/gcs/.cproject
|
||||
ground/gcs/.project
|
||||
ground/gcs/.settings
|
||||
|
||||
# Ignore some of the .pro.user files
|
||||
# Ignore .pro.user files
|
||||
*.pro.user
|
||||
/ground/openpilotgcs/openpilotgcs.pro.user
|
||||
/ground/uavobjgenerator/uavobjgenerator.pro.user
|
||||
/ground/uavobjects/uavobjects.pro.user
|
||||
/ground/ground.pro.user
|
||||
/ground/openpilotgcs/src/libs/sdlgamepad.pro.user
|
||||
|
||||
|
||||
# Misc artifacts
|
||||
/ground/openpilotgcs/share/openpilotgcs/sounds/normalize.exe
|
||||
/ground/openpilotgcs/share/openpilotgcs/sounds/default/normalize.exe
|
||||
/ground/openpilotgcs/share/openpilotgcs/translations/extract-mimetypes.xq
|
||||
/ground/openpilotgcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h
|
||||
/ground/openpilotgcs/src/libs/qextserialport/.hg
|
||||
/ground/openpilotgcs/src/libs/qextserialport/.hgtags
|
||||
/ground/openpilotgcs/src/libs/qwt/qwt.prf
|
||||
/ground/openpilotgcs/src/libs/qwt/designer
|
||||
/ground/openpilotgcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h
|
||||
*.exe
|
||||
/ground/gcs/share/translations/extract-mimetypes.xq
|
||||
/ground/gcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h
|
||||
/ground/gcs/src/libs/qextserialport/.hg
|
||||
/ground/gcs/src/libs/qextserialport/.hgtags
|
||||
/ground/gcs/src/libs/qwt/qwt.prf
|
||||
/ground/gcs/src/libs/qwt/designer
|
||||
/ground/gcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h
|
||||
|
||||
# Ignore intermediate files generated by command-line android builds
|
||||
# Couldn't figure out how to force these files into the ./build directory
|
||||
@ -65,6 +64,7 @@ ground/openpilotgcs/.settings
|
||||
/.metadata
|
||||
/.settings
|
||||
/.pydevproject
|
||||
/workspace
|
||||
|
||||
# Ignore Eclipse temp folder, git plugin based?
|
||||
RemoteSystemsTempFiles
|
||||
@ -73,3 +73,6 @@ RemoteSystemsTempFiles
|
||||
*.rej
|
||||
*.orig
|
||||
*.diff~
|
||||
|
||||
# ignore ccache storage
|
||||
.ccache
|
||||
|
40
CONTRIBUTING.md
Normal file
@ -0,0 +1,40 @@
|
||||
How to build from source?
|
||||
=========================
|
||||
|
||||
Both development environment and GCS are supported on Windows, Linux and Mac OS X
|
||||
|
||||
The first step is to Install all OS specific prerequisites.
|
||||
###Mac OS X
|
||||
Install XCode and its relatated command line tools (follow Apple documentation).
|
||||
Install git, curl and p7zip. You can use brew `brew install git curl p7zip` or macport: `sudo port install git curl p7zip`
|
||||
###Ubuntu
|
||||
|
||||
sudo apt-get install git build-essential curl gdb wget debhelper p7zip-full unzip flex bison libsdl1.2-dev libudev-dev libusb-1.0-0-dev libc6-i386 mesa-common-dev
|
||||
|
||||
|
||||
###Windows
|
||||
Install [msysGIT](https://msysgit.github.io/) under `C:\git`
|
||||
|
||||
Clone LibrePilot Git repository.
|
||||
Open Git Bash and run
|
||||
|
||||
cd /path/to/LibrePilot_root
|
||||
./make/scripts/win_sdk_install.sh
|
||||
|
||||
You can build using the `/path/to/LibrePilot_root/make/winx86/bin/make` wrapper to call `mingw32-make.exe` as:
|
||||
|
||||
./make/winx86/bin/make all_sdk_install
|
||||
or call `mingw32-make` directly
|
||||
|
||||
mingw32-make all_sdk_install
|
||||
|
||||
##Setup the build environment and build
|
||||
The `all_sdk_install` target will automatically retrieve and install all needed tools (qt, arm gcc etc.) in a local folder `/path/to/LibrePilot_root/tools`
|
||||
|
||||
|
||||
make all_sdk_install
|
||||
make package
|
||||
|
||||
The `package` target will build the complete installable package for the current platform.
|
||||
|
||||
Run make with no arguments to show the complete list of supported targets.
|
11
CREDITS.txt
@ -1,4 +1,4 @@
|
||||
Connor Abbott
|
||||
Connor Abbott
|
||||
Sergiy Anikeyev
|
||||
David Ankers
|
||||
Fredrik Arvidsson
|
||||
@ -6,13 +6,14 @@ Pedro Assuncao
|
||||
Werner Backes
|
||||
Jose Barros
|
||||
Alex Beck
|
||||
Roy Bekken
|
||||
Andre Bernet
|
||||
Mikael Blomqvist
|
||||
Pete Boehl
|
||||
Berkely Brown
|
||||
Joel Brueziere
|
||||
Thierry Bugeat
|
||||
Samuel Brugger
|
||||
Thierry Bugeat
|
||||
Glenn Campigli
|
||||
David Carlson
|
||||
Mike Carr
|
||||
@ -47,6 +48,7 @@ Andy Honecker
|
||||
Patrick Huebner
|
||||
Ryan Hunt
|
||||
Mark James
|
||||
Paul Jewell
|
||||
Michael Johnston
|
||||
Stefan Karlsson
|
||||
Ricky King
|
||||
@ -61,12 +63,13 @@ Edouard Lafargue
|
||||
Laurent Lalanne
|
||||
Fredrik Larsson
|
||||
Xavier Lecluse
|
||||
Richard Von Lehe
|
||||
Pablo Lema
|
||||
Matt Lipski
|
||||
David Llama
|
||||
Jasper Van Loenen
|
||||
Ben Matthews
|
||||
Greg Matthews
|
||||
Greg Matthews
|
||||
Guy McCaldin
|
||||
Alessio Morale
|
||||
Gary Mortimer
|
||||
@ -107,11 +110,9 @@ Rowan Taubitz
|
||||
Jim Allen Thibodaux
|
||||
Andrew Thoms
|
||||
Vladimir Timofeev
|
||||
Jasper Van Loenen
|
||||
Philippe Vanhaesendonck
|
||||
Vassilis Varveropoulos
|
||||
Kevin Vertucio
|
||||
Richard Von Lehe
|
||||
Alex Vrubel
|
||||
Mike Walters
|
||||
Sam Wang
|
||||
|
60
LICENSE.txt
@ -1,64 +1,6 @@
|
||||
The OpenPilot code is licensed under the GPLv3. There are a few minor exceptions to this so please see
|
||||
The LibrePilot code is licensed under the GPLv3. There are a few minor exceptions to this so please see
|
||||
the headers of all source code for copyright and license information. The full text of the GPLv3 can be
|
||||
read here: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
Artwork is licensed under the Creative Commons BY-SA v3 license.
|
||||
|
||||
Documentation including translations is also licensed under the Creative Commons BY-SA v3 license.
|
||||
For details please see: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Licenses for the hardware files are included in the directories that contain the hardware, not all items
|
||||
are under the same license and you must check the files for each individual hardware design. Please note
|
||||
that some of the hardware files are licensed under the Creative Commons BY-NC-SA v3 license, this is a
|
||||
non-commercial license. OpenPilot is purely a non-profit hobby project with zero commercial intent. If you
|
||||
just want people to work for free or do your R&D for zero cost, please find a project that allows this as
|
||||
that not what OpenPilot is about. We are hobbyists and we want to share our work with fellow hobbyists,
|
||||
additionally we need to ensure the future of the project and make sure it is sustainable.
|
||||
|
||||
If you wish to sell/distribute OpenPilot hardware or derivatives of OpenPilot hardware that are under a
|
||||
non-commercial license, please get in touch with one of the members of OpenPilot Foundation's
|
||||
administration committee. We can then negotiate a license waiver where a portion of the profits are donated
|
||||
to the OpenPilot Project to ensure its survival and future progression. Please note that this is in
|
||||
reference to PCB and Schematic designs. For people wishing to combine OpenPilot in to a Ready to Fly
|
||||
solution, this is perfectly fine as long as OpenPilot PCBs are bought from the OpenPilot project or one
|
||||
of the approved distributors.
|
||||
|
||||
For details the non-commercial license please see: http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||
A quick summary of what this license talk means, firstly using any work that is licensed under a form of
|
||||
the Creative Commons BY license, requires that credit is to be given. The SA or Share Alike part of the
|
||||
license means that you must also use the same license in any work derived from the work under this license.
|
||||
|
||||
Hardware
|
||||
The items under the non-commercial license means exactly that: they are for non-commercial use only and
|
||||
any derivatives that are made are also covered by the same non-commercial license. The hardware files
|
||||
under a non-commercial license are for reference and for fellow hobbyists; they are not to be used to
|
||||
generate profit of any kind. Please note that even the OpenPilot project its self is a non-profit project.
|
||||
|
||||
For all items both non-commercial and items that allows commercial use, the OP logo must be placed on any
|
||||
work or derivative work and be clearly visible. If any web addresses are present on the hardware, these
|
||||
are also required to remain on any replications or any derivative work.
|
||||
|
||||
Documentation
|
||||
In documentation, authors names must be kept along with any logos. If documentation is for a physical
|
||||
product such as a schematic, the OpenPilot logo should be shown and any web addresses also displayed on
|
||||
the final physical hardware it was derived from.
|
||||
|
||||
Artwork
|
||||
If artwork is to be reused, the OpenPilot project should be credited. If for example this is a software
|
||||
application, credit should be given on the application splash screen or in a separate part of the
|
||||
application that is visible to users. For example the Help/About screen.
|
||||
|
||||
Contact Us
|
||||
If you are unsure, please contact one of the OpenPilot Foundation's administrators. Additionally, if you
|
||||
plan to use parts of the OpenPilot project in your own work, we would appreciate it if you get in touch
|
||||
with us anyway, it is possible we could combine efforts or have some work already in progress that might
|
||||
be helpful. This of course is our baby and we want to see what great things people do with it as well.
|
||||
|
||||
A final note, OpenPilot is a non-profit for fun project and we have only volunteers. A great deal of time,
|
||||
money and effort has been donated to this project; please respect the people that are part of it and their
|
||||
generosity. OpenPilot is funded entirely by the generous people who donate money and time to the community
|
||||
and help it grow. Giving full and proper credit is not only a legal requirement of the CC-BY-SA license,
|
||||
it is also the right thing to do.
|
||||
|
||||
Buying hardware from the OpenPilot project is very important to the survival and continuing progress of
|
||||
the project, a project like OpenPilot is extremely expensive to produce.
|
||||
|
511
Makefile
@ -1,5 +1,6 @@
|
||||
#
|
||||
# Top level Makefile for the OpenPilot project build system.
|
||||
# Top level Makefile for the LibrePilot Project build system.
|
||||
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
|
||||
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
|
||||
# Use 'make help' for instructions.
|
||||
#
|
||||
@ -23,33 +24,63 @@
|
||||
# Lower level makefiles assume that these variables are defined. To ensure
|
||||
# that a special magic variable is exported here. It must be checked for
|
||||
# existance by each sub-make.
|
||||
export OPENPILOT_IS_COOL := Fuck Yeah!
|
||||
export TOP_LEVEL_MAKEFILE := TRUE
|
||||
|
||||
# It is possible to set OPENPILOT_DL_DIR and/or OPENPILOT_TOOLS_DIR environment
|
||||
# The root directory that this makefile resides in
|
||||
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
# Include some helper functions
|
||||
include $(ROOT_DIR)/make/functions.mk
|
||||
|
||||
# This file can be used to override default options using the "override" keyword
|
||||
CONFIG_FILE := config
|
||||
-include $(CONFIG_FILE)
|
||||
|
||||
##############################
|
||||
# It is possible to set DL_DIR and/or TOOLS_DIR environment
|
||||
# variables to override local tools download and installation directorys. So the
|
||||
# same toolchains can be used for all working copies. Particularly useful for CI
|
||||
# server build agents, but also for local installations.
|
||||
#
|
||||
# If no OPENPILOT_* variables found, makefile internal DL_DIR and TOOLS_DIR paths
|
||||
# will be used. They still can be overriden by the make command line parameters:
|
||||
# make DL_DIR=/path/to/download/directory TOOLS_DIR=/path/to/tools/directory targets...
|
||||
|
||||
# Function for converting Windows style slashes into Unix style
|
||||
slashfix = $(subst \,/,$(1))
|
||||
|
||||
# Function for converting an absolute path to one relative
|
||||
# to the top of the source tree
|
||||
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
|
||||
override DL_DIR := $(if $(DL_DIR),$(call slashfix,$(DL_DIR)),$(ROOT_DIR)/downloads)
|
||||
override TOOLS_DIR := $(if $(TOOLS_DIR),$(call slashfix,$(TOOLS_DIR)),$(ROOT_DIR)/tools)
|
||||
export DL_DIR
|
||||
export TOOLS_DIR
|
||||
|
||||
# Set up some macros for common directories within the tree
|
||||
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
export DL_DIR := $(if $(OPENPILOT_DL_DIR),$(call slashfix,$(OPENPILOT_DL_DIR)),$(ROOT_DIR)/downloads)
|
||||
export TOOLS_DIR := $(if $(OPENPILOT_TOOLS_DIR),$(call slashfix,$(OPENPILOT_TOOLS_DIR)),$(ROOT_DIR)/tools)
|
||||
export BUILD_DIR := $(ROOT_DIR)/build
|
||||
export PACKAGE_DIR := $(ROOT_DIR)/build/package
|
||||
export DIST_DIR := $(ROOT_DIR)/build/dist
|
||||
export BUILD_DIR := $(CURDIR)/build
|
||||
export PACKAGE_DIR := $(BUILD_DIR)/package
|
||||
export DIST_DIR := $(BUILD_DIR)/dist
|
||||
export OPGCSSYNTHDIR := $(BUILD_DIR)/gcs-synthetics
|
||||
|
||||
DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) $(OPGCSSYNTHDIR)
|
||||
|
||||
# Naming for binaries and packaging etc,.
|
||||
export ORG_BIG_NAME := LibrePilot
|
||||
GCS_LABEL := GCS
|
||||
GCS_BIG_NAME := $(ORG_BIG_NAME) $(GCS_LABEL)
|
||||
# These should be lowercase with no spaces
|
||||
export ORG_SMALL_NAME := $(call smallify,$(ORG_BIG_NAME))
|
||||
GCS_SMALL_NAME := $(call smallify,$(GCS_BIG_NAME))
|
||||
|
||||
WEBSITE_URL := http://librepilot.org
|
||||
GIT_URL := https://bitbucket.org/librepilot/librepilot.git
|
||||
GITWEB_URL := https://bitbucket.org/librepilot/librepilot
|
||||
# Change this once the DNS is set to http://wiki.librepilot.org/
|
||||
WIKI_URL_ROOT := https://librepilot.atlassian.net/wiki/display/LPDOC/
|
||||
USAGETRACKER_URL := https://usagetracker.librepilot.org/
|
||||
|
||||
PACKAGING_EMAIL_ADDRESS := packaging@librepilot.org
|
||||
|
||||
define DESCRIPTION_SHORT :=
|
||||
A ground control station and firmware for UAV flight controllers
|
||||
endef
|
||||
|
||||
define DESCRIPTION_LONG :=
|
||||
The LibrePilot open source project was founded in July 2015.
|
||||
It focuses on research and development of software and hardware to be used in a variety of applications including vehicle control and stabilization, unmanned autonomous vehicles and robotics.
|
||||
One of the project’s primary goals is to provide an open and collaborative environment making it the ideal home for development of innovative ideas.
|
||||
endef
|
||||
|
||||
DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
|
||||
|
||||
# Set up default build configurations (debug | release)
|
||||
GCS_BUILD_CONF := release
|
||||
@ -81,7 +112,7 @@ $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),de
|
||||
|
||||
# Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
|
||||
ifeq ($(shell whoami 2>/dev/null),root)
|
||||
ifeq ($(filter install,$(MAKECMDGOALS)),)
|
||||
ifeq ($(filter install uninstall,$(MAKECMDGOALS)),)
|
||||
ifndef FAKEROOTKEY
|
||||
$(error You should not be running this as root)
|
||||
endif
|
||||
@ -116,16 +147,18 @@ include $(ROOT_DIR)/make/tools.mk
|
||||
|
||||
# We almost need to consider autoconf/automake instead of this
|
||||
ifeq ($(UNAME), Linux)
|
||||
QT_SPEC = linux-g++
|
||||
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
||||
QT_SPEC := linux-g++
|
||||
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
||||
else ifeq ($(UNAME), Darwin)
|
||||
QT_SPEC = macx-g++
|
||||
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
||||
QT_SPEC := macx-g++
|
||||
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
||||
else ifeq ($(UNAME), Windows)
|
||||
QT_SPEC = win32-g++
|
||||
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
|
||||
QT_SPEC := win32-g++
|
||||
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
|
||||
endif
|
||||
|
||||
export UAVOBJGENERATOR
|
||||
|
||||
##############################
|
||||
#
|
||||
# All targets
|
||||
@ -140,7 +173,7 @@ all_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
|
||||
$(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
|
||||
|
||||
.PONY: clean
|
||||
.PHONY: clean
|
||||
clean: all_clean
|
||||
|
||||
|
||||
@ -150,11 +183,13 @@ clean: all_clean
|
||||
#
|
||||
##############################
|
||||
|
||||
UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
|
||||
UAVOBJGENERATOR_DIR := $(BUILD_DIR)/uavobjgenerator
|
||||
DIRS += $(UAVOBJGENERATOR_DIR)
|
||||
|
||||
.PHONY: uavobjgenerator
|
||||
uavobjgenerator $(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
|
||||
uavobjgenerator: $(UAVOBJGENERATOR)
|
||||
|
||||
$(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
|
||||
$(V1) cd $(UAVOBJGENERATOR_DIR) && \
|
||||
( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
|
||||
-spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
|
||||
@ -168,13 +203,13 @@ uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
|
||||
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
|
||||
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
|
||||
|
||||
uavobjects_%: uavobjgenerator
|
||||
uavobjects_%: $(UAVOBJGENERATOR)
|
||||
@$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
|
||||
$(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
|
||||
$(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
|
||||
)
|
||||
|
||||
uavobjects_test: uavobjgenerator
|
||||
uavobjects_test: $(UAVOBJGENERATOR)
|
||||
$(V1) $(UAVOBJGENERATOR) -v $(UAVOBJ_XML_DIR) $(ROOT_DIR)
|
||||
|
||||
uavobjects_clean:
|
||||
@ -187,54 +222,6 @@ uavobjects_clean:
|
||||
#
|
||||
##############################
|
||||
|
||||
# Define some pointers to the various important pieces of the flight code
|
||||
# to prevent these being repeated in every sub makefile
|
||||
export PIOS := $(ROOT_DIR)/flight/pios
|
||||
export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
|
||||
export OPMODULEDIR := $(ROOT_DIR)/flight/modules
|
||||
export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
|
||||
export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
|
||||
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
||||
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
|
||||
|
||||
DIRS += $(OPGCSSYNTHDIR)
|
||||
|
||||
# Define supported board lists
|
||||
ALL_BOARDS := oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
|
||||
|
||||
# Short names of each board (used to display board name in parallel builds)
|
||||
oplinkmini_short := 'oplm'
|
||||
revolution_short := 'revo'
|
||||
osd_short := 'osd '
|
||||
revoproto_short := 'revp'
|
||||
revonano_short := 'revn'
|
||||
simposix_short := 'posx'
|
||||
discoveryf4bare_short := 'df4b'
|
||||
gpsplatinum_short := 'gps9'
|
||||
|
||||
# SimPosix only builds on Linux so drop it from the list for
|
||||
# all other platforms.
|
||||
ifneq ($(UNAME), Linux)
|
||||
ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
|
||||
endif
|
||||
|
||||
# Start out assuming that we'll build fw, bl and bu for all boards
|
||||
FW_BOARDS := $(ALL_BOARDS)
|
||||
BL_BOARDS := $(ALL_BOARDS)
|
||||
BU_BOARDS := $(ALL_BOARDS)
|
||||
EF_BOARDS := $(ALL_BOARDS)
|
||||
|
||||
# SimPosix doesn't have a BL, BU or EF target so we need to
|
||||
# filter them out to prevent errors on the all_flight target.
|
||||
BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
|
||||
BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
|
||||
EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
|
||||
|
||||
# Generate the targets for whatever boards are left in each list
|
||||
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
|
||||
BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
|
||||
BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
|
||||
EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
|
||||
|
||||
# When building any of the "all_*" targets, tell all sub makefiles to display
|
||||
# additional details on each line of output to describe which build and target
|
||||
@ -250,190 +237,10 @@ ifneq ($(word 2,$(MAKECMDGOALS)),)
|
||||
export ENABLE_MSG_EXTRA := yes
|
||||
endif
|
||||
|
||||
# TEMPLATES (used to generate build rules)
|
||||
FLIGHT_OUT_DIR := $(BUILD_DIR)/firmware
|
||||
DIRS += $(FLIGHT_OUT_DIR)
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define FW_TEMPLATE
|
||||
.PHONY: $(1) fw_$(1)
|
||||
$(1): fw_$(1)_opfw
|
||||
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/boards/$(1)/firmware && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=fw \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
||||
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
||||
TARGET=fw_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: $(1)_clean
|
||||
$(1)_clean: fw_$(1)_clean
|
||||
fw_$(1)_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define BL_TEMPLATE
|
||||
.PHONY: bl_$(1)
|
||||
bl_$(1): bl_$(1)_bin
|
||||
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/boards/$(1)/bootloader && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bl \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
||||
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
||||
TARGET=bl_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: unbrick_$(1)
|
||||
unbrick_$(1): bl_$(1)_hex
|
||||
$(if $(filter-out undefined,$(origin UNBRICK_TTY)),
|
||||
$(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
|
||||
$(V1) $(STM32FLASH_DIR)/stm32flash \
|
||||
-w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
|
||||
-g 0x0 \
|
||||
$$(UNBRICK_TTY)
|
||||
,
|
||||
$(V0) @$(ECHO)
|
||||
$(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
|
||||
$(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
|
||||
)
|
||||
|
||||
.PHONY: bl_$(1)_clean
|
||||
bl_$(1)_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
|
||||
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/common/bootloader_updater && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bu \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
||||
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
||||
TARGET=bu_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: bu_$(1)_clean
|
||||
bu_$(1)_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
|
||||
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/common/entire_flash && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=ef \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
||||
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
||||
TARGET=ef_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: ef_$(1)_clean
|
||||
ef_$(1)_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
define BOARD_PHONY_TEMPLATE
|
||||
.PHONY: all_$(1)
|
||||
all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
|
||||
all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
|
||||
all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
|
||||
all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
|
||||
|
||||
.PHONY: all_$(1)_clean
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
|
||||
endef
|
||||
|
||||
# Generate flight build rules
|
||||
.PHONY: all_fw all_fw_clean
|
||||
all_fw: $(addsuffix _opfw, $(FW_TARGETS))
|
||||
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
|
||||
|
||||
.PHONY: all_bl all_bl_clean
|
||||
all_bl: $(addsuffix _bin, $(BL_TARGETS))
|
||||
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
|
||||
|
||||
.PHONY: all_bu all_bu_clean
|
||||
all_bu: $(addsuffix _opfw, $(BU_TARGETS))
|
||||
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
|
||||
|
||||
.PHONY: all_ef all_ef_clean
|
||||
all_ef: $(EF_TARGETS)
|
||||
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
|
||||
|
||||
.PHONY: all_flight all_flight_clean
|
||||
all_flight: all_fw all_bl all_bu all_ef
|
||||
all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
|
||||
|
||||
# Expand the groups of targets for each board
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
|
||||
|
||||
# Expand the firmware rules
|
||||
$(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)_short))))
|
||||
|
||||
# Expand the bootloader updater rules
|
||||
$(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)_short))))
|
||||
|
||||
.PHONY: sim_win32
|
||||
sim_win32: sim_win32_exe
|
||||
|
||||
sim_win32_%: uavobjects_flight
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
|
||||
$(V1) $(MAKE) --no-print-directory \
|
||||
-C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
|
||||
|
||||
.PHONY: sim_osx
|
||||
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/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
|
||||
include $(ROOT_DIR)/flight/Makefile
|
||||
|
||||
##############################
|
||||
#
|
||||
@ -442,13 +249,7 @@ sim_osx_%: uavobjects_flight
|
||||
##############################
|
||||
|
||||
.PHONY: all_ground
|
||||
all_ground: openpilotgcs uploader
|
||||
|
||||
# Convenience target for the GCS
|
||||
.PHONY: gcs gcs_qmake gcs_clean
|
||||
gcs: openpilotgcs
|
||||
gcs_qmake: openpilotgcs_qmake
|
||||
gcs_clean: openpilotgcs_clean
|
||||
all_ground: gcs uploader
|
||||
|
||||
ifeq ($(V), 1)
|
||||
GCS_SILENT :=
|
||||
@ -456,25 +257,31 @@ else
|
||||
GCS_SILENT := silent
|
||||
endif
|
||||
|
||||
OPENPILOTGCS_DIR := $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
|
||||
DIRS += $(OPENPILOTGCS_DIR)
|
||||
GCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
|
||||
DIRS += $(GCS_DIR)
|
||||
|
||||
OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile
|
||||
GCS_MAKEFILE := $(GCS_DIR)/Makefile
|
||||
|
||||
.PHONY: openpilotgcs_qmake
|
||||
openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR)
|
||||
$(V1) cd $(OPENPILOTGCS_DIR) && \
|
||||
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro \
|
||||
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
|
||||
.PHONY: gcs_qmake
|
||||
gcs_qmake $(GCS_MAKEFILE): | $(GCS_DIR)
|
||||
$(V1) cd $(GCS_DIR) && \
|
||||
$(QMAKE) $(ROOT_DIR)/ground/gcs/gcs.pro \
|
||||
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
|
||||
'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
|
||||
'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
|
||||
'WIKI_URL_ROOT="$(WIKI_URL_ROOT)"' \
|
||||
'USAGETRACKER_URL="$(USAGETRACKER_URL)"' \
|
||||
'GCS_LIBRARY_BASENAME=$(libbasename)' \
|
||||
$(GCS_QMAKE_OPTS)
|
||||
|
||||
.PHONY: openpilotgcs
|
||||
openpilotgcs: uavobjgenerator $(OPENPILOTGCS_MAKEFILE)
|
||||
$(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
|
||||
.PHONY: gcs
|
||||
gcs: $(UAVOBJGENERATOR) $(GCS_MAKEFILE)
|
||||
$(V1) $(MAKE) -w -C $(GCS_DIR)/$(MAKE_DIR);
|
||||
|
||||
.PHONY: openpilotgcs_clean
|
||||
openpilotgcs_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
|
||||
$(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
|
||||
.PHONY: gcs_clean
|
||||
gcs_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(GCS_DIR))"
|
||||
$(V1) [ ! -d "$(GCS_DIR)" ] || $(RM) -r "$(GCS_DIR)"
|
||||
|
||||
|
||||
|
||||
@ -492,7 +299,7 @@ UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
|
||||
.PHONY: uploader_qmake
|
||||
uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
|
||||
$(V1) cd $(UPLOADER_DIR) && \
|
||||
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
|
||||
$(QMAKE) $(ROOT_DIR)/ground/gcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
|
||||
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
|
||||
|
||||
.PHONY: uploader
|
||||
@ -679,35 +486,40 @@ endif
|
||||
# Packaging components
|
||||
#
|
||||
##############################
|
||||
|
||||
# Firmware files to package
|
||||
PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
|
||||
PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
|
||||
PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
|
||||
PACKAGE_FW_TARGETS := fw_coptercontrol fw_oplinkmini fw_revolution fw_osd fw_revoproto fw_gpsplatinum fw_revonano
|
||||
|
||||
# Rules to generate GCS resources used to embed firmware binaries into the GCS.
|
||||
# They are used later by the vehicle setup wizard to update board firmware.
|
||||
# To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
|
||||
OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
|
||||
OPFW_RESOURCE_PREFIX := ../../
|
||||
OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
|
||||
|
||||
ifeq ($(WITH_PREBUILT_FW),)
|
||||
FIRMWARE_DIR := $(FLIGHT_OUT_DIR)
|
||||
# We need to build the FW targets
|
||||
$(OPFW_RESOURCE): $(PACKAGE_FW_TARGETS)
|
||||
else
|
||||
FIRMWARE_DIR := $(WITH_PREBUILT_FW)
|
||||
endif
|
||||
|
||||
OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_targ)/$(fw_targ).opfw)
|
||||
OPFW_CONTENTS := \
|
||||
<!DOCTYPE RCC><RCC version="1.0"> \
|
||||
<qresource prefix="/firmware"> \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(fw_file)</file>) \
|
||||
</qresource> \
|
||||
</RCC>
|
||||
|
||||
.PHONY: opfw_resource
|
||||
opfw_resource: $(OPFW_RESOURCE)
|
||||
|
||||
$(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
|
||||
$(OPFW_RESOURCE): | $(OPGCSSYNTHDIR)
|
||||
@$(ECHO) Generating OPFW resource file $(call toprel, $@)
|
||||
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
|
||||
|
||||
# If opfw_resource or all firmware are requested, GCS should depend on the resource
|
||||
ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
|
||||
$(OPENPILOTGCS_MAKEFILE): $(OPFW_RESOURCE)
|
||||
$(GCS_MAKEFILE): $(OPFW_RESOURCE)
|
||||
endif
|
||||
|
||||
# Packaging targets: package
|
||||
@ -717,14 +529,64 @@ endif
|
||||
|
||||
# Define some variables
|
||||
PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
|
||||
PACKAGE_NAME := OpenPilot
|
||||
PACKAGE_NAME := $(subst $(SPACE),,$(ORG_BIG_NAME))
|
||||
PACKAGE_SEP := -
|
||||
PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
|
||||
|
||||
# Source distribution is never dirty because it uses git archive
|
||||
DIST_LBL := $(subst -dirty,,$(PACKAGE_LBL))
|
||||
DIST_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(DIST_LBL)
|
||||
DIST_TAR := $(DIST_DIR)/$(DIST_NAME).tar
|
||||
DIST_TAR_GZ := $(DIST_TAR).gz
|
||||
FW_DIST_NAME := $(DIST_NAME)_firmware
|
||||
FW_DIST_TAR := $(DIST_DIR)/$(FW_DIST_NAME).tar
|
||||
FW_DIST_TAR_GZ := $(FW_DIST_TAR).gz
|
||||
DIST_VER_INFO := $(DIST_DIR)/version-info.json
|
||||
|
||||
include $(ROOT_DIR)/package/$(UNAME).mk
|
||||
|
||||
# Source distribution is never dirty because it uses git archive
|
||||
DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
|
||||
##############################
|
||||
#
|
||||
# Source for distribution
|
||||
#
|
||||
##############################
|
||||
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
|
||||
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
|
||||
|
||||
$(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))"
|
||||
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD
|
||||
$(V1) tar --append --file="$(DIST_TAR)" \
|
||||
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
|
||||
$(call toprel, "$(DIST_VER_INFO)")
|
||||
|
||||
$(DIST_TAR_GZ): $(DIST_TAR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR_GZ))"
|
||||
$(V1) gzip -kf "$(DIST_TAR)"
|
||||
|
||||
.PHONY: dist_tar_gz
|
||||
dist_tar_gz: $(DIST_TAR_GZ)
|
||||
|
||||
.PHONY: dist
|
||||
dist: dist_tar_gz
|
||||
|
||||
|
||||
$(FW_DIST_TAR): $(PACKAGE_FW_TARGETS) | $(DIST_DIR)
|
||||
@$(ECHO) " FIRMWARE FOR DISTRIBUTION $(call toprel, $(FW_DIST_TAR))"
|
||||
$(V1) tar -c --file="$(FW_DIST_TAR)" --directory=$(FLIGHT_OUT_DIR) \
|
||||
--transform='s,^,firmware/,' \
|
||||
$(foreach fw_targ,$(PACKAGE_FW_TARGETS),$(fw_targ)/$(fw_targ).opfw)
|
||||
|
||||
$(FW_DIST_TAR_GZ): $(FW_DIST_TAR)
|
||||
@$(ECHO) " FIRMWARE FOR DISTRIBUTION $(call toprel, $(FW_DIST_TAR_GZ))"
|
||||
$(V1) gzip -kf "$(FW_DIST_TAR)"
|
||||
|
||||
.PHONY: fw_dist_tar_gz
|
||||
fw_dist_tar_gz: $(FW_DIST_TAR_GZ)
|
||||
|
||||
.PHONY: fw_dist
|
||||
fw_dist: fw_dist_tar_gz
|
||||
|
||||
|
||||
##############################
|
||||
#
|
||||
@ -802,26 +664,28 @@ build-info: | $(BUILD_DIR)
|
||||
|
||||
##############################
|
||||
#
|
||||
# Source for distribution
|
||||
# Config
|
||||
#
|
||||
##############################
|
||||
|
||||
DIST_VER_INFO := $(DIST_DIR)/version-info.json
|
||||
CONFIG_OPTS := $(addsuffix \n,$(MAKEOVERRIDES))
|
||||
CONFIG_OPTS := $(addprefix override$(SPACE),$(CONFIG_OPTS))
|
||||
|
||||
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
|
||||
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
|
||||
.PHONY: config_new
|
||||
config_new:
|
||||
@printf '$(CONFIG_OPTS)' > $(CONFIG_FILE)
|
||||
|
||||
.PHONY: config_append
|
||||
config_append:
|
||||
@printf '$(CONFIG_OPTS)' >> $(CONFIG_FILE)
|
||||
|
||||
$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
|
||||
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
|
||||
$(V1) tar --append --file="$(DIST_NAME)" \
|
||||
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
|
||||
$(call toprel, "$(DIST_VER_INFO)")
|
||||
$(V1) gzip -f "$(DIST_NAME)"
|
||||
.PHONY: config_show
|
||||
config_show:
|
||||
@cat $(CONFIG_FILE)
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(DIST_NAME).gz
|
||||
.PHONY: config_clean
|
||||
config_clean:
|
||||
rm -f $(CONFIG_FILE)
|
||||
|
||||
|
||||
##############################
|
||||
@ -847,7 +711,7 @@ help:
|
||||
@$(ECHO)
|
||||
@$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
|
||||
@$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
|
||||
@$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
|
||||
@$(ECHO) " $(WIKI_ROOT_URL)Windows+Building+and+Packaging"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Here is a summary of the available targets:"
|
||||
@$(ECHO)
|
||||
@ -863,6 +727,7 @@ help:
|
||||
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
||||
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
|
||||
@$(ECHO) " gtest_install - Install the GoogleTest framework"
|
||||
@$(ECHO) " ccache_install - Install ccache"
|
||||
@$(ECHO) " These targets are not updated yet and are probably broken:"
|
||||
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
||||
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
||||
@ -877,7 +742,7 @@ help:
|
||||
@$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Big Hammer]"
|
||||
@$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
|
||||
@$(ECHO) " all - Generate UAVObjects, build $(ORG_BIG_NAME) firmware and gcs"
|
||||
@$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
|
||||
@$(ECHO) " all_fw - Build only firmware for all boards"
|
||||
@$(ECHO) " all_bl - Build only bootloaders for all boards"
|
||||
@ -930,9 +795,9 @@ help:
|
||||
@$(ECHO) " ut_<test>_run - Run test and dump output to console"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Simulation]"
|
||||
@$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
|
||||
@$(ECHO) " sim_osx - Build $(ORG_BIG_NAME) simulation firmware for OSX"
|
||||
@$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
|
||||
@$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
|
||||
@$(ECHO) " sim_win32 - Build $(ORG_BIG_NAME) simulation firmware for Windows"
|
||||
@$(ECHO) " using mingw and msys"
|
||||
@$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
|
||||
@$(ECHO)
|
||||
@ -958,9 +823,10 @@ help:
|
||||
@$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Packaging]"
|
||||
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
|
||||
@$(ECHO) " package - Build and package the platform-dependent package (no clean)"
|
||||
@$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
|
||||
@$(ECHO) " dist - Generate source archive for distribution"
|
||||
@$(ECHO) " fw_dist - Generate archive of firmware"
|
||||
@$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Code Formatting]"
|
||||
@ -975,6 +841,11 @@ help:
|
||||
@$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
|
||||
@$(ECHO) " docs_all_clean - Delete all generated documentation"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Configuration]"
|
||||
@$(ECHO) " config_new - Place your make arguments in the config file"
|
||||
@$(ECHO) " config_append - Place your make arguments in the config file but append"
|
||||
@$(ECHO) " config_clean - Removes the config file"
|
||||
@$(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)"
|
||||
@ -982,7 +853,7 @@ help:
|
||||
@$(ECHO) " All build output will be placed in $(BUILD_DIR)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Tool download and install directories can be changed using environment variables:"
|
||||
@$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
|
||||
@$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
|
||||
@$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
|
||||
@$(ECHO) " DL_DIR full path to downloads directory [downloads if not set]"
|
||||
@$(ECHO) " TOOLS_DIR full path to installed tools directory [tools if not set]"
|
||||
@$(ECHO) " More info: $(WIKI_URL_ROOT)LibrePilot+Build+System+Overview"
|
||||
@$(ECHO)
|
||||
|
38
README.md
Normal file
@ -0,0 +1,38 @@
|
||||
About the LibrePilot Project
|
||||
============================
|
||||
|
||||
### Open - Collaborative - Free
|
||||
|
||||
The LibrePilot open source project was founded in July 2015. It focuses on
|
||||
research and development of software and hardware to be used in a variety of
|
||||
applications including vehicle control and stabilization, unmanned autonomous
|
||||
vehicles and robotics. One of the project’s primary goals is to provide an open
|
||||
and collaborative environment making it the ideal home for development of
|
||||
innovative ideas.
|
||||
|
||||
LibrePilot welcomes and encourages exchange and collaboration with other
|
||||
projects, like adding support for existing hardware or software in
|
||||
collaboration under the spirit of open source.
|
||||
|
||||
LibrePilot finds its roots in the OpenPilot project and the founding members
|
||||
are all long-standing contributors in that project.
|
||||
|
||||
The LibrePilot Project will be governed by a board of members using consensual
|
||||
methods to make important decisions and to set the overall direction of the
|
||||
project.
|
||||
|
||||
The LibrePilot source code is released under the OSI approved GPLv3 license.
|
||||
Integral text of the license can be found at [www.gnu.org](http://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
|
||||
|
||||
Links for the LibrePilot Project
|
||||
--------------------------------
|
||||
|
||||
- [Main project web site](https://www.librepilot.org)
|
||||
- [Project forums](https://forum.librepilot.org)
|
||||
- [Source code repository](https://bitbucket.org/librepilot)
|
||||
- [Mirror](https://github.com/librepilot)
|
||||
- [Issue tracker](https://librepilot.atlassian.net)
|
||||
- [Gitter Chat](https://gitter.im/librepilot/LibrePilot)
|
||||
- IRC: #LibrePilot on FreeNode
|
||||
|
44
README.txt
@ -1,44 +0,0 @@
|
||||
What is OpenPilot all about?
|
||||
----------------------------
|
||||
|
||||
The project aims at implementing the best features of all existing similar systems developed by
|
||||
enthusiasts and combines them into a single, easy-to-use software/hardware package. The ease-of-use
|
||||
in this case does not imply functional simplicity or compromises. There are no rigidly defined
|
||||
constraints and settings, but a full-fledged programming language configuration loaded via a
|
||||
Ground Control Station and other advanced features. OpenPilot is developed as a powerful platform
|
||||
for all types of vehicles.
|
||||
|
||||
This is a non-profit project of the OpenPilot Foundation
|
||||
--------------------------------------------------------
|
||||
|
||||
This is a project using only volunteer personnel who have donated enormous amounts of time, money
|
||||
and effort. Please respect the people that are part of the project and their generosity. OpenPilot
|
||||
is funded entirely at the expense of those who spend their time and money in the development of the
|
||||
public project which helps it grow. Giving complete and correct references to all their work is not
|
||||
only a legal requirement of the CC-BY-SA license, but also simple respect for their work. The people
|
||||
who create this project, really deserve it for their very hard work.
|
||||
|
||||
The OpenPilot project web sites
|
||||
-------------------------------
|
||||
|
||||
The project provides feature-rich development and collaboration environment using advanced tools such
|
||||
as GCC compilers, git, Atlassian JIRA, Confluence, FishEye, Crucible, Bamboo, Crowd, forums and blogs.
|
||||
|
||||
Main project web site: http://www.openpilot.org/
|
||||
Project forums: http://forums.openpilot.org/
|
||||
Wiki, docs and manuals: http://wiki.openpilot.org/
|
||||
Bug and issue tracker: http://progress.openpilot.org/
|
||||
Source code repository: http://git.openpilot.org/
|
||||
Crucible code reviews: http://reviews.openpilot.org/cru
|
||||
Project build server: http://bamboo.openpilot.org/
|
||||
Community blogs: http://forums.openpilot.org/blogs/
|
||||
Software downloads: http://wiki.openpilot.org/display/WIKI/OpenPilot+Downloads
|
||||
|
||||
How to build from source?
|
||||
-------------------------
|
||||
|
||||
make all_sdk_install
|
||||
make all
|
||||
|
||||
The project supports Windows, Linux and Mac OS X platforms as well as Android.
|
||||
Check the wiki for more details: http://wiki.openpilot.org/display/Doc/OpenPilot+Developer+Manual
|
126
WHATSNEW.txt
@ -1,4 +1,128 @@
|
||||
--- RELEASE-15.05 --- Revolution Nano ---
|
||||
-- RELEASE-15.09 - First LibrePilot Release -- Supermoon Eclipse
|
||||
This is the first LibrePilot release.
|
||||
The main focus of this release is to bring back support for CC3D and a general re-branding of the GCS.
|
||||
|
||||
The full list of bug fixes and enhancements in this release is available here:
|
||||
https://librepilot.atlassian.net/issues/?filter=10300
|
||||
|
||||
|
||||
** Bug
|
||||
* [LP-37] - Memory wasted in pvPortMallocGeneric
|
||||
* [LP-57] - Errors during NewsPanel data scraping
|
||||
* [LP-58] - Splash Screen doesn't display
|
||||
* [LP-59] - Replace openpilot email address in packaging
|
||||
* [LP-65] - Heli config tab refresh
|
||||
* [LP-69] - Add SRXL to CC3D target
|
||||
* [LP-70] - Vehicle Setup Wizard allows a not working CC3D configuration
|
||||
* [LP-84] - Nano (Revo Nano) does not automatically select correct firmware after Firmware then Halt
|
||||
* [LP-89] - Port bug fixes from OP HotFix 150501
|
||||
* [LP-107] - Motors could accidentally turn off with the recent motor output scaling feature
|
||||
* [LP-115] - TPS and Acro+ settings are initialized incorrectly
|
||||
* [LP-116] - Add uninstall to Makefile to prevent side effects from Installing over a previous installation
|
||||
* [LP-123] - EasyTune yaw calculation is active even if easytune is not active
|
||||
* [LP-125] - PathUtils should return absolute pathes
|
||||
* [LP-127] - Fix Mac tool install md5 check
|
||||
* [LP-128] - ElevateAndCompress is broken at full throttle
|
||||
* [LP-134] - Obsolete Google Satellite Version
|
||||
* [LP-135] - Aux mag calibration issue
|
||||
* [LP-136] - Build errors caused by broken uavobjgenerator make dependencies
|
||||
* [LP-153] - Bug in configrevohwwidget.cpp use MAINPORT enum not FLEXIPORT
|
||||
* [LP-155] - GCS crashes on OS X 10.11 when the board is halted
|
||||
* [LP-156] - Update Vehicle templates to work with current UAVO's
|
||||
|
||||
** Epic
|
||||
* [LP-1] - Code Rebranding
|
||||
|
||||
** Story
|
||||
* [LP-3] - Artwork rebranding
|
||||
* [LP-4] - Add a Gitter chat link to README.txt
|
||||
* [LP-5] - Add back CC/CC3D Support
|
||||
* [LP-6] - Laurent/lp 03 artwork rebranding
|
||||
* [LP-7] - OP-1879 remove openpilot hardcoding
|
||||
* [LP-8] - OP-1929 broken package src
|
||||
* [LP-9] - Hotfix for files that were missed in share directory move due to rebase
|
||||
* [LP-12] - Openpilot migration
|
||||
* [LP-13] - some more OP hardcoding fixes
|
||||
* [LP-14] - Remove some more openpilot hardcoding
|
||||
* [LP-17] - Laurent/lp 03 artwork icons splashscreen
|
||||
* [LP-18] - Makefile fix
|
||||
* [LP-19] - Remove openpilot hardcoding
|
||||
* [LP-20] - Menu item change
|
||||
* [LP-21] - udevdir fix
|
||||
* [LP-22] - Desktopfile migration
|
||||
* [LP-23] - amorale/lp-05 readd cc rebased
|
||||
* [LP-24] - filnet/op 1518 osgearth
|
||||
* [LP-28] - Removed OpenPilot reference in About menu
|
||||
* [LP-33] - Remove op from gcs dir structure
|
||||
* [LP-35] - Removed OpenPilot reference in About Menu
|
||||
* [LP-43] - change links and headers in welcome plugin
|
||||
* [LP-44] - Review and cleanup to free some memory for CC3D
|
||||
* [LP-47] - Fixed missing QDataStream includes to make compilation on qt 5.5 work
|
||||
* [LP-48] - French translation
|
||||
* [LP-49] - Laurent/lp 48 update rebranding strings translations
|
||||
* [LP-50] - Make name define available for all by setting in openpilotgcs.pri
|
||||
* [LP-51] - Wrong config tab contents
|
||||
* [LP-52] - LP-51 Fix merge issue for Revo / Revonano HW config display
|
||||
* [LP-53] - Set up Anonymous data collection to send information to the LibrePilot website
|
||||
* [LP-55] - Config fix for echo without -e
|
||||
* [LP-62] - Implement rpm spec
|
||||
|
||||
** New Feature
|
||||
* [LP-100] - Make firmware package
|
||||
* [LP-101] - Make build possible with prebuilt firmware
|
||||
|
||||
** Task
|
||||
* [LP-16] - Vehicle template enhancements.
|
||||
* [LP-26] - Update Welcome page plugin.
|
||||
* [LP-27] - LP-16 Vehicle templates enhancements
|
||||
* [LP-36] - Win install fixes
|
||||
* [LP-41] - Add support for ccache
|
||||
* [LP-42] - Added option for config file.
|
||||
* [LP-60] - Fix project links in readme
|
||||
* [LP-92] - Remove old Feed Forward
|
||||
* [LP-98] - SystemHealth refresh
|
||||
* [LP-99] - Decouple flight build
|
||||
* [LP-113] - Create new tool install framework
|
||||
* [LP-129] - Remove broken scaleMotor modes
|
||||
* [LP-138] - Remove OpenPilot branding from Makefile Help text
|
||||
* [LP-141] - Missing link for wiki help page on Stabilization Configuration page
|
||||
* [LP-142] - Replace remaining OpenPilot wiki links with LibrePilot links
|
||||
|
||||
** Improvement
|
||||
* [LP-10] - Cleanup build warnings on OSX
|
||||
* [LP-56] - Split roll/pitch acro+ factors
|
||||
* [LP-61] - Make more things configurable with make config
|
||||
* [LP-64] - Install target for ccache
|
||||
* [LP-66] - Add differential Roll mixing to Fixed Wing frames
|
||||
* [LP-67] - Add a txpid option that manage all PID factors at once
|
||||
* [LP-77] - Jira needs more Component options
|
||||
* [LP-80] - Extend linux packaging to easily support new distros
|
||||
* [LP-82] - Define all packaging descriptions and URLs in top Makefile
|
||||
* [LP-87] - Remove OpenPilot branding from Doxygen Documentation
|
||||
* [LP-93] - Thermal calibration should calculate also gyro bias
|
||||
* [LP-94] - Set up Wiki link in Configuration tabs to point to Librepilot Wiki
|
||||
* [LP-102] - Remove OpenPilot links in "About Plugins" dialog boxes
|
||||
* [LP-106] - Setup Wizard refresh
|
||||
* [LP-108] - Fixes for mpu6k
|
||||
* [LP-110] - Wizard : high rate servos and normal Esc rate for planes and ground vehicles
|
||||
* [LP-114] - Support to more than three Accessory channels
|
||||
* [LP-124] - Rename RollRatePID and PitcahRatePID to EasyTuneRateRoll and EasyTuneRatePitch
|
||||
* [LP-130] - Add an overridable postfix that is appended to GCS name
|
||||
* [LP-162] - Add more data to usage tracker.
|
||||
|
||||
|
||||
--- RELEASE-15.05.01 HOTFIX --- Banana Split ---
|
||||
This release fixes an important bug. All Revolution hardware running 15.05 should upgrade to 15.05.01. Note that this is a hotfix; it can
|
||||
simply be flashed without an erase settings. Furthermore, please review your vtolpathfollowersettings:HorizontalVelMax; a value of around 4m/s would be more appropriate for preliminary trialing of a new release and will be changed in future.
|
||||
|
||||
Release Notes - OP Next Generation - Version OP15.05.01
|
||||
|
||||
** Bug
|
||||
* [NG-55] - 15.05 PositionHold exhibits fly-away behaviour at the vtolpathfollowersettings maxRollPitch and HorizontalVelMax values.
|
||||
|
||||
|
||||
|
||||
--- RELEASE-15.05 --- Banana Split ---
|
||||
|
||||
This release introduces new features and new hardware support for the Revolution Nano.
|
||||
Note that the CC3D is not supported by this feature release.
|
||||
|
BIN
artwork/3D Model/boards/cc3d/cc3d.jpg
Normal file
After Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
BIN
artwork/3D Model/boards/cc3d/texture.png
Normal file
After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
BIN
artwork/3D Model/boards/OPGPSv8/OPGPS.3DS → artwork/3D Model/boards/op_gps_v8/op_gps_v8.3ds
Normal file → Executable file
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 188 KiB |
BIN
artwork/3D Model/boards/OPGPSv9/OPGPSv9.3DS → artwork/3D Model/boards/op_gps_v9/op_gps_v9.3ds
Normal file → Executable file
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 309 KiB After Width: | Height: | Size: 309 KiB |
BIN
artwork/3D Model/boards/OPLink/OPLink.3DS → artwork/3D Model/boards/oplink/oplink.3ds
Normal file → Executable file
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
BIN
artwork/3D Model/boards/Revolution/revolution.3ds → artwork/3D Model/boards/revolution/revolution.3ds
Normal file → Executable file
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 344 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
BIN
artwork/3D Model/multi/easy_quad/easy_quad_x.jpg
Normal file
After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
BIN
artwork/3D Model/multi/joes_cnc/j14-q_+.3ds
Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
BIN
artwork/3D Model/multi/joes_cnc/j14-q_x.3ds
Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
BIN
artwork/3D Model/multi/joes_cnc/j14-qt_+.3ds
Normal file
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
BIN
artwork/3D Model/multi/joes_cnc/j14-qt_x.3ds
Normal file
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
BIN
artwork/3D Model/multi/joes_cnc/texture.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
BIN
artwork/3D Model/multi/test_quad/test_quad_+-old.3ds
Normal file → Executable file
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 113 KiB |
BIN
artwork/3D Model/multi/test_quad/test_quad_X-old.3ds → artwork/3D Model/multi/test_quad/test_quad_x-old.3ds
Normal file → Executable file
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
BIN
artwork/3D Model/multi/test_quad/test_quad_x.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 210 KiB |
BIN
artwork/3D Model/multi/test_quad/texture.png
Normal file
After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 484 KiB After Width: | Height: | Size: 484 KiB |
256
flight/Makefile
Normal file
@ -0,0 +1,256 @@
|
||||
export FLIGHT_MAKEFILE := TRUE
|
||||
export FLIGHT_ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
export PIOS := $(FLIGHT_ROOT_DIR)/pios
|
||||
export FLIGHTLIB := $(FLIGHT_ROOT_DIR)/libraries
|
||||
export OPMODULEDIR := $(FLIGHT_ROOT_DIR)/modules
|
||||
export OPUAVOBJ := $(FLIGHT_ROOT_DIR)/uavobjects
|
||||
export OPUAVTALK := $(FLIGHT_ROOT_DIR)/uavtalk
|
||||
export FLIGHT_OUT_DIR ?= $(CURDIR)
|
||||
|
||||
# Define supported board lists
|
||||
ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
|
||||
|
||||
# Short names of each board (used to display board name in parallel builds)
|
||||
coptercontrol_short := 'cc '
|
||||
oplinkmini_short := 'oplm'
|
||||
revolution_short := 'revo'
|
||||
osd_short := 'osd '
|
||||
revoproto_short := 'revp'
|
||||
revonano_short := 'revn'
|
||||
simposix_short := 'posx'
|
||||
discoveryf4bare_short := 'df4b'
|
||||
gpsplatinum_short := 'gps9'
|
||||
|
||||
# SimPosix only builds on Linux so drop it from the list for
|
||||
# all other platforms.
|
||||
ifneq ($(UNAME), Linux)
|
||||
ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
|
||||
endif
|
||||
|
||||
# Start out assuming that we'll build fw, bl and bu for all boards
|
||||
FW_BOARDS := $(ALL_BOARDS)
|
||||
BL_BOARDS := $(ALL_BOARDS)
|
||||
BU_BOARDS := $(ALL_BOARDS)
|
||||
EF_BOARDS := $(ALL_BOARDS)
|
||||
|
||||
# SimPosix doesn't have a BL, BU or EF target so we need to
|
||||
# filter them out to prevent errors on the all_flight target.
|
||||
BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
|
||||
BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
|
||||
EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
|
||||
|
||||
# Generate the targets for whatever boards are left in each list
|
||||
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
|
||||
BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
|
||||
BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
|
||||
EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
|
||||
|
||||
ALL_FLIGHT := all_fw all_bl all_bu all_ef
|
||||
ALL_FLIGHT_CLEAN := $(addsuffix _clean,$(ALL_FLIGHT))
|
||||
|
||||
.PHONY: all_flight all_flight_clean
|
||||
all_flight: $(ALL_FLIGHT)
|
||||
all_flight_clean: $(ALL_FLIGHT_CLEAN)
|
||||
|
||||
|
||||
# TEMPLATES (used to generate build rules)
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define FW_TEMPLATE
|
||||
.PHONY: $(1) fw_$(1)
|
||||
$(1): fw_$(1)_opfw
|
||||
fw_$(1): fw_$(1)_opfw
|
||||
|
||||
fw_$(1)_%: flight_uavobjects
|
||||
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
||||
$(V1) mkdir -p $(FLIGHT_OUT_DIR)/fw_$(1)/dep
|
||||
$(V1) cd $(FLIGHT_ROOT_DIR)/targets/boards/$(1)/firmware && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=fw \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(FLIGHT_ROOT_DIR)/targets/boards/$(1)/firmware \
|
||||
OUTDIR=$(FLIGHT_OUT_DIR)/fw_$(1) \
|
||||
TARGET=fw_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: $(1)_clean
|
||||
$(1)_clean: fw_$(1)_clean
|
||||
fw_$(1)_clean:
|
||||
@echo " CLEAN $(call toprel, $(FLIGHT_OUT_DIR)/fw_$(1))"
|
||||
$(V1) rm -fr $(FLIGHT_OUT_DIR)/fw_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
# $(2) = Short name for board (e.g cc)
|
||||
define BL_TEMPLATE
|
||||
.PHONY: bl_$(1)
|
||||
bl_$(1): bl_$(1)_bin
|
||||
bl_$(1)_bino: bl_$(1)_bin
|
||||
|
||||
bl_$(1)_%:
|
||||
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
||||
$(V1) mkdir -p $(FLIGHT_OUT_DIR)/bl_$(1)/dep
|
||||
$(V1) cd $(FLIGHT_ROOT_DIR)/targets/boards/$(1)/bootloader && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bl \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(FLIGHT_ROOT_DIR)/targets/boards/$(1)/bootloader \
|
||||
OUTDIR=$(FLIGHT_OUT_DIR)/bl_$(1) \
|
||||
TARGET=bl_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: unbrick_$(1)
|
||||
unbrick_$(1): bl_$(1)_hex
|
||||
$(if $(filter-out undefined,$(origin UNBRICK_TTY)),
|
||||
$(V0) @echo " UNBRICK $(1) via $$(UNBRICK_TTY)"
|
||||
$(V1) $(STM32FLASH_DIR)/stm32flash \
|
||||
-w $(FLIGHT_OUT_DIR)/bl_$(1)/bl_$(1).hex \
|
||||
-g 0x0 \
|
||||
$$(UNBRICK_TTY)
|
||||
,
|
||||
$(V0) @echo
|
||||
$(V0) @echo "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
|
||||
$(V0) @echo " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
|
||||
)
|
||||
|
||||
.PHONY: bl_$(1)_clean
|
||||
bl_$(1)_clean:
|
||||
@echo " CLEAN $(call toprel, $(FLIGHT_OUT_DIR)/bl_$(1))"
|
||||
$(V1) rm -fr $(FLIGHT_OUT_DIR)/bl_$(1)
|
||||
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 $(FLIGHT_OUT_DIR)/bu_$(1)/dep
|
||||
$(V1) cd $(FLIGHT_ROOT_DIR)/targets/common/bootloader_updater && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bu \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
TOPDIR=$(FLIGHT_ROOT_DIR)/targets/common/bootloader_updater \
|
||||
OUTDIR=$(FLIGHT_OUT_DIR)/bu_$(1) \
|
||||
TARGET=bu_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: bu_$(1)_clean
|
||||
bu_$(1)_clean:
|
||||
@echo " CLEAN $(call toprel, $(FLIGHT_OUT_DIR)/bu_$(1))"
|
||||
$(V1) rm -fr $(FLIGHT_OUT_DIR)/bu_$(1)
|
||||
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 $(FLIGHT_OUT_DIR)/ef_$(1)
|
||||
$(V1) cd $(FLIGHT_ROOT_DIR)/targets/common/entire_flash && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=ef \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
||||
TOPDIR=$(FLIGHT_ROOT_DIR)/targets/common/entire_flash \
|
||||
OUTDIR=$(FLIGHT_OUT_DIR)/ef_$(1) \
|
||||
TARGET=ef_$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: ef_$(1)_clean
|
||||
ef_$(1)_clean:
|
||||
@echo " CLEAN $(call toprel, $(FLIGHT_OUT_DIR)/ef_$(1))"
|
||||
$(V1) rm -fr $(FLIGHT_OUT_DIR)/ef_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
define BOARD_PHONY_TEMPLATE
|
||||
.PHONY: all_$(1)
|
||||
all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
|
||||
all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
|
||||
all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
|
||||
all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
|
||||
|
||||
.PHONY: all_$(1)_clean
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
|
||||
endef
|
||||
|
||||
|
||||
# Generate flight build rules
|
||||
.PHONY: first
|
||||
first: all_fw
|
||||
|
||||
.PHONY: all_fw all_fw_clean
|
||||
all_fw: $(addsuffix _opfw, $(FW_TARGETS))
|
||||
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
|
||||
|
||||
.PHONY: all_bl all_bl_clean
|
||||
all_bl: $(addsuffix _bin, $(BL_TARGETS))
|
||||
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
|
||||
|
||||
.PHONY: all_bu all_bu_clean
|
||||
all_bu: $(addsuffix _opfw, $(BU_TARGETS))
|
||||
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
|
||||
|
||||
.PHONY: all_ef all_ef_clean
|
||||
all_ef: $(EF_TARGETS)
|
||||
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
|
||||
|
||||
# Expand the groups of targets for each board
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
|
||||
|
||||
# Expand the firmware rules
|
||||
$(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)_short))))
|
||||
|
||||
# Expand the bootloader updater rules
|
||||
$(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)_short))))
|
||||
|
||||
.PHONY: sim_win32
|
||||
sim_win32: sim_win32_exe
|
||||
|
||||
sim_win32_%: flight_uavobjects
|
||||
$(V1) mkdir -p $(FLIGHT_OUT_DIR)/sitl_win32
|
||||
$(V1) $(MAKE) --no-print-directory \
|
||||
-C $(FLIGHT_ROOT_DIR)/targets/OpenPilot --file=$(FLIGHT_ROOT_DIR)/targets/OpenPilot/Makefile.win32 $*
|
||||
|
||||
.PHONY: sim_osx
|
||||
sim_osx: sim_osx_elf
|
||||
|
||||
sim_osx_%: flight_uavobjects
|
||||
$(V1) mkdir -p $(FLIGHT_OUT_DIR)/sim_osx
|
||||
$(V1) $(MAKE) --no-print-directory \
|
||||
-C $(FLIGHT_ROOT_DIR)/targets/SensorTest --file=$(FLIGHT_ROOT_DIR)/targets/SensorTest/Makefile.osx $*
|
||||
|
||||
##############################
|
||||
#
|
||||
# UAV Objects
|
||||
#
|
||||
##############################
|
||||
UAVOBJGENERATOR ?= $(shell which uavobjgenerator)
|
||||
|
||||
UAVOBJ_XML_DIR := $(FLIGHT_ROOT_DIR)/../shared/uavobjectdefinition
|
||||
export FLIGHT_UAVOBJ_DIR := $(FLIGHT_OUT_DIR)/uavobjects
|
||||
|
||||
.PHONY: flight_uavobjects
|
||||
flight_uavobjects: $(UAVOBJGENERATOR)
|
||||
@mkdir -p $(FLIGHT_UAVOBJ_DIR)
|
||||
$(V1) cd $(FLIGHT_UAVOBJ_DIR) && \
|
||||
$(UAVOBJGENERATOR) -flight $(UAVOBJ_XML_DIR) $(FLIGHT_ROOT_DIR)/..
|
||||
|
@ -43,4 +43,4 @@ $(TARGET)_nat.c $(TARGET)_img.c: $(PM_USR_SOURCES) pmfeatures.py
|
||||
|
||||
clean :
|
||||
$(MAKE) -C ../../vm clean
|
||||
$(RM) $(TARGET).out $(OBJS) $(TARGET)_img.* $(TARGET)_nat.* pmfeatures.h
|
||||
rm $(TARGET).out $(OBJS) $(TARGET)_img.* $(TARGET)_nat.* pmfeatures.h
|
||||
|
@ -40,13 +40,13 @@ PYSCRIPTS += $(wildcard $(FLIGHTPLANS)/*.py)
|
||||
$(PYSRC): | $(PYLIB) $(OUTDIR)/pmfeatures.h
|
||||
|
||||
$(OUTDIR)/pmfeatures.h: $(PYSCRIPTS)
|
||||
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
@echo $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
$(V1) $(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $@
|
||||
|
||||
$(OUTDIR)/pmlib_img.c: | $(OUTDIR)/pmlib_nat.c
|
||||
|
||||
$(OUTDIR)/pmlib_nat.c: $(PYSCRIPTS)
|
||||
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
@echo $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
$(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -s --memspace=flash \
|
||||
-f $(PYMITEPLAT)/pmfeatures.py \
|
||||
-o $(OUTDIR)/pmlib_img.c \
|
||||
@ -61,7 +61,7 @@ $(OUTDIR)/pmlib_nat.c: $(PYSCRIPTS)
|
||||
$(OUTDIR)/pmlibusr_img.c: | $(OUTDIR)/pmlibusr_nat.c
|
||||
|
||||
$(OUTDIR)/pmlibusr_nat.c: $(PYSCRIPTS)
|
||||
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
@echo $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
$(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -u \
|
||||
-f $(PYMITEPLAT)/pmfeatures.py \
|
||||
-o $(OUTDIR)/pmlibusr_img.c \
|
||||
|
@ -41,7 +41,6 @@ extern "C" {
|
||||
#include <paths.h>
|
||||
#include "plans.h"
|
||||
#include <stabilizationdesired.h>
|
||||
#include <pidstatus.h>
|
||||
#include <vtolselftuningstats.h>
|
||||
}
|
||||
|
||||
@ -348,7 +347,6 @@ float PIDControlDown::GetVelocityDesired(void)
|
||||
|
||||
float PIDControlDown::GetDownCommand(void)
|
||||
{
|
||||
PIDStatusData pidStatus;
|
||||
float ulow = mMinThrust;
|
||||
float uhigh = mMaxThrust;
|
||||
|
||||
@ -356,17 +354,6 @@ float PIDControlDown::GetDownCommand(void)
|
||||
mCallback->BoundThrust(ulow, uhigh);
|
||||
}
|
||||
float downCommand = pid2_apply(&PID, mVelocitySetpointCurrent, mVelocityState, ulow, uhigh);
|
||||
pidStatus.setpoint = mVelocitySetpointCurrent;
|
||||
pidStatus.actual = mVelocityState;
|
||||
pidStatus.error = mVelocitySetpointCurrent - mVelocityState;
|
||||
pidStatus.setpoint = mVelocitySetpointCurrent;
|
||||
pidStatus.ulow = ulow;
|
||||
pidStatus.uhigh = uhigh;
|
||||
pidStatus.command = downCommand;
|
||||
pidStatus.P = PID.P;
|
||||
pidStatus.I = PID.I;
|
||||
pidStatus.D = PID.D;
|
||||
PIDStatusSet(&pidStatus);
|
||||
mDownCommand = downCommand;
|
||||
return mDownCommand;
|
||||
}
|
||||
|
@ -102,7 +102,8 @@ void plan_setup_positionHold()
|
||||
|
||||
PositionStateGet(&positionState);
|
||||
PathDesiredData pathDesired;
|
||||
PathDesiredGet(&pathDesired);
|
||||
// re-initialise in setup stage
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
|
||||
FlightModeSettingsPositionHoldOffsetData offset;
|
||||
FlightModeSettingsPositionHoldOffsetGet(&offset);
|
||||
@ -132,7 +133,8 @@ void plan_setup_returnToBase()
|
||||
PositionStateDownGet(&positionStateDown);
|
||||
|
||||
PathDesiredData pathDesired;
|
||||
PathDesiredGet(&pathDesired);
|
||||
// re-initialise in setup stage
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
|
||||
TakeOffLocationData takeoffLocation;
|
||||
TakeOffLocationGet(&takeoffLocation);
|
||||
@ -241,6 +243,8 @@ void plan_setup_AutoTakeoff()
|
||||
// stabi command.
|
||||
}
|
||||
PathDesiredData pathDesired;
|
||||
// re-initialise in setup stage
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
plan_setup_AutoTakeoff_helper(&pathDesired);
|
||||
PathDesiredSet(&pathDesired);
|
||||
}
|
||||
@ -312,6 +316,8 @@ void plan_run_AutoTakeoff()
|
||||
autotakeoffState != STATUSVTOLAUTOTAKEOFF_CONTROLSTATE_POSITIONHOLD) {
|
||||
if (priorState != autotakeoffState) {
|
||||
PathDesiredData pathDesired;
|
||||
// re-initialise in setup stage
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
plan_setup_AutoTakeoff_helper(&pathDesired);
|
||||
PathDesiredSet(&pathDesired);
|
||||
}
|
||||
@ -348,6 +354,9 @@ void plan_setup_land()
|
||||
{
|
||||
PathDesiredData pathDesired;
|
||||
|
||||
// re-initialise in setup stage
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
|
||||
plan_setup_land_helper(&pathDesired);
|
||||
PathDesiredSet(&pathDesired);
|
||||
}
|
||||
@ -506,7 +515,10 @@ static void plan_run_PositionVario(vario_type type)
|
||||
float alpha;
|
||||
PathDesiredData pathDesired;
|
||||
|
||||
// Reuse the existing pathdesired object as setup in the setup to avoid
|
||||
// updating values already set.
|
||||
PathDesiredGet(&pathDesired);
|
||||
|
||||
FlightModeSettingsPositionHoldOffsetData offset;
|
||||
FlightModeSettingsPositionHoldOffsetGet(&offset);
|
||||
|
||||
@ -587,10 +599,12 @@ void plan_run_VelocityRoam()
|
||||
{
|
||||
// float alpha;
|
||||
PathDesiredData pathDesired;
|
||||
|
||||
// velocity roam code completely sets pathdesired object. it was not set in setup phase
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
FlightStatusAssistedControlStateOptions assistedControlFlightMode;
|
||||
FlightStatusFlightModeOptions flightMode;
|
||||
|
||||
PathDesiredGet(&pathDesired);
|
||||
FlightModeSettingsPositionHoldOffsetData offset;
|
||||
FlightModeSettingsPositionHoldOffsetGet(&offset);
|
||||
FlightStatusAssistedControlStateGet(&assistedControlFlightMode);
|
||||
@ -713,8 +727,10 @@ void plan_setup_AutoCruise()
|
||||
PositionStateData positionState;
|
||||
|
||||
PositionStateGet(&positionState);
|
||||
|
||||
PathDesiredData pathDesired;
|
||||
PathDesiredGet(&pathDesired);
|
||||
// setup needs to reinitialise the pathdesired object
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
|
||||
FlightModeSettingsPositionHoldOffsetData offset;
|
||||
FlightModeSettingsPositionHoldOffsetGet(&offset);
|
||||
@ -757,7 +773,9 @@ void plan_run_AutoCruise()
|
||||
|
||||
PositionStateGet(&positionState);
|
||||
PathDesiredData pathDesired;
|
||||
// re-use pathdesired that was setup correctly in setup stage.
|
||||
PathDesiredGet(&pathDesired);
|
||||
|
||||
FlightModeSettingsPositionHoldOffsetData offset;
|
||||
FlightModeSettingsPositionHoldOffsetGet(&offset);
|
||||
|
||||
@ -830,6 +848,8 @@ void plan_setup_assistedcontrol()
|
||||
|
||||
PositionStateGet(&positionState);
|
||||
PathDesiredData pathDesired;
|
||||
// setup function, avoid carry over from previous mode
|
||||
memset(&pathDesired, 0, sizeof(PathDesiredData));
|
||||
|
||||
FlightStatusAssistedControlStateOptions assistedControlFlightMode;
|
||||
|
||||
|
@ -29,7 +29,7 @@ TARGETS = $(TARGET_LIB) $(TEST_PROGS)
|
||||
all: $(TARGETS)
|
||||
|
||||
$(TARGET_LIB): $(LIB_OBJS)
|
||||
$(RM) $@
|
||||
rm $@
|
||||
$(AR) cq $@ $(LIB_OBJS)
|
||||
if [ "$(RANLIB)" ]; then $(RANLIB) $@; fi
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2015, The LibrePilot Project, http://www.librepilot.org
|
||||
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -16,7 +17,7 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifndef OPENPILOT_IS_COOL
|
||||
ifndef FLIGHT_MAKEFILE
|
||||
$(error Top level Makefile must be used to build this target)
|
||||
endif
|
||||
|
||||
@ -137,7 +138,7 @@ SRC += $(foreach mod, $(OPTMODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c
|
||||
# Declare all non-optional modules as built-in to force inclusion.
|
||||
# Built-in modules are always enabled and cannot be disabled.
|
||||
MODNAMES := $(notdir $(subst /revolution,,$(MODULES)))
|
||||
MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN)
|
||||
MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell echo $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN)
|
||||
CDEFS += $(MODULES_BUILTIN)
|
||||
|
||||
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
|
||||
@ -176,7 +177,7 @@ EXTRAINCDIRS += $(MATHLIBINC)
|
||||
EXTRAINCDIRS += $(PIDLIBINC)
|
||||
EXTRAINCDIRS += $(OPUAVOBJINC)
|
||||
EXTRAINCDIRS += $(OPUAVTALKINC)
|
||||
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
|
||||
EXTRAINCDIRS += $(FLIGHT_UAVOBJ_DIR)
|
||||
|
||||
# Modules
|
||||
EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc
|
@ -1,4 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2015, The LibrePilot Project, http://www.librepilot.org
|
||||
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -16,7 +17,7 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifndef OPENPILOT_IS_COOL
|
||||
ifndef FLIGHT_MAKEFILE
|
||||
$(error Top level Makefile must be used to build this target)
|
||||
endif
|
||||
|
@ -16,7 +16,7 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifndef OPENPILOT_IS_COOL
|
||||
ifndef FLIGHT_MAKEFILE
|
||||
$(error Top level Makefile must be used to build this target)
|
||||
endif
|
||||
|
||||
@ -234,7 +234,7 @@ endif
|
||||
|
||||
# Generate code for PyMite
|
||||
# $(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py)
|
||||
# @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
# @echo $(MSG_PYMITEINIT) $(call toprel, $@)
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py)
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
|
||||
@ -292,30 +292,30 @@ $(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
|
||||
# Target: clean project
|
||||
clean:
|
||||
@echo $(MSG_CLEANING)
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).map
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o
|
||||
$(V1) $(RM) -f $(OUTDIR)/$(TARGET).opfw
|
||||
$(V1) $(RM) -f $(wildcard $(OUTDIR)/*.c)
|
||||
$(V1) $(RM) -f $(wildcard $(OUTDIR)/*.h)
|
||||
$(V1) $(RM) -f $(ALLOBJ)
|
||||
$(V1) $(RM) -f $(LSTFILES)
|
||||
$(V1) $(RM) -f $(DEPFILES)
|
||||
$(V1) $(RM) -f $(SRC:.c=.s)
|
||||
$(V1) $(RM) -f $(SRCARM:.c=.s)
|
||||
$(V1) $(RM) -f $(CPPSRC:.cpp=.s)
|
||||
$(V1) $(RM) -f $(CPPSRCARM:.cpp=.s)
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).map
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).elf
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).hex
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).bin
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).sym
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).lss
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).bin.o
|
||||
$(V1) rm -f $(OUTDIR)/$(TARGET).opfw
|
||||
$(V1) rm -f $(wildcard $(OUTDIR)/*.c)
|
||||
$(V1) rm -f $(wildcard $(OUTDIR)/*.h)
|
||||
$(V1) rm -f $(ALLOBJ)
|
||||
$(V1) rm -f $(LSTFILES)
|
||||
$(V1) rm -f $(DEPFILES)
|
||||
$(V1) rm -f $(SRC:.c=.s)
|
||||
$(V1) rm -f $(SRCARM:.c=.s)
|
||||
$(V1) rm -f $(CPPSRC:.cpp=.s)
|
||||
$(V1) rm -f $(CPPSRCARM:.cpp=.s)
|
||||
|
||||
# Create output files directory
|
||||
# all known MS Windows OS define the ComSpec environment variable
|
||||
$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null)
|
||||
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
|
||||
|
||||
# Include the dependency files.
|
||||
-include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
|
||||
-include $(shell mkdir -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY: all build clean install
|
@ -1,4 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2015, The LibrePilot Project, http://www.librepilot.org
|
||||
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -16,13 +17,13 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifndef OPENPILOT_IS_COOL
|
||||
ifndef FLIGHT_MAKEFILE
|
||||
$(error Top level Makefile must be used to build this target)
|
||||
endif
|
||||
|
||||
# Define toolchain component names.
|
||||
CC = $(ARM_SDK_PREFIX)gcc
|
||||
CXX = $(ARM_SDK_PREFIX)g++
|
||||
CC = $(CCACHE) $(ARM_SDK_PREFIX)gcc
|
||||
CXX = $(CCACHE) $(ARM_SDK_PREFIX)g++
|
||||
AR = $(ARM_SDK_PREFIX)ar
|
||||
OBJCOPY = $(ARM_SDK_PREFIX)objcopy
|
||||
OBJDUMP = $(ARM_SDK_PREFIX)objdump
|
||||
@ -69,7 +70,7 @@ MSG_FLASH_IMG = $(QUOTE) FLASH_IMG $(MSG_EXTRA) $(QUOTE)
|
||||
|
||||
# Function for converting an absolute path to one relative
|
||||
# to the top of the source tree.
|
||||
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
|
||||
toprel = $(subst $(realpath $(FLIGHT_ROOT_DIR))/,,$(abspath $(1)))
|
||||
|
||||
# Function to replace special characters like is done for the symbols.
|
||||
replace_special_chars = $(subst +,_,$(subst ~,_,$(subst @,_,$(subst :,_,$(subst -,_,$(subst .,_,$(subst /,_,$1)))))))
|
||||
@ -81,25 +82,25 @@ gccversion:
|
||||
|
||||
# Create final output file (.hex) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
$(V1) $(OBJCOPY) -O ihex $< $@
|
||||
|
||||
# Create stripped output file (.elf.stripped) from ELF output file.
|
||||
%.elf.stripped: %.elf
|
||||
@$(ECHO) $(MSG_STRIP_FILE) $(call toprel, $@)
|
||||
@echo $(MSG_STRIP_FILE) $(call toprel, $@)
|
||||
$(V1) $(STRIP) --strip-unneeded $< -o $@
|
||||
|
||||
# Create final output file (.bin) from ELF output file.
|
||||
%.bin: %.elf
|
||||
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
$(V1) $(OBJCOPY) -O binary $< $@
|
||||
|
||||
%.bin: %.o
|
||||
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||
$(V1) $(OBJCOPY) -O binary $< $@
|
||||
|
||||
%.bin.o: %.bin
|
||||
@$(ECHO) $(MSG_BIN_OBJ) $(call toprel, $@)
|
||||
@echo $(MSG_BIN_OBJ) $(call toprel, $@)
|
||||
$(V1) $(OBJCOPY) -I binary -O elf32-littlearm --binary-architecture arm \
|
||||
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
|
||||
--wildcard \
|
||||
@ -111,12 +112,12 @@ gccversion:
|
||||
# Create extended listing file/disassambly from ELF output file.
|
||||
# using objdump testing: option -C
|
||||
%.lss: %.elf
|
||||
@$(ECHO) $(MSG_EXTENDED_LISTING) $(call toprel, $@)
|
||||
@echo $(MSG_EXTENDED_LISTING) $(call toprel, $@)
|
||||
$(V1) $(OBJDUMP) -h -S -C -r $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@$(ECHO) $(MSG_SYMBOL_TABLE) $(call toprel, $@)
|
||||
@echo $(MSG_SYMBOL_TABLE) $(call toprel, $@)
|
||||
$(V1) $(NM) -n $< > $@
|
||||
|
||||
define SIZE_TEMPLATE
|
||||
@ -125,7 +126,7 @@ size: $(1)_size
|
||||
|
||||
.PHONY: $(1)_size
|
||||
$(1)_size: $(1)
|
||||
@$(ECHO) $(MSG_SIZE) $$(call toprel, $$<)
|
||||
@echo $(MSG_SIZE) $$(call toprel, $$<)
|
||||
$(V1) $(SIZE) -A $$<
|
||||
endef
|
||||
|
||||
@ -136,62 +137,62 @@ endef
|
||||
define OPFW_TEMPLATE
|
||||
FORCE:
|
||||
|
||||
$(1).firmware_info.c: $(1) $(ROOT_DIR)/flight/templates/firmware_info.c.template FORCE
|
||||
@$(ECHO) $(MSG_FWINFO) $$(call toprel, $$@)
|
||||
$(1).firmware_info.c: $(1) $(FLIGHT_ROOT_DIR)/templates/firmware_info.c.template FORCE
|
||||
@echo $(MSG_FWINFO) $$(call toprel, $$@)
|
||||
$(V1) $(VERSION_INFO) \
|
||||
--template=$(ROOT_DIR)/flight/templates/firmware_info.c.template \
|
||||
--template=$(FLIGHT_ROOT_DIR)/templates/firmware_info.c.template \
|
||||
--outfile=$$@ \
|
||||
--image=$(1) \
|
||||
--type=$(2) \
|
||||
--revision=$(3) \
|
||||
--uavodir=$(ROOT_DIR)/shared/uavobjectdefinition
|
||||
--uavodir=$(FLIGHT_ROOT_DIR)/../shared/uavobjectdefinition
|
||||
|
||||
$(eval $(call COMPILE_C_TEMPLATE, $(1).firmware_info.c))
|
||||
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).opfw : $(1) $(1).firmware_info.bin
|
||||
@$(ECHO) $(MSG_OPFIRMWARE) $$(call toprel, $$@)
|
||||
$(V1) $(CAT) $(1) $(1).firmware_info.bin > $$@
|
||||
@echo $(MSG_OPFIRMWARE) $$(call toprel, $$@)
|
||||
$(V1) cat $(1) $(1).firmware_info.bin > $$@
|
||||
endef
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
define ASSEMBLE_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_ASSEMBLING) $$(call toprel, $$<)
|
||||
@echo $(MSG_ASSEMBLING) $$(call toprel, $$<)
|
||||
$(V1) $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Assemble: create object files from assembler source files. ARM-only
|
||||
define ASSEMBLE_ARM_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<)
|
||||
@echo $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<)
|
||||
$(V1) $(CC) -c $$(ASFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
define COMPILE_C_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_COMPILING) $$(call toprel, $$<)
|
||||
@echo $(MSG_COMPILING) $$(call toprel, $$<)
|
||||
$(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$(CPPFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Compile: create object files from C source files. ARM-only
|
||||
define COMPILE_C_ARM_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_COMPILING_ARM) $$(call toprel, $$<)
|
||||
@echo $(MSG_COMPILING_ARM) $$(call toprel, $$<)
|
||||
$(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$(CPPFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
define COMPILE_CXX_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_COMPILINGCXX) $$(call toprel, $$<)
|
||||
@echo $(MSG_COMPILINGCXX) $$(call toprel, $$<)
|
||||
$(V1) $(CXX) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Compile: create object files from C++ source files. ARM-only
|
||||
define COMPILE_CXX_ARM_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@$(ECHO) $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<)
|
||||
@echo $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<)
|
||||
$(V1) $(CPP) -c $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
@ -203,7 +204,7 @@ define ARCHIVE_TEMPLATE
|
||||
.SECONDARY : $(1)
|
||||
.PRECIOUS : $(2)
|
||||
$(1): $(2)
|
||||
@$(ECHO) $(MSG_ARCHIVING) $$(call toprel, $$@)
|
||||
@echo $(MSG_ARCHIVING) $$(call toprel, $$@)
|
||||
ifeq ($(3),)
|
||||
$(V1) $(AR) rcs $$@ $(2)
|
||||
else
|
||||
@ -227,7 +228,7 @@ define LINK_TEMPLATE
|
||||
.SECONDARY : $(1)
|
||||
.PRECIOUS : $(2) $(3)
|
||||
$(1): $(2) $(3)
|
||||
@$(ECHO) $(MSG_LINKING) $$(call toprel, $$@)
|
||||
@echo $(MSG_LINKING) $$(call toprel, $$@)
|
||||
$(V1) $(CC) $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
|
||||
endef
|
||||
|
||||
@ -238,21 +239,21 @@ define LINK_CXX_TEMPLATE
|
||||
.SECONDARY : $(1)
|
||||
.PRECIOUS : $(2) $(3)
|
||||
$(1): $(2) $(3)
|
||||
@$(ECHO) $(MSG_LINKING) $$(call toprel, $$@)
|
||||
@echo $(MSG_LINKING) $$(call toprel, $$@)
|
||||
$(V1) $(CXX) $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
|
||||
endef
|
||||
|
||||
# Compile: create assembler files from C source files. ARM/Thumb
|
||||
define PARTIAL_COMPILE_TEMPLATE
|
||||
$($(1):.c=.s) : %.s : %.c
|
||||
@$(ECHO) $(MSG_ASMFROMC) $$(call toprel, $$<)
|
||||
@echo $(MSG_ASMFROMC) $$(call toprel, $$<)
|
||||
$(V1) $(CC) $(THUMB) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
# Compile: create assembler files from C source files. ARM only
|
||||
define PARTIAL_COMPILE_ARM_TEMPLATE
|
||||
$($(1):.c=.s) : %.s : %.c
|
||||
@$(ECHO) $(MSG_ASMFROMC_ARM) $$(call toprel, $$<)
|
||||
@echo $(MSG_ASMFROMC_ARM) $$(call toprel, $$<)
|
||||
$(V1) $(CC) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||
endef
|
||||
|
||||
@ -269,7 +270,7 @@ define JTAG_TEMPLATE
|
||||
# debug level
|
||||
OOCD_JTAG_SETUP = -d0
|
||||
# interface and board/target settings (using the OOCD target-library here)
|
||||
OOCD_JTAG_SETUP += -s $(ROOT_DIR)/flight/Project/OpenOCD
|
||||
OOCD_JTAG_SETUP += -s $(FLIGHT_ROOT_DIR)/Project/OpenOCD
|
||||
OOCD_JTAG_SETUP += -f $(4) -f $(5)
|
||||
|
||||
# initialize
|
||||
@ -281,7 +282,7 @@ OOCD_BOARD_RESET += -c "reset halt"
|
||||
|
||||
.PHONY: program
|
||||
program: $(1)
|
||||
@$(ECHO) $(MSG_JTAG_PROGRAM) $$(call toprel, $$<)
|
||||
@echo $(MSG_JTAG_PROGRAM) $$(call toprel, $$<)
|
||||
$(V1) $(OPENOCD) \
|
||||
$$(OOCD_JTAG_SETUP) \
|
||||
$$(OOCD_BOARD_RESET) \
|
||||
@ -292,7 +293,7 @@ program: $(1)
|
||||
|
||||
.PHONY: wipe
|
||||
wipe:
|
||||
@$(ECHO) $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2)
|
||||
@echo $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2)
|
||||
$(V1) $(OPENOCD) \
|
||||
$$(OOCD_JTAG_SETUP) \
|
||||
$$(OOCD_BOARD_RESET) \
|
@ -8,7 +8,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file actuator.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Actuator module. Drives the actuators (servos, motors etc).
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -85,8 +86,6 @@ static xTaskHandle taskHandle;
|
||||
static FrameType_t frameType = FRAME_TYPE_MULTIROTOR;
|
||||
static SystemSettingsThrustControlOptions thrustType = SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE;
|
||||
|
||||
static float lastResult[MAX_MIX_ACTUATORS] = { 0 };
|
||||
static float filterAccumulator[MAX_MIX_ACTUATORS] = { 0 };
|
||||
static uint8_t pinsMode[MAX_MIX_ACTUATORS];
|
||||
// used to inform the actuator thread that actuator update rate is changed
|
||||
static ActuatorSettingsData actuatorSettings;
|
||||
@ -110,7 +109,7 @@ static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev);
|
||||
static void SettingsUpdatedCb(UAVObjEvent *ev);
|
||||
float ProcessMixer(const int index, const float curve1, const float curve2,
|
||||
ActuatorDesiredData *desired,
|
||||
const float period, bool multirotor);
|
||||
bool multirotor, bool fixedwing);
|
||||
|
||||
// this structure is equivalent to the UAVObjects for one mixer.
|
||||
typedef struct {
|
||||
@ -195,7 +194,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
UAVObjEvent ev;
|
||||
portTickType lastSysTime;
|
||||
portTickType thisSysTime;
|
||||
float dTSeconds;
|
||||
uint32_t dTMilliseconds;
|
||||
|
||||
ActuatorCommandData command;
|
||||
@ -245,7 +243,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
thisSysTime = xTaskGetTickCount();
|
||||
dTMilliseconds = (thisSysTime == lastSysTime) ? 1 : (thisSysTime - lastSysTime) * portTICK_RATE_MS;
|
||||
lastSysTime = thisSysTime;
|
||||
dTSeconds = dTMilliseconds * 0.001f;
|
||||
|
||||
FlightStatusGet(&flightStatus);
|
||||
FlightModeSettingsGet(&settings);
|
||||
@ -271,6 +268,7 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
bool activeThrottle = (throttleDesired < -0.001f || throttleDesired > 0.001f); // for ground and reversible motors
|
||||
bool positiveThrottle = (throttleDesired > 0.00f);
|
||||
bool multirotor = (GetCurrentFrameType() == FRAME_TYPE_MULTIROTOR); // check if frame is a multirotor.
|
||||
bool fixedwing = (GetCurrentFrameType() == FRAME_TYPE_FIXED_WING); // check if frame is a fixedwing.
|
||||
bool alwaysArmed = settings.Arming == FLIGHTMODESETTINGS_ARMING_ALWAYSARMED;
|
||||
bool AlwaysStabilizeWhenArmed = settings.AlwaysStabilizeWhenArmed == FLIGHTMODESETTINGS_ALWAYSSTABILIZEWHENARMED_TRUE;
|
||||
|
||||
@ -406,12 +404,10 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
nonreversible_curve2 = 0.0f;
|
||||
}
|
||||
}
|
||||
status[ct] = ProcessMixer(ct, nonreversible_curve1, nonreversible_curve2, &desired, dTSeconds, multirotor);
|
||||
status[ct] = ProcessMixer(ct, nonreversible_curve1, nonreversible_curve2, &desired, multirotor, fixedwing);
|
||||
// If not armed or motors aren't meant to spin all the time
|
||||
if (!armed ||
|
||||
(!spinWhileArmed && !positiveThrottle)) {
|
||||
filterAccumulator[ct] = 0;
|
||||
lastResult[ct] = 0;
|
||||
status[ct] = -1; // force min throttle
|
||||
}
|
||||
// If armed meant to keep spinning,
|
||||
@ -424,16 +420,14 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
}
|
||||
}
|
||||
} else if (mixer_type == MIXERSETTINGS_MIXER1TYPE_REVERSABLEMOTOR) {
|
||||
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, dTSeconds, multirotor);
|
||||
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, multirotor, fixedwing);
|
||||
// Reversable Motors are like Motors but go to neutral instead of minimum
|
||||
// If not armed or motor is inactive - no "spinwhilearmed" for this engine type
|
||||
if (!armed || !activeThrottle) {
|
||||
filterAccumulator[ct] = 0;
|
||||
lastResult[ct] = 0;
|
||||
status[ct] = 0; // force neutral throttle
|
||||
}
|
||||
} else if (mixer_type == MIXERSETTINGS_MIXER1TYPE_SERVO) {
|
||||
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, dTSeconds, multirotor);
|
||||
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, multirotor, fixedwing);
|
||||
} else {
|
||||
status[ct] = -1;
|
||||
|
||||
@ -555,56 +549,43 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
|
||||
* Process mixing for one actuator
|
||||
*/
|
||||
float ProcessMixer(const int index, const float curve1, const float curve2,
|
||||
ActuatorDesiredData *desired, const float period, bool multirotor)
|
||||
ActuatorDesiredData *desired, bool multirotor, bool fixedwing)
|
||||
{
|
||||
static float lastFilteredResult[MAX_MIX_ACTUATORS];
|
||||
const Mixer_t *mixers = (Mixer_t *)&mixerSettings.Mixer1Type; // pointer to array of mixers in UAVObjects
|
||||
const Mixer_t *mixer = &mixers[index];
|
||||
float differential = 1.0f;
|
||||
|
||||
// Apply differential only for fixedwing and Roll servos
|
||||
if (fixedwing && (mixerSettings.FirstRollServo > 0) &&
|
||||
(mixer->type == MIXERSETTINGS_MIXER1TYPE_SERVO) &&
|
||||
(mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL] != 0)) {
|
||||
// Positive differential
|
||||
if (mixerSettings.RollDifferential > 0) {
|
||||
// Check for first Roll servo (should be left aileron or elevon) and Roll desired (positive/negative)
|
||||
if (((index == mixerSettings.FirstRollServo - 1) && (desired->Roll > 0.0f))
|
||||
|| ((index != mixerSettings.FirstRollServo - 1) && (desired->Roll < 0.0f))) {
|
||||
differential -= (mixerSettings.RollDifferential * 0.01f);
|
||||
}
|
||||
} else if (mixerSettings.RollDifferential < 0) {
|
||||
if (((index == mixerSettings.FirstRollServo - 1) && (desired->Roll < 0.0f))
|
||||
|| ((index != mixerSettings.FirstRollServo - 1) && (desired->Roll > 0.0f))) {
|
||||
differential -= (-mixerSettings.RollDifferential * 0.01f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float result = ((((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_THROTTLECURVE1]) * curve1) +
|
||||
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_THROTTLECURVE2]) * curve2) +
|
||||
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL]) * desired->Roll) +
|
||||
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL]) * desired->Roll * differential) +
|
||||
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_PITCH]) * desired->Pitch) +
|
||||
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_YAW]) * desired->Yaw)) / 128.0f;
|
||||
|
||||
// note: no feedforward for reversable motors yet for safety reasons
|
||||
if (mixer->type == MIXERSETTINGS_MIXER1TYPE_MOTOR) {
|
||||
if (!multirotor) { // we allow negative throttle with a multirotor
|
||||
if (result < 0.0f) { // zero throttle
|
||||
result = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// feed forward
|
||||
float accumulator = filterAccumulator[index];
|
||||
accumulator += (result - lastResult[index]) * mixerSettings.FeedForward;
|
||||
lastResult[index] = result;
|
||||
result += accumulator;
|
||||
if (period > 0.0f) {
|
||||
if (accumulator > 0.0f) {
|
||||
float invFilter = period / mixerSettings.AccelTime;
|
||||
if (invFilter > 1) {
|
||||
invFilter = 1;
|
||||
}
|
||||
accumulator -= accumulator * invFilter;
|
||||
} else {
|
||||
float invFilter = period / mixerSettings.DecelTime;
|
||||
if (invFilter > 1) {
|
||||
invFilter = 1;
|
||||
}
|
||||
accumulator -= accumulator * invFilter;
|
||||
}
|
||||
}
|
||||
filterAccumulator[index] = accumulator;
|
||||
result += accumulator;
|
||||
|
||||
// acceleration limit
|
||||
float dt = result - lastFilteredResult[index];
|
||||
float maxDt = mixerSettings.MaxAccel * period;
|
||||
if (dt > maxDt) { // we are accelerating too hard
|
||||
result = lastFilteredResult[index] + maxDt;
|
||||
}
|
||||
lastFilteredResult[index] = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -706,51 +687,74 @@ static int16_t scaleChannel(float value, int16_t max, int16_t min, int16_t neutr
|
||||
return valueScaled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move and compress all motor outputs so that none goes below neutral,
|
||||
* and all motors are below or equal to max.
|
||||
*/
|
||||
static inline int16_t scaleMotorMoveAndCompress(float valueMotor, int16_t max, int16_t neutral, float maxMotor, float minMotor)
|
||||
{
|
||||
// The valueMotor parameter is the desired motor value somewhere in the
|
||||
// [minMotor, maxMotor] range, which is [< -1.00, > 1.00].
|
||||
//
|
||||
// Before converting valueMotor to the [neutral, max] range, we scale
|
||||
// valueMotor to a value in the [0.0f, 1.0f] range.
|
||||
//
|
||||
// This is done by, first, conceptually moving all three values valueMotor,
|
||||
// minMotor, and maxMotor, equally so that the [minMotor, maxMotor] range,
|
||||
// are contained or overlaps with the [0.0f, 1.0f] range.
|
||||
//
|
||||
// Then if the [minMotor, maxMotor] range is larger than 1.0f, the values
|
||||
// are compressed enough to shrink the [minMotor + move, maxMotor + move]
|
||||
// range to fit within the [0.0f, 1.0f] range.
|
||||
|
||||
// First move the values so that the source range [minMotor, maxMotor]
|
||||
// covers the target range [0.0f, 1.0f] as much as possible.
|
||||
float moveValue = 0.0f;
|
||||
|
||||
if (minMotor <= 0.0f) {
|
||||
// Negative minMotor always adjust to 0.
|
||||
moveValue = -minMotor;
|
||||
} else if (maxMotor > 1.0f) {
|
||||
// A too large maxMotor value adjust the range down towards, but not past, the minMotor value.
|
||||
float beyondMax = maxMotor - 1.0f;
|
||||
moveValue = -(beyondMax < minMotor ? beyondMax : minMotor);
|
||||
}
|
||||
|
||||
// Then calculate the compress value, if the source range is greater than 1.0f.
|
||||
float compressValue = 1.0f;
|
||||
|
||||
float rangeMotor = maxMotor - minMotor;
|
||||
if (rangeMotor > 1.0f) {
|
||||
compressValue = rangeMotor;
|
||||
}
|
||||
|
||||
// Combine the movement and compression, to get the value within [0.0f, 1.0f]
|
||||
float movedAndCompressedValue = (valueMotor + moveValue) / compressValue;
|
||||
|
||||
// And last, convert the value into the [neutral, max] range.
|
||||
int16_t valueScaled = movedAndCompressedValue * ((float)(max - neutral)) + neutral;
|
||||
|
||||
if (valueScaled > max) {
|
||||
valueScaled = max; // clamp to max value only after scaling is done.
|
||||
}
|
||||
|
||||
PIOS_Assert(valueScaled >= neutral);
|
||||
|
||||
return valueScaled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrain motor values to keep any one motor value from going too far out of range of another motor
|
||||
*/
|
||||
static int16_t scaleMotor(float value, int16_t max, int16_t min, int16_t neutral, float maxMotor, float minMotor, bool armed, bool AlwaysStabilizeWhenArmed, float throttleDesired)
|
||||
{
|
||||
int16_t valueScaled;
|
||||
int16_t maxMotorScaled;
|
||||
int16_t minMotorScaled;
|
||||
int16_t diff;
|
||||
|
||||
// Scale
|
||||
valueScaled = (int16_t)(value * ((float)(max - neutral))) + neutral;
|
||||
maxMotorScaled = (int16_t)(maxMotor * ((float)(max - neutral))) + neutral;
|
||||
minMotorScaled = (int16_t)(minMotor * ((float)(max - neutral))) + neutral;
|
||||
|
||||
|
||||
if (max > min) {
|
||||
diff = max - maxMotorScaled; // difference between max allowed and actual max motor
|
||||
if (diff < 0) { // if the difference is smaller than 0 we add it to the scaled value
|
||||
valueScaled += diff;
|
||||
}
|
||||
diff = neutral - minMotorScaled; // difference between min allowed and actual min motor
|
||||
if (diff > 0) { // if the difference is larger than 0 we add it to the scaled value
|
||||
valueScaled += diff;
|
||||
}
|
||||
// todo: make this flow easier to understand
|
||||
if (valueScaled > max) {
|
||||
valueScaled = max; // clamp to max value only after scaling is done.
|
||||
}
|
||||
|
||||
if ((valueScaled < neutral) && (spinWhileArmed) && AlwaysStabilizeWhenArmed) {
|
||||
valueScaled = neutral; // clamp to neutral value only after scaling is done.
|
||||
} else if ((valueScaled < neutral) && (!spinWhileArmed) && AlwaysStabilizeWhenArmed) {
|
||||
valueScaled = neutral; // clamp to neutral value only after scaling is done. //throttle goes to min if throttledesired is equal to or less than 0 below
|
||||
} else if (valueScaled < neutral) {
|
||||
valueScaled = min; // clamp to min value only after scaling is done.
|
||||
}
|
||||
valueScaled = scaleMotorMoveAndCompress(value, max, neutral, maxMotor, minMotor);
|
||||
} else {
|
||||
// not sure what to do about reversed polarity right now. Why would anyone do this?
|
||||
if (valueScaled < max) {
|
||||
valueScaled = max; // clamp to max value only after scaling is done.
|
||||
}
|
||||
if (valueScaled > min) {
|
||||
valueScaled = min; // clamp to min value only after scaling is done.
|
||||
}
|
||||
valueScaled = scaleChannel(value, max, min, neutral);
|
||||
}
|
||||
|
||||
// I've added the bool AlwaysStabilizeWhenArmed to this function. Right now we command the motors at min or a range between neutral and max.
|
||||
|
@ -39,7 +39,6 @@ class PIDControlNE {
|
||||
public:
|
||||
PIDControlNE();
|
||||
~PIDControlNE();
|
||||
void Initialize();
|
||||
void Deactivate();
|
||||
void Activate();
|
||||
void UpdateParameters(float kp, float ki, float kd, __attribute__((unused)) float ilimit, float dT, float velocityMax);
|
||||
|
@ -47,13 +47,24 @@ extern "C" {
|
||||
|
||||
PIDControlNE::PIDControlNE()
|
||||
: deltaTime(0), mNECommand(0), mNeutral(0), mVelocityMax(0), mMinCommand(0), mMaxCommand(0), mVelocityFeedforward(0), mActive(false)
|
||||
{}
|
||||
{
|
||||
memset((void *)PIDvel, 0, 2 * sizeof(pid2));
|
||||
memset((void *)PIDposH, 0, 2 * sizeof(pid));
|
||||
|
||||
mVelocitySetpointTarget[0] = 0.0f;
|
||||
mVelocitySetpointTarget[1] = 0.0f;
|
||||
mVelocityState[0] = 0.0f;
|
||||
mVelocityState[1] = 0.0f;
|
||||
mPositionSetpointTarget[0] = 0.0f;
|
||||
mPositionSetpointTarget[1] = 0.0f;
|
||||
mPositionState[0] = 0.0f;
|
||||
mPositionState[1] = 0.0f;
|
||||
mVelocitySetpointCurrent[0] = 0.0f;
|
||||
mVelocitySetpointCurrent[1] = 0.0f;
|
||||
}
|
||||
|
||||
PIDControlNE::~PIDControlNE() {}
|
||||
|
||||
void PIDControlNE::Initialize()
|
||||
{}
|
||||
|
||||
void PIDControlNE::Deactivate()
|
||||
{
|
||||
mActive = false;
|
||||
@ -62,6 +73,10 @@ void PIDControlNE::Deactivate()
|
||||
void PIDControlNE::Activate()
|
||||
{
|
||||
mActive = true;
|
||||
pid2_transfer(&PIDvel[0], 0.0f);
|
||||
pid2_transfer(&PIDvel[1], 0.0f);
|
||||
pid_zero(&PIDposH[0]);
|
||||
pid_zero(&PIDposH[1]);
|
||||
}
|
||||
|
||||
void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, float dT, float velocityMax)
|
||||
|
@ -84,6 +84,7 @@ void VtolFlyController::Activate(void)
|
||||
mManualThrust = false;
|
||||
SettingsUpdated();
|
||||
controlDown.Activate();
|
||||
controlNE.UpdateVelocitySetpoint(0.0f, 0.0f);
|
||||
controlNE.Activate();
|
||||
mMode = pathDesired->Mode;
|
||||
|
||||
@ -175,8 +176,6 @@ void VtolFlyController::UpdateVelocityDesired()
|
||||
|
||||
VelocityStateData velocityState;
|
||||
VelocityStateGet(&velocityState);
|
||||
controlNE.UpdateVelocityState(velocityState.North, velocityState.East);
|
||||
controlDown.UpdateVelocityState(velocityState.Down);
|
||||
|
||||
VelocityDesiredData velocityDesired;
|
||||
|
||||
@ -192,6 +191,9 @@ void VtolFlyController::UpdateVelocityDesired()
|
||||
controlDown.ControlPositionWithPath(&progress);
|
||||
}
|
||||
|
||||
controlNE.UpdateVelocityState(velocityState.North, velocityState.East);
|
||||
controlDown.UpdateVelocityState(velocityState.Down);
|
||||
|
||||
float north, east;
|
||||
controlNE.GetVelocityDesired(&north, &east);
|
||||
velocityDesired.North = north;
|
||||
@ -368,10 +370,12 @@ void VtolFlyController::UpdateAutoPilot()
|
||||
// to the pathDesired to initiate a Landing sequence. This is the simpliest approach. plans.c
|
||||
// can't manage this. And pathplanner whilst similar does not manage this as it is not a
|
||||
// waypoint traversal and is not aware of flight modes other than path plan.
|
||||
if ((uint8_t)pathDesired->ModeParameters[PATHDESIRED_MODEPARAMETER_GOTOENDPOINT_NEXTCOMMAND] == FLIGHTMODESETTINGS_RETURNTOBASENEXTCOMMAND_LAND) {
|
||||
if (pathStatus->fractional_progress > RTB_LAND_FRACTIONAL_PROGRESS_START_CHECKS) {
|
||||
if (fabsf(pathStatus->correction_direction_north) < RTB_LAND_NE_DISTANCE_REQUIRED_TO_START_LAND_SEQUENCE && fabsf(pathStatus->correction_direction_east) < RTB_LAND_NE_DISTANCE_REQUIRED_TO_START_LAND_SEQUENCE) {
|
||||
plan_setup_land();
|
||||
if (flightStatus->FlightMode == FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE) {
|
||||
if ((uint8_t)pathDesired->ModeParameters[PATHDESIRED_MODEPARAMETER_GOTOENDPOINT_NEXTCOMMAND] == FLIGHTMODESETTINGS_RETURNTOBASENEXTCOMMAND_LAND) {
|
||||
if (pathStatus->fractional_progress > RTB_LAND_FRACTIONAL_PROGRESS_START_CHECKS) {
|
||||
if (fabsf(pathStatus->correction_direction_north) < RTB_LAND_NE_DISTANCE_REQUIRED_TO_START_LAND_SEQUENCE && fabsf(pathStatus->correction_direction_east) < RTB_LAND_NE_DISTANCE_REQUIRED_TO_START_LAND_SEQUENCE) {
|
||||
plan_setup_land();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,8 @@
|
||||
* pass it to ManualControl
|
||||
*
|
||||
* @file receiver.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @brief Receiver module. Handles safety R/C link and flight mode.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -68,7 +69,7 @@
|
||||
// safe band to allow a bit of calibration error or trim offset (in microseconds)
|
||||
#define CONNECTION_OFFSET 250
|
||||
|
||||
#define ASSISTEDCONTROL_DEADBAND_MINIMUM 0.02f // minimum value for a well bahaved Tx.
|
||||
#define ASSISTEDCONTROL_DEADBAND_MINIMUM 2 // minimum value for a well bahaved Tx, in percent.
|
||||
|
||||
// Private types
|
||||
|
||||
@ -87,7 +88,7 @@ static void receiverTask(void *parameters);
|
||||
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral);
|
||||
static uint32_t timeDifferenceMs(portTickType start_time, portTickType end_time);
|
||||
static bool validInputRange(int16_t min, int16_t max, uint16_t value);
|
||||
static void applyDeadband(float *value, float deadband);
|
||||
static void applyDeadband(float *value, uint8_t deadband);
|
||||
static void SettingsUpdatedCb(UAVObjEvent *ev);
|
||||
|
||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
@ -95,7 +96,7 @@ static uint8_t isAssistedFlightMode(uint8_t position);
|
||||
#endif
|
||||
|
||||
#ifdef USE_INPUT_LPF
|
||||
static void applyLPF(float *value, ManualControlSettingsResponseTimeElem channel, ManualControlSettingsResponseTimeData *responseTime, float deadband, float dT);
|
||||
static void applyLPF(float *value, ManualControlSettingsResponseTimeElem channel, ManualControlSettingsResponseTimeData *responseTime, uint8_t deadband, float dT);
|
||||
#endif
|
||||
|
||||
#define RCVR_ACTIVITY_MONITOR_CHANNELS_PER_GROUP 12
|
||||
@ -206,6 +207,7 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
// this includes not even registering it if not used
|
||||
AccessoryDesiredCreateInstance();
|
||||
AccessoryDesiredCreateInstance();
|
||||
AccessoryDesiredCreateInstance();
|
||||
|
||||
// Whenever the configuration changes, make sure it is safe to fly
|
||||
|
||||
@ -377,6 +379,10 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
valid_input_detected &= validInputRange(settings.ChannelMin.Accessory2,
|
||||
settings.ChannelMax.Accessory2, cmd.Channel[MANUALCONTROLSETTINGS_CHANNELGROUPS_ACCESSORY2]);
|
||||
}
|
||||
if (settings.ChannelGroups.Accessory3 != MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE) {
|
||||
valid_input_detected &= validInputRange(settings.ChannelMin.Accessory3,
|
||||
settings.ChannelMax.Accessory3, cmd.Channel[MANUALCONTROLSETTINGS_CHANNELGROUPS_ACCESSORY3]);
|
||||
}
|
||||
|
||||
// Implement hysteresis loop on connection status
|
||||
if (valid_input_detected && (++connected_count > 10)) {
|
||||
@ -436,6 +442,13 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_RECEIVER, SYSTEMALARMS_ALARM_WARNING);
|
||||
}
|
||||
}
|
||||
// Set Accessory 3
|
||||
if (settings.ChannelGroups.Accessory3 != MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE) {
|
||||
accessory.AccessoryVal = settings.FailsafeChannel.Accessory3;
|
||||
if (AccessoryDesiredInstSet(3, &accessory) != 0) {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_RECEIVER, SYSTEMALARMS_ALARM_WARNING);
|
||||
}
|
||||
}
|
||||
} else if (valid_input_detected) {
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_RECEIVER);
|
||||
|
||||
@ -450,7 +463,7 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
cmd.FlightModeSwitchPosition = settings.FlightModeNumber - 1;
|
||||
}
|
||||
|
||||
float deadband_checked = settings.Deadband;
|
||||
uint8_t deadband_checked = settings.Deadband;
|
||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
// AssistedControl must have deadband set for pitch/roll hence
|
||||
// we default to a higher value for badly behaved TXs and also enforce a minimum value
|
||||
@ -470,7 +483,7 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
#endif // PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
|
||||
// Apply deadband for Roll/Pitch/Yaw stick inputs
|
||||
if (deadband_checked > 0.0f) {
|
||||
if (deadband_checked > 0) {
|
||||
applyDeadband(&cmd.Roll, deadband_checked);
|
||||
applyDeadband(&cmd.Pitch, deadband_checked);
|
||||
applyDeadband(&cmd.Yaw, deadband_checked);
|
||||
@ -494,7 +507,7 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
&& cmd.Channel[MANUALCONTROLSETTINGS_CHANNELGROUPS_COLLECTIVE] != (uint16_t)PIOS_RCVR_NODRIVER
|
||||
&& cmd.Channel[MANUALCONTROLSETTINGS_CHANNELGROUPS_COLLECTIVE] != (uint16_t)PIOS_RCVR_TIMEOUT) {
|
||||
cmd.Collective = scaledChannel[MANUALCONTROLSETTINGS_CHANNELGROUPS_COLLECTIVE];
|
||||
if (settings.Deadband > 0.0f) {
|
||||
if (settings.Deadband > 0) {
|
||||
applyDeadband(&cmd.Collective, settings.Deadband);
|
||||
}
|
||||
#ifdef USE_INPUT_LPF
|
||||
@ -545,6 +558,17 @@ static void receiverTask(__attribute__((unused)) void *parameters)
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_RECEIVER, SYSTEMALARMS_ALARM_WARNING);
|
||||
}
|
||||
}
|
||||
// Set Accessory 3
|
||||
if (settings.ChannelGroups.Accessory3 != MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE) {
|
||||
accessory.AccessoryVal = scaledChannel[MANUALCONTROLSETTINGS_CHANNELGROUPS_ACCESSORY3];
|
||||
#ifdef USE_INPUT_LPF
|
||||
applyLPF(&accessory.AccessoryVal, MANUALCONTROLSETTINGS_RESPONSETIME_ACCESSORY3, &settings.ResponseTime, settings.Deadband, dT);
|
||||
#endif
|
||||
|
||||
if (AccessoryDesiredInstSet(3, &accessory) != 0) {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_RECEIVER, SYSTEMALARMS_ALARM_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update cmd object
|
||||
@ -790,14 +814,16 @@ bool validInputRange(int16_t min, int16_t max, uint16_t value)
|
||||
/**
|
||||
* @brief Apply deadband to Roll/Pitch/Yaw channels
|
||||
*/
|
||||
static void applyDeadband(float *value, float deadband)
|
||||
static void applyDeadband(float *value, uint8_t deadband)
|
||||
{
|
||||
if (fabsf(*value) < deadband) {
|
||||
float floatDeadband = ((float)deadband) * 0.01f;
|
||||
|
||||
if (fabsf(*value) < floatDeadband) {
|
||||
*value = 0.0f;
|
||||
} else if (*value > 0.0f) {
|
||||
*value = (*value - deadband) / (1.0f - deadband);
|
||||
*value = (*value - floatDeadband) / (1.0f - floatDeadband);
|
||||
} else {
|
||||
*value = (*value + deadband) / (1.0f - deadband);
|
||||
*value = (*value + floatDeadband) / (1.0f - floatDeadband);
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,16 +831,17 @@ static void applyDeadband(float *value, float deadband)
|
||||
/**
|
||||
* @brief Apply Low Pass Filter to Throttle/Roll/Pitch/Yaw or Accessory channel
|
||||
*/
|
||||
static void applyLPF(float *value, ManualControlSettingsResponseTimeElem channel, ManualControlSettingsResponseTimeData *responseTime, float deadband, float dT)
|
||||
static void applyLPF(float *value, ManualControlSettingsResponseTimeElem channel, ManualControlSettingsResponseTimeData *responseTime, uint8_t deadband, float dT)
|
||||
{
|
||||
float rt = (float)ManualControlSettingsResponseTimeToArray((*responseTime))[channel];
|
||||
|
||||
if (rt > 0.0f) {
|
||||
inputFiltered[channel] = ((rt * inputFiltered[channel]) + (dT * (*value))) / (rt + dT);
|
||||
|
||||
float floatDeadband = ((float)deadband) * 0.01f;
|
||||
// avoid a long tail of non-zero data. if we have deadband, once the filtered result reduces to 1/10th
|
||||
// of deadband revert to 0. We downstream rely on this to know when sticks are centered.
|
||||
if (deadband > 0.0f && fabsf(inputFiltered[channel]) < deadband / 10.0f) {
|
||||
if (floatDeadband > 0.0f && fabsf(inputFiltered[channel]) < floatDeadband * 0.1f) {
|
||||
inputFiltered[channel] = 0.0f;
|
||||
}
|
||||
*value = inputFiltered[channel];
|
||||
|
@ -45,6 +45,8 @@ typedef struct {
|
||||
StabilizationSettingsData settings;
|
||||
StabilizationBankData stabBank;
|
||||
float gyro_alpha;
|
||||
float floatThrustPIDScaleCurve[STABILIZATIONBANK_THRUSTPIDSCALECURVE_NUMELEM];
|
||||
float acroInsanityFactors[STABILIZATIONBANK_ACROINSANITYFACTOR_NUMELEM];
|
||||
struct {
|
||||
float min_thrust;
|
||||
float max_thrust;
|
||||
|
@ -9,7 +9,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file innerloop.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @brief Attitude stabilization module.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -151,11 +152,11 @@ static pid_scaler create_pid_scaler(int axis)
|
||||
const pid_curve_scaler curve_scaler = {
|
||||
.x = get_pid_scale_source_value(),
|
||||
.points = {
|
||||
{ 0.00f, stabSettings.stabBank.ThrustPIDScaleCurve[0] },
|
||||
{ 0.25f, stabSettings.stabBank.ThrustPIDScaleCurve[1] },
|
||||
{ 0.50f, stabSettings.stabBank.ThrustPIDScaleCurve[2] },
|
||||
{ 0.75f, stabSettings.stabBank.ThrustPIDScaleCurve[3] },
|
||||
{ 1.00f, stabSettings.stabBank.ThrustPIDScaleCurve[4] }
|
||||
{ 0.00f, stabSettings.floatThrustPIDScaleCurve[0] },
|
||||
{ 0.25f, stabSettings.floatThrustPIDScaleCurve[1] },
|
||||
{ 0.50f, stabSettings.floatThrustPIDScaleCurve[2] },
|
||||
{ 0.75f, stabSettings.floatThrustPIDScaleCurve[3] },
|
||||
{ 1.00f, stabSettings.floatThrustPIDScaleCurve[4] }
|
||||
}
|
||||
};
|
||||
|
||||
@ -301,10 +302,11 @@ static void stabilizationInnerloopTask()
|
||||
-StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t],
|
||||
StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t]
|
||||
);
|
||||
|
||||
pid_scaler ascaler = create_pid_scaler(t);
|
||||
ascaler.i *= boundf(1.0f - (1.5f * fabsf(stickinput[t])), 0.0f, 1.0f); // this prevents Integral from getting too high while controlled manually
|
||||
float arate = pid_apply_setpoint(&stabSettings.innerPids[t], &ascaler, rate[t], gyro_filtered[t], dT);
|
||||
float factor = fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor;
|
||||
float factor = fabsf(stickinput[t]) * stabSettings.acroInsanityFactors[t];
|
||||
actuatorDesiredAxis[t] = factor * stickinput[t] + (1.0f - factor) * arate;
|
||||
}
|
||||
break;
|
||||
|
@ -9,7 +9,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file outerloop.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @brief Attitude stabilization module.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -105,8 +106,9 @@ static void stabilizationOuterloopTask()
|
||||
int t;
|
||||
float dT = PIOS_DELTATIME_GetAverageSeconds(&timeval);
|
||||
StabilizationStatusOuterLoopOptions newThrustMode = StabilizationStatusOuterLoopToArray(enabled)[STABILIZATIONSTATUS_OUTERLOOP_THRUST];
|
||||
|
||||
bool reinit = (newThrustMode != previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST]);
|
||||
|
||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
// Trigger a disable message to the alt hold on reinit to prevent that loop from running when not in use.
|
||||
if (reinit) {
|
||||
if (previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST] == STABILIZATIONSTATUS_OUTERLOOP_ALTITUDE ||
|
||||
@ -117,17 +119,20 @@ static void stabilizationOuterloopTask()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// update previous mode
|
||||
previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = newThrustMode;
|
||||
|
||||
// calculate the thrust desired
|
||||
switch (newThrustMode) {
|
||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
case STABILIZATIONSTATUS_OUTERLOOP_ALTITUDE:
|
||||
rateDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = stabilizationAltitudeHold(stabilizationDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST], ALTITUDEHOLD, reinit);
|
||||
break;
|
||||
case STABILIZATIONSTATUS_OUTERLOOP_ALTITUDEVARIO:
|
||||
rateDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = stabilizationAltitudeHold(stabilizationDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST], ALTITUDEVARIO, reinit);
|
||||
break;
|
||||
#endif
|
||||
case STABILIZATIONSTATUS_OUTERLOOP_DIRECT:
|
||||
case STABILIZATIONSTATUS_OUTERLOOP_DIRECTWITHLIMITS:
|
||||
default:
|
||||
|
@ -341,6 +341,14 @@ static void BankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||
&& tps_for_pid[pid];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < STABILIZATIONSETTINGSBANK1_THRUSTPIDSCALECURVE_NUMELEM; i++) {
|
||||
stabSettings.floatThrustPIDScaleCurve[i] = (float)(stabSettings.stabBank.ThrustPIDScaleCurve[i]) * 0.01f;
|
||||
}
|
||||
|
||||
stabSettings.acroInsanityFactors[0] = (float)(stabSettings.stabBank.AcroInsanityFactor.Roll) * 0.01f;
|
||||
stabSettings.acroInsanityFactors[1] = (float)(stabSettings.stabBank.AcroInsanityFactor.Pitch) * 0.01f;
|
||||
stabSettings.acroInsanityFactors[2] = (float)(stabSettings.stabBank.AcroInsanityFactor.Yaw) * 0.01f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,8 +9,10 @@
|
||||
* @{
|
||||
*
|
||||
* @file telemetry.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
|
||||
* @brief Telemetry module, handles telemetry and UAVObject updates
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -95,6 +97,9 @@
|
||||
#define STATS_UPDATE_PERIOD_MS 4000
|
||||
#define CONNECTION_TIMEOUT_MS 8000
|
||||
|
||||
#ifdef PIOS_INCLUDE_RFM22B
|
||||
#define HAS_RADIO
|
||||
#endif
|
||||
// Private types
|
||||
typedef struct {
|
||||
// Determine port on which to communicate telemetry information
|
||||
@ -111,12 +116,14 @@ typedef struct {
|
||||
// Telemetry stream
|
||||
UAVTalkConnection uavTalkCon;
|
||||
} channelContext;
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
// Main telemetry channel
|
||||
static channelContext localChannel;
|
||||
static int32_t transmitLocalData(uint8_t *data, int32_t length);
|
||||
static void registerLocalObject(UAVObjHandle obj);
|
||||
static uint32_t localPort();
|
||||
static void updateSettings(channelContext *channel);
|
||||
#endif
|
||||
|
||||
// OPLink telemetry channel
|
||||
static channelContext radioChannel;
|
||||
@ -150,7 +157,6 @@ static int32_t setLoggingPeriod(
|
||||
int32_t updatePeriodMs);
|
||||
static void updateTelemetryStats();
|
||||
static void gcsTelemetryStatsUpdated();
|
||||
static void updateSettings(channelContext *channel);
|
||||
|
||||
/**
|
||||
* Initialise the telemetry module
|
||||
@ -159,6 +165,7 @@ static void updateSettings(channelContext *channel);
|
||||
*/
|
||||
int32_t TelemetryStart(void)
|
||||
{
|
||||
#ifdef HAS_RADIO
|
||||
// Only start the local telemetry tasks if needed
|
||||
if (localPort()) {
|
||||
UAVObjIterate(®isterLocalObject);
|
||||
@ -187,7 +194,7 @@ int32_t TelemetryStart(void)
|
||||
PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYRX,
|
||||
localChannel.rxTaskHandle);
|
||||
}
|
||||
|
||||
#endif /* ifdef HAS_RADIO */
|
||||
// Start the telemetry tasks associated with Radio/USB
|
||||
UAVObjIterate(®isterRadioObject);
|
||||
|
||||
@ -229,9 +236,6 @@ void TelemetryInitializeChannel(channelContext *channel)
|
||||
sizeof(UAVObjEvent));
|
||||
#endif /* PIOS_TELEM_PRIORITY_QUEUE */
|
||||
|
||||
// Initialise UAVTalk
|
||||
channel->uavTalkCon = UAVTalkInitialize(&transmitLocalData);
|
||||
|
||||
// Create periodic event that will be used to update the telemetry stats
|
||||
UAVObjEvent ev;
|
||||
memset(&ev, 0, sizeof(UAVObjEvent));
|
||||
@ -267,7 +271,7 @@ int32_t TelemetryInitialize(void)
|
||||
radio_port = PIOS_COM_RF;
|
||||
}
|
||||
#else /* PIOS_INCLUDE_RFM22B */
|
||||
radio_port = 0;
|
||||
radio_port = PIOS_COM_TELEM_RF;
|
||||
#endif /* PIOS_INCLUDE_RFM22B */
|
||||
|
||||
FlightTelemetryStatsInitialize();
|
||||
@ -279,10 +283,9 @@ int32_t TelemetryInitialize(void)
|
||||
// Reset link stats
|
||||
txErrors = 0;
|
||||
txRetries = 0;
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
// Set channel port handlers
|
||||
localChannel.getPort = localPort;
|
||||
radioChannel.getPort = radioPort;
|
||||
|
||||
// Set the local telemetry baud rate
|
||||
updateSettings(&localChannel);
|
||||
@ -295,6 +298,9 @@ int32_t TelemetryInitialize(void)
|
||||
localChannel.uavTalkCon = UAVTalkInitialize(&transmitLocalData);
|
||||
}
|
||||
|
||||
#endif
|
||||
// Set channel port handlers
|
||||
radioChannel.getPort = radioPort;
|
||||
// Initialise channel
|
||||
TelemetryInitializeChannel(&radioChannel);
|
||||
// Initialise UAVTalk
|
||||
@ -304,7 +310,7 @@ int32_t TelemetryInitialize(void)
|
||||
}
|
||||
|
||||
MODULE_INITCALL(TelemetryInitialize, TelemetryStart);
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
/**
|
||||
* Register a new object, adds object to local list and connects the queue depending on the object's
|
||||
* telemetry settings.
|
||||
@ -327,7 +333,7 @@ static void registerLocalObject(UAVObjHandle obj)
|
||||
EV_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
static void registerRadioObject(UAVObjHandle obj)
|
||||
{
|
||||
if (UAVObjIsMetaobject(obj)) {
|
||||
@ -635,7 +641,7 @@ static void telemetryRxTask(void *parameters)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
/**
|
||||
* Determine the port to be used for communication on the telemetry channel
|
||||
* \return com port number
|
||||
@ -644,7 +650,7 @@ static uint32_t localPort()
|
||||
{
|
||||
return PIOS_COM_TELEM_RF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determine the port to be used for communication on the radio channel
|
||||
@ -664,7 +670,7 @@ static uint32_t radioPort()
|
||||
return port;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
/**
|
||||
* Transmit data buffer to the modem or USB port.
|
||||
* \param[in] data Data buffer to send
|
||||
@ -682,7 +688,7 @@ static int32_t transmitLocalData(uint8_t *data, int32_t length)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Transmit data buffer to the radioport.
|
||||
@ -804,9 +810,10 @@ static void updateTelemetryStats()
|
||||
uint32_t timeNow;
|
||||
|
||||
// Get stats
|
||||
UAVTalkGetStats(localChannel.uavTalkCon, &utalkStats, true);
|
||||
UAVTalkAddStats(radioChannel.uavTalkCon, &utalkStats, true);
|
||||
|
||||
UAVTalkGetStats(radioChannel.uavTalkCon, &utalkStats, true);
|
||||
#ifdef HAS_RADIO
|
||||
UAVTalkAddStats(localChannel.uavTalkCon, &utalkStats, true);
|
||||
#endif
|
||||
// Get object data
|
||||
FlightTelemetryStatsGet(&flightStats);
|
||||
GCSTelemetryStatsGet(&gcsStats);
|
||||
@ -888,6 +895,7 @@ static void updateTelemetryStats()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAS_RADIO
|
||||
/**
|
||||
* Update the telemetry settings, called on startup.
|
||||
* FIXME: This should be in the TelemetrySettings object. But objects
|
||||
@ -931,7 +939,7 @@ static void updateSettings(channelContext *channel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* ifdef HAS_RADIO */
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
@ -8,7 +8,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file txpid.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @brief Optional module to tune PID settings using R/C transmitter.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -87,6 +88,7 @@
|
||||
// Private functions
|
||||
static void updatePIDs(UAVObjEvent *ev);
|
||||
static uint8_t update(float *var, float val);
|
||||
static uint8_t updateUint16(uint16_t *var, float val);
|
||||
static uint8_t updateUint8(uint8_t *var, float val);
|
||||
static uint8_t updateInt8(int8_t *var, float val);
|
||||
static float scale(float val, float inMin, float inMax, float outMin, float outMax);
|
||||
@ -218,6 +220,8 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
TxPIDStatusData txpid_status;
|
||||
TxPIDStatusGet(&txpid_status);
|
||||
|
||||
bool easyTuneEnabled = false;
|
||||
|
||||
uint8_t needsUpdateBank = 0;
|
||||
uint8_t needsUpdateStab = 0;
|
||||
uint8_t needsUpdateAtt = 0;
|
||||
@ -252,6 +256,18 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
case TXPIDSETTINGS_PIDS_ROLLRATEKP:
|
||||
needsUpdateBank |= update(&bank.RollRatePID.Kp, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_EASYTUNERATEROLL:
|
||||
easyTuneEnabled = true;
|
||||
needsUpdateBank |= update(&bank.RollRatePID.Kp, value);
|
||||
needsUpdateBank |= update(&bank.RollRatePID.Ki, value * inst.EasyTunePitchRollRateFactors.I);
|
||||
needsUpdateBank |= update(&bank.RollRatePID.Kd, value * inst.EasyTunePitchRollRateFactors.D);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_EASYTUNERATEPITCH:
|
||||
easyTuneEnabled = true;
|
||||
needsUpdateBank |= update(&bank.PitchRatePID.Kp, value);
|
||||
needsUpdateBank |= update(&bank.PitchRatePID.Ki, value * inst.EasyTunePitchRollRateFactors.I);
|
||||
needsUpdateBank |= update(&bank.PitchRatePID.Kd, value * inst.EasyTunePitchRollRateFactors.D);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ROLLRATEKI:
|
||||
needsUpdateBank |= update(&bank.RollRatePID.Ki, value);
|
||||
break;
|
||||
@ -262,7 +278,7 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
needsUpdateBank |= update(&bank.RollRatePID.ILimit, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ROLLRATERESP:
|
||||
needsUpdateBank |= update(&bank.ManualRate.Roll, value);
|
||||
needsUpdateBank |= updateUint16(&bank.ManualRate.Roll, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ROLLATTITUDEKP:
|
||||
needsUpdateBank |= update(&bank.RollPI.Kp, value);
|
||||
@ -289,7 +305,7 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
needsUpdateBank |= update(&bank.PitchRatePID.ILimit, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_PITCHRATERESP:
|
||||
needsUpdateBank |= update(&bank.ManualRate.Pitch, value);
|
||||
needsUpdateBank |= updateUint16(&bank.ManualRate.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_PITCHATTITUDEKP:
|
||||
needsUpdateBank |= update(&bank.PitchPI.Kp, value);
|
||||
@ -320,8 +336,8 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
needsUpdateBank |= update(&bank.PitchRatePID.ILimit, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ROLLPITCHRATERESP:
|
||||
needsUpdateBank |= update(&bank.ManualRate.Roll, value);
|
||||
needsUpdateBank |= update(&bank.ManualRate.Pitch, value);
|
||||
needsUpdateBank |= updateUint16(&bank.ManualRate.Roll, value);
|
||||
needsUpdateBank |= updateUint16(&bank.ManualRate.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ROLLPITCHATTITUDEKP:
|
||||
needsUpdateBank |= update(&bank.RollPI.Kp, value);
|
||||
@ -352,7 +368,7 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
needsUpdateBank |= update(&bank.YawRatePID.ILimit, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_YAWRATERESP:
|
||||
needsUpdateBank |= update(&bank.ManualRate.Yaw, value);
|
||||
needsUpdateBank |= updateUint16(&bank.ManualRate.Yaw, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_YAWATTITUDEKP:
|
||||
needsUpdateBank |= update(&bank.YawPI.Kp, value);
|
||||
@ -382,8 +398,15 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
case TXPIDSETTINGS_PIDS_GYROTAU:
|
||||
needsUpdateStab |= update(&stab.GyroTau, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROPLUSFACTOR:
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor, value);
|
||||
case TXPIDSETTINGS_PIDS_ACROROLLFACTOR:
|
||||
needsUpdateBank |= updateUint8(&bank.AcroInsanityFactor.Roll, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROPITCHFACTOR:
|
||||
needsUpdateBank |= updateUint8(&bank.AcroInsanityFactor.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROROLLPITCHFACTOR:
|
||||
needsUpdateBank |= updateUint8(&bank.AcroInsanityFactor.Roll, value);
|
||||
needsUpdateBank |= updateUint8(&bank.AcroInsanityFactor.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACCELTAU:
|
||||
needsUpdateAtt |= update(&att.AccelTau, value);
|
||||
@ -428,6 +451,12 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
AltitudeHoldSettingsSet(&altitude);
|
||||
}
|
||||
#endif
|
||||
if (easyTuneEnabled && (inst.EasyTuneRatePIDRecalculateYaw != TXPIDSETTINGS_EASYTUNERATEPIDRECALCULATEYAW_FALSE)) {
|
||||
float newKp = (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.EasyTuneYawRateFactors.P;
|
||||
needsUpdateBank |= update(&bank.YawRatePID.Kp, newKp);
|
||||
needsUpdateBank |= update(&bank.YawRatePID.Ki, newKp * inst.EasyTuneYawRateFactors.I);
|
||||
needsUpdateBank |= update(&bank.YawRatePID.Kd, newKp * inst.EasyTuneYawRateFactors.D);
|
||||
}
|
||||
if (needsUpdateBank) {
|
||||
switch (inst.BankNumber) {
|
||||
case 0:
|
||||
@ -510,6 +539,21 @@ static uint8_t update(float *var, float val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates var using val if needed.
|
||||
* \returns 1 if updated, 0 otherwise
|
||||
*/
|
||||
static uint8_t updateUint16(uint16_t *var, float val)
|
||||
{
|
||||
uint16_t roundedVal = (uint16_t)roundf(val);
|
||||
|
||||
if (*var != roundedVal) {
|
||||
*var = roundedVal;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates var using val if needed.
|
||||
* \returns 1 if updated, 0 otherwise
|
||||
|
@ -103,7 +103,7 @@ static uint8_t *pucAlignedHeap = NULL;
|
||||
size_t mask = alignment - 1;
|
||||
/* Ensure that blocks are always aligned to the required number of bytes. */
|
||||
#if portBYTE_ALIGNMENT != 1
|
||||
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
||||
if( xWantedSize & mask )
|
||||
{
|
||||
/* Byte alignment required. */
|
||||
xWantedSize += ( alignment - ( xWantedSize & mask ) );
|
||||
|
@ -598,7 +598,8 @@ static bool PIOS_MPU6000_HandleData()
|
||||
queue_data->sample[0].z = -1 - (GET_SENSOR_DATA(mpu6000_data, Accel_Z));
|
||||
queue_data->sample[1].z = -1 - (GET_SENSOR_DATA(mpu6000_data, Gyro_Z));
|
||||
const int16_t temp = GET_SENSOR_DATA(mpu6000_data, Temperature);
|
||||
queue_data->temperature = 3500 + ((float)(temp + 512)) * (1.0f / 3.4f);
|
||||
// Temperature in degrees C = (TEMP_OUT Register Value as a signed quantity)/340 + 36.53
|
||||
queue_data->temperature = 3653 + (temp * 100) / 340;
|
||||
|
||||
BaseType_t higherPriorityTaskWoken;
|
||||
xQueueSendToBackFromISR(dev->queue, (void *)queue_data, &higherPriorityTaskWoken);
|
||||
|
@ -7,7 +7,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file pios_usb_defs.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief USB Standard types and definitions
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
@ -353,6 +354,7 @@ enum usb_cdc_notification {
|
||||
|
||||
enum usb_product_ids {
|
||||
USB_PRODUCT_ID_OPENPILOT_MAIN = 0x415A,
|
||||
USB_PRODUCT_ID_COPTERCONTROL = 0x415B,
|
||||
USB_PRODUCT_ID_OPLINK = 0x415C,
|
||||
USB_PRODUCT_ID_CC3D = 0x415D,
|
||||
USB_PRODUCT_ID_REVOLUTION = 0x415E,
|
||||
@ -363,9 +365,9 @@ enum usb_product_ids {
|
||||
enum usb_op_board_ids {
|
||||
USB_OP_BOARD_ID_OPENPILOT_MAIN = 1,
|
||||
/* Board ID 2 may be unused or AHRS */
|
||||
USB_OP_BOARD_ID_OPLINK = 3,
|
||||
/* USB_OP_BOARD_ID_COPTERCONTROL = 4, */
|
||||
USB_OP_BOARD_ID_REVOLUTION = 5,
|
||||
USB_OP_BOARD_ID_OPLINK = 3,
|
||||
USB_OP_BOARD_ID_COPTERCONTROL = 4,
|
||||
USB_OP_BOARD_ID_REVOLUTION = 5,
|
||||
USB_OP_BOARD_ID_OSD = 6,
|
||||
} __attribute__((packed));
|
||||
|
||||
|