Merge branch 'master' of github.com:PX4/Firmware into beta

This commit is contained in:
Lorenz Meier
2016-01-16 11:18:08 +01:00
105 changed files with 1339 additions and 768 deletions
+3
View File
@@ -34,3 +34,6 @@
[submodule "src/lib/ecl"]
path = src/lib/ecl
url = https://github.com/PX4/ecl.git
[submodule "cmake/cmake_hexagon"]
path = cmake/cmake_hexagon
url = https://github.com/ATLFlight/cmake_hexagon
+1
View File
@@ -93,6 +93,7 @@ env:
- PX4_AWS_BUCKET=px4-travis
script:
- git submodule update --init --recursive
- make check_format
- arm-none-eabi-gcc --version
- echo 'Building POSIX Firmware..' && make posix_sitl_default
+1 -1
View File
@@ -16,7 +16,7 @@ git checkout -b mydescriptivebranchname
### Edit and build the code
The [developer guide](http://px4.io/dev/start) explains how to set up the development environment on Mac OS, Linux or Windows. Please take note of our [coding style](http://px4.io/dev/code_style) when editing files.
The [developer guide](http://dev.px4.io/) explains how to set up the development environment on Mac OS, Linux or Windows. Please take note of our [coding style](http://px4.io/dev/code_style) when editing files.
### Commit your changes
+1 -1
View File
@@ -281,7 +281,7 @@ TYPEDEF_HIDES_STRUCT = NO
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
+1 -1
View File
@@ -48,7 +48,7 @@ Download QGC from http://qgroundcontrol.org/downloads and install using the wind
## PX4
### Platfrom Requirements
### Platform Requirements
Linux or Eagle with a working IP interface (?? does this need further instructions?)
### Build Host Requirements
+5 -2
View File
@@ -109,7 +109,9 @@ endif
# describe how to build a cmake config
define cmake-build
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(PWD)/build_$@/Makefile ]; then rm -rf $(PWD)/build_$@; fi
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then git submodule update --init --recursive --force && mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
+git submodule init
+Tools/check_submodules.sh
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then git submodule sync && git submodule init && mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
+$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
endef
@@ -193,7 +195,8 @@ clean:
# targets handled by cmake
cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak \
run_cmake_config config gazebo gazebo_gdb gazebo_lldb jmavsim \
jmavsim_gdb jmavsim_lldb gazebo_gdb_iris gazebo_lldb_tailsitter gazebo_iris gazebo_tailsitter
jmavsim_gdb jmavsim_lldb gazebo_gdb_iris gazebo_lldb_tailsitter gazebo_iris gazebo_tailsitter \
gazebo_gdb_standard_vtol gazebo_lldb_standard_vtol gazebo_standard_vtol
$(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ))))
.PHONY: clean
@@ -2,7 +2,7 @@
#
# @name Quadrotor X Tailsitter
#
# @type VTOL Tailsitter
# @type VTOL Quad Tailsitter
#
# @maintainer Roman Bapst <roman@px4.io>
#
@@ -2,7 +2,7 @@
#
# @name Quadrotor + Tailsitter
#
# @type VTOL Tailsitter
# @type VTOL Quad Tailsitter
#
# @maintainer Roman Bapst <roman@px4.io>
#
@@ -0,0 +1,53 @@
#!nsh
#
# @name QuadRanger
#
# @type Standard VTOL
#
# @maintainer Sander Smeets <sander@droneslab.com>
#
sh /etc/init.d/rc.vtol_defaults
if [ $AUTOCNF == yes ]
then
param set VT_TYPE 2
param set VT_MOT_COUNT 4
param set VT_TRANS_THR 0.75
param set PWM_AUX_REV1 1
param set PWM_AUX_REV2 1
param set MC_ROLL_P 6.5
param set MC_ROLLRATE_P 0.1
param set MC_ROLLRATE_I 0.002
param set MC_ROLLRATE_D 0.003
param set MC_ROLLRATE_FF 0.0
param set MC_PITCH_P 6.5
param set MC_PITCHRATE_P 0.1
param set MC_PITCHRATE_I 0.002
param set MC_PITCHRATE_D 0.003
param set MC_PITCHRATE_FF 0.0
param set MC_YAW_P 2.8
param set MC_YAW_FF 0.5
param set MC_YAWRATE_P 0.22
param set MC_YAWRATE_I 0.02
param set MC_YAWRATE_D 0.0
param set MC_YAWRATE_FF 0.0
fi
set MIXER vtol_quad_x
set PWM_OUT 12345678
set MIXER_AUX vtol_AAERT
set PWM_AUX_RATE 50
set PWM_AUX_OUT 1234
set PWM_AUX_DISARMED 1000
set PWM_AUX_MIN 1000
set PWM_AUX_MAX 2000
set MAV_TYPE 22
param set VT_MOT_COUNT 4
param set VT_IDLE_PWM_MC 1080
param set VT_TYPE 2
+1 -1
View File
@@ -2,7 +2,7 @@
#
# @name Applied Aeronautics Albatross
#
# @type Standard Plane
# @type Plane A-Tail
#
# @output MAIN1 aileron right
# @output MAIN2 aileron left
@@ -0,0 +1,24 @@
Mixer for standard vtol plane (SITL) with motor x configuration
=========================================================
This file defines a single mixer for a standard vtol plane (SITL gazebo) with motors in X configuration.
The plane has two ailerons and one elevator. The ailerons and elevator are treated as elevons
in order to make the standard vtol simulation compatible with the tailsitter simulation.
R: 4x 10000 10000 10000 0
# mixer for the elevons
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 5000 5000 0 -10000 10000
S: 1 1 -5000 -5000 0 -10000 10000
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 5000 5000 0 -10000 10000
S: 1 1 5000 5000 0 -10000 10000
# mixer for the pusher/puller throttle
M: 1
O: 10000 10000 0 -10000 10000
S: 1 3 0 20000 -10000 -10000 10000
+1 -1
View File
@@ -6,7 +6,7 @@ then
exit 1;
fi
if [[ $cmake_ver == *"2.8"* ]] || [[ $cmake_ver == *"2.9"* ]] || [[ $cmake_ver == *"3.0"* ]] || [[ $cmake_ver == *"3.1"* ]]
if [[ $cmake_ver == *" 2.8"* ]] || [[ $cmake_ver == *" 2.9"* ]] || [[ $cmake_ver == *" 3.0"* ]] || [[ $cmake_ver == *" 3.1"* ]]
then
exit 1;
fi
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules
echo "Skipping submodules. NUTTX_SRC is set to $NUTTX_SRC"
exit 0
}
if [ -f src/modules/uavcan/libuavcan/CMakeLists.txt ]
then
echo "Git submodule config valid."
else
git submodule update --init --recursive
fi
GITSTATUS=$(git status)
function check_git_submodule {
if [ -d $1 ];
then
SUBMODULE_STATUS=$(git submodule summary "$1")
STATUSRETVAL=$(echo $SUBMODULE_STATUS | grep -A20 -i "$1" | grep "<")
if [ -z "$STATUSRETVAL" ]; then
echo "Checked $1 submodule, correct version found"
else
echo -e "\033[31mChecked $1 submodule, ACTION REQUIRED:\033[0m"
echo ""
echo -e "New commits required:"
echo -e "$SUBMODULE_STATUS"
echo ""
echo ""
echo -e " *******************************************************************************"
echo -e " * \033[31mIF YOU DID NOT CHANGE THIS FILE (OR YOU DON'T KNOW WHAT A SUBMODULE IS):\033[0m *"
echo -e " * \033[31mHit 'u' and <ENTER> to update ALL submodules and resolve this.\033[0m *"
echo -e " * (performs \033[94mgit submodule update --init --recursive\033[0m) *"
echo -e " *******************************************************************************"
echo ""
echo ""
echo -e " Only for EXPERTS:"
echo -e " $1 submodule is not in the recommended version."
echo -e " Hit 'y' and <ENTER> to continue the build with this version. Hit <ENTER> to resolve manually."
echo -e " Use \033[94mgit add $1 && git commit -m 'Updated $1'\033[0m to choose this version (careful!)"
echo ""
read user_cmd
if [ "$user_cmd" == "y" ]
then
echo "Continuing build with manually overridden submodule.."
else
if [ "$user_cmd" == "u" ]
then
git submodule update --init --recursive
echo "Submodule fixed, continuing build.."
else
echo "Build aborted."
exit 1
fi
fi
fi
else
git submodule update --init --recursive;
git submodule update;
fi
}
check_git_submodule NuttX
check_git_submodule Tools/gencpp
check_git_submodule Tools/genmsg
check_git_submodule Tools/jMAVSim
check_git_submodule Tools/sitl_gazebo
check_git_submodule cmake/cmake_hexagon
check_git_submodule mavlink/include/mavlink/v1.0
check_git_submodule src/lib/DriverFramework
check_git_submodule src/lib/dspal
check_git_submodule src/lib/ecl
check_git_submodule src/lib/matrix
check_git_submodule src/modules/uavcan/libuavcan
check_git_submodule unittests/googletest
exit 0
+3 -3
View File
@@ -752,7 +752,7 @@ class MAVLink_gps_raw_int_message(MAVLink_message):
'''
The global position, as returned by the Global Positioning
System (GPS). This is NOT the global position
estimate of the sytem, but rather a RAW sensor value. See
estimate of the system, but rather a RAW sensor value. See
message GLOBAL_POSITION for the global position estimate.
Coordinate frame is right-handed, Z-axis up (GPS frame).
'''
@@ -2812,7 +2812,7 @@ class MAVLink(object):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global position
estimate of the sytem, but rather a RAW sensor value.
estimate of the system, but rather a RAW sensor value.
See message GLOBAL_POSITION for the global position
estimate. Coordinate frame is right-handed, Z-axis up
(GPS frame).
@@ -2837,7 +2837,7 @@ class MAVLink(object):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global position
estimate of the sytem, but rather a RAW sensor value.
estimate of the system, but rather a RAW sensor value.
See message GLOBAL_POSITION for the global position
estimate. Coordinate frame is right-handed, Z-axis up
(GPS frame).
+38 -12
View File
@@ -28,29 +28,55 @@ class XMLOutput():
xml_group = ET.SubElement(xml_parameters, "airframe_group")
xml_group.attrib["name"] = group.GetName()
if (group.GetName() == "Standard Plane"):
xml_group.attrib["image"] = "AirframeStandardPlane.png"
xml_group.attrib["image"] = "Plane"
elif (group.GetName() == "Flying Wing"):
xml_group.attrib["image"] = "AirframeFlyingWing.png"
xml_group.attrib["image"] = "FlyingWing"
elif (group.GetName() == "Quadrotor x"):
xml_group.attrib["image"] = "AirframeQuadRotorX.png"
xml_group.attrib["image"] = "QuadRotorX"
elif (group.GetName() == "Quadrotor +"):
xml_group.attrib["image"] = "AirframeQuadRotorPlus.png"
xml_group.attrib["image"] = "QuadRotorPlus"
elif (group.GetName() == "Hexarotor x"):
xml_group.attrib["image"] = "AirframeHexaRotorX.png"
xml_group.attrib["image"] = "HexaRotorX"
elif (group.GetName() == "Hexarotor +"):
xml_group.attrib["image"] = "AirframeHexaRotorPlus.png"
xml_group.attrib["image"] = "HexaRotorPlus"
elif (group.GetName() == "Octorotor +"):
xml_group.attrib["image"] = "AirframeOctoRotorPlus.png"
xml_group.attrib["image"] = "OctoRotorPlus"
elif (group.GetName() == "Octorotor x"):
xml_group.attrib["image"] = "AirframeOctoRotorX.png"
xml_group.attrib["image"] = "OctoRotorX"
elif (group.GetName() == "Octorotor Coaxial"):
xml_group.attrib["image"] = "OctoRotorXCoaxial"
elif (group.GetName() == "Quadrotor Wide"):
xml_group.attrib["image"] = "AirframeQuadRotorH.png"
xml_group.attrib["image"] = "QuadRotorWide"
elif (group.GetName() == "Quadrotor H"):
xml_group.attrib["image"] = "AirframeQuadRotorH.png"
xml_group.attrib["image"] = "QuadRotorH"
elif (group.GetName() == "Simulation"):
xml_group.attrib["image"] = "AirframeSimulation.png"
xml_group.attrib["image"] = "AirframeSimulation"
elif (group.GetName() == "Plane A-Tail"):
xml_group.attrib["image"] = "PlaneATail"
elif (group.GetName() == "VTOL Duo Tailsitter"):
xml_group.attrib["image"] = "VTOLDuoRotorTailSitter"
elif (group.GetName() == "Standard VTOL"):
xml_group.attrib["image"] = "VTOLPlane"
elif (group.GetName() == "VTOL Quad Tailsitter"):
xml_group.attrib["image"] = "VTOLQuadRotorTailSitter"
elif (group.GetName() == "VTOLTiltRotor"):
xml_group.attrib["image"] = "VTOLTiltRotor"
elif (group.GetName() == "Coaxial Helicopter"):
xml_group.attrib["image"] = "HelicopterCoaxial"
elif (group.GetName() == "Hexarotor Coaxial"):
xml_group.attrib["image"] = "Y6A"
elif (group.GetName() == "Y6B"):
xml_group.attrib["image"] = "Y6B"
elif (group.GetName() == "Tricopter Y-"):
xml_group.attrib["image"] = "YMinus"
elif (group.GetName() == "Tricopter Y+"):
xml_group.attrib["image"] = "YPlus"
elif (group.GetName() == "Rover"):
xml_group.attrib["image"] = "Rover"
elif (group.GetName() == "Boat"):
xml_group.attrib["image"] = "Boat"
else:
xml_group.attrib["image"] = ""
xml_group.attrib["image"] = "AirframeUnknown"
for param in group.GetParams():
if (last_param_name == param.GetName() and not board_specific_param_set) or last_param_name != param.GetName():
xml_param = ET.SubElement(xml_group, "airframe")
+1 -1
View File
@@ -107,7 +107,7 @@ class SourceParser(object):
re_remove_dots = re.compile(r'\.+$')
re_remove_carriage_return = re.compile('\n+')
valid_tags = set(["group", "board", "min", "max", "unit", "decimal"])
valid_tags = set(["group", "board", "min", "max", "unit", "decimal", "reboot_required"])
# Order of parameter groups
priority = {
Submodule cmake/cmake_hexagon added at 829f22eff3
+4
View File
@@ -266,6 +266,10 @@ function(px4_add_module)
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS})
if(${OS} STREQUAL "qurt" )
set_property(TARGET ${MODULE} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
endif()
if(MAIN)
set_target_properties(${MODULE} PROPERTIES
COMPILE_DEFINITIONS PX4_MAIN=${MAIN}_app_main)
+5 -4
View File
@@ -11,17 +11,18 @@ include(qurt/px4_impl_qurt)
#include_directories(${HEXAGON_DRIVERS_ROOT}/inc)
# For Actual flight we need to link against the driver dynamic libraries
set(target_libraries
-L${HEXAGON_DRIVERS_ROOT}/libs
#set(target_libraries
# -L${HEXAGON_DRIVERS_ROOT}/libs
# The plan is to replace these with our drivers
# mpu9x50
# uart_esc
# csr_gps
# rc_receiver
)
# )
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
#
+3 -1
View File
@@ -1,6 +1,8 @@
include(qurt/px4_impl_qurt)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device
+2 -1
View File
@@ -1,6 +1,7 @@
include(qurt/px4_impl_qurt)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device
+3 -1
View File
@@ -1,6 +1,8 @@
include(qurt/px4_impl_qurt)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device
+2 -1
View File
@@ -20,7 +20,8 @@ set(target_libraries
)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
#
+2 -1
View File
@@ -1,6 +1,7 @@
include(qurt/px4_impl_qurt)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device
+2 -1
View File
@@ -3,7 +3,8 @@ include(qurt/px4_impl_qurt)
# Run a full link with build stubs to make sure qurt target isn't broken
set(QURT_ENABLE_STUBS "1")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-qurt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device
+2 -5
View File
@@ -172,16 +172,13 @@ function(px4_os_add_flags)
set(added_definitions
-D__PX4_QURT
-D__PX4_POSIX
-D__DF_QURT
-include ${PX4_INCLUDE_DIR}visibility.h
)
# Add the toolchain specific flags
set(added_cflags ${QURT_CMAKE_C_FLAGS})
set(added_cxx_flags ${QURT_CMAKE_CXX_FLAGS})
set(added_cflags -O0)
set(added_cxx_flags -O0)
# FIXME @jgoppert - how to work around issues like this?
# Without changing global variables?
# Clear -rdynamic flag which fails for hexagon
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
@@ -1,254 +0,0 @@
#
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include(CMakeForceCompiler)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(common/px4_base)
if ("$ENV{HEXAGON_TOOLS_ROOT}" STREQUAL "")
message(FATAL_ERROR
"The HexagonTools version 7.2.10 must be installed and the environment variable HEXAGON_TOOLS_ROOT must be set"
"(e.g. export HEXAGON_TOOLS_ROOT=/opt/HEXAGON_Tools/7.2.10/Tools)")
else()
set(HEXAGON_TOOLS_ROOT $ENV{HEXAGON_TOOLS_ROOT})
endif()
macro (list2string out in)
set(list ${ARGV})
list(REMOVE_ITEM list ${out})
foreach(item ${list})
set(${out} "${${out}} ${item}")
endforeach()
endmacro(list2string)
set(V_ARCH "v5")
set(CROSSDEV "hexagon-")
set(HEXAGON_BIN ${HEXAGON_TOOLS_ROOT}/bin)
set(HEXAGON_LIB_DIR ${HEXAGON_TOOLS_ROOT}/gnu/hexagon/lib)
set(HEXAGON_ISS_DIR ${HEXAGON_TOOLS_ROOT}/lib/iss)
set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/target/hexagon/lib/${V_ARCH}/G0)
# Use the HexagonTools compiler (7.2.10)
set(CMAKE_C_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang)
set(CMAKE_CXX_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang++)
set(CMAKE_AR ${HEXAGON_BIN}/${CROSSDEV}ar CACHE FILEPATH "Archiver")
set(CMAKE_RANLIB ${HEXAGON_BIN}/${CROSSDEV}ranlib)
set(CMAKE_LINKER ${HEXAGON_BIN}/${CROSSDEV}ld.qcld)
set(CMAKE_NM ${HEXAGON_BIN}/${CROSSDEV}nm)
set(CMAKE_OBJDUMP ${HEXAGON_BIN}/${CROSSDEV}objdump)
set(CMAKE_OBJCOPY ${HEXAGON_BIN}/${CROSSDEV}objcopy)
list2string(HEXAGON_INCLUDE_DIRS
-I${HEXAGON_TOOLS_ROOT}/target/hexagon/include
)
#set(DYNAMIC_LIBS -Wl,${TOOLSLIB}/pic/libstdc++.a)
#set(MAXOPTIMIZATION -O0)
# Base CPU flags for each of the supported architectures.
#
set(ARCHCPUFLAGS
-m${V_ARCH}
-G0
)
add_definitions(
-D_PID_T -D_UID_T -D_TIMER_T
-Dnoreturn_function=
-D_HAS_C9X
-D__EXPORT=
-Drestrict=
-D_DEBUG
-Wno-error=shadow
)
# optimisation flags
#
set(ARCHOPTIMIZATION
-O0
-g
-fno-strict-aliasing
-fdata-sections
-fno-zero-initialized-in-bss
)
# Language-specific flags
#
set(ARCHCFLAGS
-std=gnu99
-D__CUSTOM_FILE_IO__
)
set(ARCHCXXFLAGS
-fno-exceptions
-fno-rtti
-std=c++11
-fno-threadsafe-statics
-DCONFIG_WCHAR_BUILTIN
-D__CUSTOM_FILE_IO__
)
set(ARCHWARNINGS
-Wall
-Wextra
-Werror
-Wno-unused-parameter
-Wno-unused-function
-Wno-unused-variable
-Wno-gnu-array-member-paren-init
-Wno-cast-align
-Wno-missing-braces
-Wno-strict-aliasing
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
)
# C-specific warnings
#
set(ARCHCWARNINGS
${ARCHWARNINGS}
-Wstrict-prototypes
-Wnested-externs
)
# C++-specific warnings
#
set(ARCHWARNINGSXX
${ARCHWARNINGS}
-Wno-missing-field-initializers
)
exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-libgcc-file-name OUTPUT_VARIABLE LIBGCC)
exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-file-name=libm.a OUTPUT_VARIABLE LIBM)
set(EXTRA_LIBS ${EXTRA_LIBS} ${LIBM})
# Flags we pass to the C compiler
#
list2string(CFLAGS
${ARCHCFLAGS}
${ARCHCWARNINGS}
${ARCHOPTIMIZATION}
${ARCHCPUFLAGS}
${ARCHINCLUDES}
${INSTRUMENTATIONDEFINES}
${ARCHDEFINES}
${EXTRADEFINES}
${EXTRACFLAGS}
${HEXAGON_INCLUDE_DIRS}
)
# Flags we pass to the C++ compiler
#
list2string(CXXFLAGS
${ARCHCXXFLAGS}
${ARCHWARNINGSXX}
${ARCHOPTIMIZATION}
${ARCHCPUFLAGS}
${ARCHXXINCLUDES}
${INSTRUMENTATIONDEFINES}
${ARCHDEFINES}
${EXTRADEFINES}
${EXTRACXXFLAGS}
${HEXAGON_INCLUDE_DIRS}
)
# Flags we pass to the assembler
#
list2string(AFLAGS
${CFLAGS}
-D__ASSEMBLY__
${EXTRADEFINES}
${EXTRAAFLAGS}
)
# Set cmake flags
#
list2string(CMAKE_C_FLAGS
${CMAKE_C_FLAGS}
${CFLAGS}
)
set(QURT_CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "cflags")
message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-")
list2string(CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS}
${CXXFLAGS}
)
set(QURT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "cxxflags")
message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-")
# Flags we pass to the linker
#
list2string(CMAKE_EXE_LINKER_FLAGS
-g
-mv5
-mG0lib
-G0
-fpic
-shared
-Wl,-Bsymbolic
-Wl,--wrap=malloc
-Wl,--wrap=calloc
-Wl,--wrap=free
-Wl,--wrap=realloc
-Wl,--wrap=memalign
-Wl,--wrap=__stack_chk_fail
-lc
${EXTRALDFLAGS}
)
# where is the target environment
set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH))
set(CMAKE_C_COMPILER_ID, "Clang")
set(CMAKE_CXX_COMPILER_ID, "Clang")
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# The Hexagon compiler doesn't support the -rdynamic flag and this is set
# in the base cmake scripts. We have to redefine the __linux_compiler_gnu
# macro for cmake 2.8 to work
set(__LINUX_COMPILER_GNU 1)
macro(__linux_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
endmacro()
-249
View File
@@ -1,249 +0,0 @@
#
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include(CMakeForceCompiler)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(common/px4_base)
if(NOT HEXAGON_TOOLS_ROOT)
set(HEXAGON_TOOLS_ROOT /opt/6.4.05)
endif()
if(NOT HEXAGON_SDK_ROOT)
set(HEXAGON_SDK_ROOT /opt/Hexagon_SDK)
endif()
macro (list2string out in)
set(list ${ARGV})
list(REMOVE_ITEM list ${out})
foreach(item ${list})
set(${out} "${${out}} ${item}")
endforeach()
endmacro(list2string)
set(V_ARCH "v5")
set(CROSSDEV "hexagon-")
set(HEXAGON_BIN ${HEXAGON_TOOLS_ROOT}/gnu/bin)
set(HEXAGON_CLANG_BIN ${HEXAGON_TOOLS_ROOT}/qc/bin)
set(HEXAGON_LIB_DIR ${HEXAGON_TOOLS_ROOT}/gnu/hexagon/lib)
set(HEXAGON_ISS_DIR ${HEXAGON_TOOLS_ROOT}/qc/lib/iss)
set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/$(V_ARCH)/G0)
set(QCTOOLSLIB ${HEXAGON_TOOLS_ROOT}/qc/lib/$(V_ARCH)/G0)
# Use the HexagonTools compiler (6.4.05)
set(CMAKE_C_COMPILER ${HEXAGON_CLANG_BIN}/${CROSSDEV}clang)
set(CMAKE_CXX_COMPILER ${HEXAGON_CLANG_BIN}/${CROSSDEV}clang++)
set(CMAKE_AR ${HEXAGON_BIN}/${CROSSDEV}ar CACHE FILEPATH "Archiver")
set(CMAKE_RANLIB ${HEXAGON_BIN}/${CROSSDEV}ranlib)
set(CMAKE_LINKER ${HEXAGON_BIN}/${CROSSDEV}ld)
set(CMAKE_NM ${HEXAGON_BIN}/${CROSSDEV}nm)
set(CMAKE_OBJDUMP ${HEXAGON_BIN}/${CROSSDEV}objdump)
set(CMAKE_OBJCOPY ${HEXAGON_BIN}/${CROSSDEV}objcopy)
list2string(HEXAGON_INCLUDE_DIRS
-I${HEXAGON_TOOLS_ROOT}/gnu/hexagon/include
-I${HEXAGON_SDK_ROOT}/inc
-I${HEXAGON_SDK_ROOT}/inc/stddef
)
#set(DYNAMIC_LIBS -Wl,${TOOLSLIB}/pic/libstdc++.a)
#set(MAXOPTIMIZATION -O0)
# Base CPU flags for each of the supported architectures.
#
set(ARCHCPUFLAGS
-m${V_ARCH}
-G0
)
add_definitions(
-D_PID_T -D_UID_T -D_TIMER_T
-Dnoreturn_function=
-D__EXPORT=
-Drestrict=
-D_DEBUG
-Wno-error=shadow
)
# optimisation flags
#
set(ARCHOPTIMIZATION
-O0
-g
-fno-strict-aliasing
-fdata-sections
-fpic
-fno-zero-initialized-in-bss
)
# Language-specific flags
#
set(ARCHCFLAGS
-std=gnu99
-D__CUSTOM_FILE_IO__
)
set(ARCHCXXFLAGS
-fno-exceptions
-fno-rtti
-std=c++11
-fno-threadsafe-statics
-DCONFIG_WCHAR_BUILTIN
-D__CUSTOM_FILE_IO__
)
set(ARCHWARNINGS
-Wall
-Wextra
-Werror
-Wno-unused-parameter
-Wno-unused-function
-Wno-unused-variable
-Wno-gnu-array-member-paren-init
-Wno-cast-align
-Wno-missing-braces
-Wno-strict-aliasing
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
)
# C-specific warnings
#
set(ARCHCWARNINGS
${ARCHWARNINGS}
-Wstrict-prototypes
-Wnested-externs
)
# C++-specific warnings
#
set(ARCHWARNINGSXX
${ARCHWARNINGS}
-Wno-missing-field-initializers
)
exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-libgcc-file-name OUTPUT_VARIABLE LIBGCC)
exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-file-name=libm.a OUTPUT_VARIABLE LIBM)
set(EXTRA_LIBS ${EXTRA_LIBS} ${LIBM})
# Flags we pass to the C compiler
#
list2string(CFLAGS
${ARCHCFLAGS}
${ARCHCWARNINGS}
${ARCHOPTIMIZATION}
${ARCHCPUFLAGS}
${ARCHINCLUDES}
${INSTRUMENTATIONDEFINES}
${ARCHDEFINES}
${EXTRADEFINES}
${EXTRACFLAGS}
${HEXAGON_INCLUDE_DIRS}
)
# Flags we pass to the C++ compiler
#
list2string(CXXFLAGS
${ARCHCXXFLAGS}
${ARCHWARNINGSXX}
${ARCHOPTIMIZATION}
${ARCHCPUFLAGS}
${ARCHXXINCLUDES}
${INSTRUMENTATIONDEFINES}
${ARCHDEFINES}
${EXTRADEFINES}
${EXTRACXXFLAGS}
${HEXAGON_INCLUDE_DIRS}
)
# Flags we pass to the assembler
#
list2string(AFLAGS
${CFLAGS}
-D__ASSEMBLY__
${EXTRADEFINES}
${EXTRAAFLAGS}
)
# Set cmake flags
#
list2string(CMAKE_C_FLAGS
${CMAKE_C_FLAGS}
${CFLAGS}
)
set(QURT_CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "cflags")
message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-")
list2string(CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS}
${CXXFLAGS}
)
set(QURT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "cxxflags")
message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-")
# Flags we pass to the linker
#
list2string(CMAKE_EXE_LINKER_FLAGS
-g
-mv5
-mG0lib
-G0
-fpic
-shared
-Wl,-Bsymbolic
-Wl,--wrap=malloc
-Wl,--wrap=calloc
-Wl,--wrap=free
-Wl,--wrap=realloc
-Wl,--wrap=memalign
-Wl,--wrap=__stack_chk_fail
-lc
${EXTRALDFLAGS}
)
# where is the target environment
set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH))
set(CMAKE_C_COMPILER_ID, "Clang")
set(CMAKE_CXX_COMPILER_ID, "Clang")
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+7 -1
View File
@@ -6,6 +6,12 @@ uint8 RC_INPUT_SOURCE_PX4IO_SBUS = 4
uint8 RC_INPUT_SOURCE_PX4IO_ST24 = 5
uint8 RC_INPUT_SOURCE_MAVLINK = 6
uint8 RC_INPUT_SOURCE_QURT = 7
uint8 RC_INPUT_SOURCE_PX4FMU_SPEKTRUM = 8
uint8 RC_INPUT_SOURCE_PX4FMU_SBUS = 9
uint8 RC_INPUT_SOURCE_PX4FMU_ST24 = 10
uint8 RC_INPUT_SOURCE_PX4FMU_SUMD = 11
uint8 RC_INPUT_SOURCE_PX4FMU_DSM = 12
uint8 RC_INPUT_SOURCE_PX4IO_SUMD = 13
uint8 RC_INPUT_MAX_CHANNELS = 18 # Maximum number of R/C input channels in the system. S.Bus has up to 18 channels.
@@ -14,7 +20,7 @@ uint64 timestamp_last_signal # last valid reception time
uint32 channel_count # number of channels actually being seen
int32 rssi # receive signal strength indicator (RSSI): < 0: Undefined, 0: no signal, 100: full reception
bool rc_failsafe # explicit failsafe flag: true on TX failure or TX out of range , false otherwise. Only the true state is reliable, as there are some (PPM) receivers on the market going into failsafe without telling us explicitly.
bool rc_lost # RC receiver connection status: True,if no frame has arrived in the expected time, false otherwise. True usally means that the receiver has been disconnected, but can also indicate a radio link loss on "stupid" systems. Will remain false, if a RX with failsafe option continues to transmit frames after a link loss.
bool rc_lost # RC receiver connection status: True,if no frame has arrived in the expected time, false otherwise. True usUally means that the receiver has been disconnected, but can also indicate a radio link loss on "stupid" systems. Will remain false, if a RX with failsafe option continues to transmit frames after a link loss.
uint16 rc_lost_frame_count # Number of lost RC frames. Note: intended purpose: observe the radio link quality if RSSI is not available. This value must not be used to trigger any failsafe-alike funtionality.
uint16 rc_total_frame_count # Number of total RC frames. Note: intended purpose: observe the radio link quality if RSSI is not available. This value must not be used to trigger any failsafe-alike funtionality.
uint16 rc_ppm_frame_length # Length of a single PPM frame. Zero for non-PPM systems
+1 -1
View File
@@ -26,7 +26,7 @@ float32 z # throttle stick position 0..1
# in general the value corresponds to the demanded throttle by the user,
# if the input is used for setting the setpoint of a vertical position
# controller any value > 0.5 means up and any value < 0.5 means down
float32 r # yaw stick/twist positon, -1..1
float32 r # yaw stick/twist position, -1..1
# in general corresponds to the righthand rotation around the vertical
# (downwards) axis of the vehicle
float32 flaps # flap position
+1 -1
View File
@@ -6,6 +6,6 @@ bool[3] valid #true for RC-Param channels which are mapped to a param
int32[3] param_index # corresponding param index, this field is ignored if set to -1, in this case param_id will be used
char[51] param_id # MAP_NCHAN * (ID_LEN + 1) chars, corresponding param id, null terminated
float32[3] scale # scale to map the RC input [-1, 1] to a parameter value
float32[3] value0 # inital value around which the parameter value is changed
float32[3] value0 # initial value around which the parameter value is changed
float32[3] value_min # minimal parameter value
float32[3] value_max # minimal parameter value
+1
View File
@@ -31,6 +31,7 @@ uint32 VEHICLE_CMD_DO_SET_SERVO = 183 # Set a servo to a desired PWM value. |S
uint32 VEHICLE_CMD_DO_REPEAT_SERVO = 184 # Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty|
uint32 VEHICLE_CMD_DO_FLIGHTTERMINATION=185 # Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty|
uint32 VEHICLE_CMD_DO_CONTROL_VIDEO = 200 # Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty|
uint32 VEHICLE_CMD_DO_DIGICAM_CONTROL=203
uint32 VEHICLE_CMD_DO_MOUNT_CONFIGURE=204 # Mission command to configure a camera or antenna mount |Mount operation mode (see MAV_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| Empty| Empty| Empty|
uint32 VEHICLE_CMD_DO_MOUNT_CONTROL=205 # Mission command to control a camera or antenna mount |pitch or lat in degrees, depending on mount mode.| roll or lon in degrees depending on mount mode| yaw or alt (in meters) depending on mount mode| reserved| reserved| reserved| MAV_MOUNT_MODE enum value|
uint32 VEHICLE_CMD_DO_SET_CAM_TRIGG_DIST=206 # Mission command to set CAM_TRIGG_DIST for this flight |Camera trigger distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty|
+3 -2
View File
@@ -215,7 +215,7 @@
#define GPIO_UART4_RX GPIO_UART4_RX_1
#define GPIO_UART4_TX GPIO_UART4_TX_1
#define GPIO_USART6_RX GPIO_USART6_RX_1
#define GPIO_USART6_RX GPIO_USART6_RX_1 /* RC_INPUT */
#define GPIO_USART6_TX GPIO_USART6_TX_1
#define GPIO_UART7_RX GPIO_UART7_RX_1
@@ -257,9 +257,10 @@
#define GPIO_SPI1_MOSI (GPIO_SPI1_MOSI_1|GPIO_SPEED_50MHz)
#define GPIO_SPI1_SCK (GPIO_SPI1_SCK_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_MISO (GPIO_SPI2_MISO_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_MOSI (GPIO_SPI2_MOSI_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_SCK (GPIO_SPI2_SCK_2|GPIO_SPEED_50MHz)
#define GPIO_SPI2_SCK (GPIO_SPI2_SCK_1|GPIO_SPEED_50MHz)
/************************************************************************************
* Public Data
@@ -0,0 +1,66 @@
uorb start
simulator start -s
param load
param set MAV_TYPE 20
param set MC_PITCHRATE_P 0.3
param set MC_ROLLRATE_P 0.3
param set MC_YAW_P 2.0
param set MC_YAWRATE_P 0.35
param set VT_TYPE 2
param set SYS_AUTOSTART 4010
param set SYS_RESTART_TYPE 2
dataman start
param set CAL_GYRO0_ID 2293768
param set CAL_ACC0_ID 1376264
param set CAL_ACC1_ID 1310728
param set CAL_MAG0_ID 196616
param set CAL_GYRO0_XOFF 0.01
param set CAL_ACC0_XOFF 0.01
param set CAL_ACC0_YOFF -0.01
param set CAL_ACC0_ZOFF 0.01
param set CAL_ACC0_XSCALE 1.01
param set CAL_ACC0_YSCALE 1.01
param set CAL_ACC0_ZSCALE 1.01
param set CAL_ACC1_XOFF 0.01
param set CAL_MAG0_XOFF 0.01
param set MPC_XY_P 0.15
param set MPC_XY_VEL_P 0.05
param set MPC_XY_VEL_D 0.005
param set MPC_XY_FF 0.1
param set MPC_Z_VEL_MAX 1.0
param set SENS_BOARD_ROT 8
param set COM_RC_IN_MODE 1
rgbledsim start
tone_alarm start
gyrosim start
accelsim start
barosim start
adcsim start
gpssim start
measairspeedsim start
pwm_out_sim mode_pwm
sleep 1
sensors start
commander start
land_detector start multicopter
navigator start
attitude_estimator_q start
position_estimator_inav start
vtol_att_control start
mc_pos_control start
mc_att_control start
fw_pos_control_l1 start
fw_att_control start
mixer load /dev/pwm_output0 ../../../../ROMFS/px4fmu_common/mixers/standard_vtol_sitl.main.mix
mavlink start -u 14556 -r 2000000
mavlink start -u 14557 -r 2000000 -m onboard
mavlink stream -r 80 -s POSITION_TARGET_LOCAL_NED -u 14556
mavlink stream -r 80 -s LOCAL_POSITION_NED -u 14556
mavlink stream -r 80 -s GLOBAL_POSITION_INT -u 14556
mavlink stream -r 80 -s ATTITUDE -u 14556
mavlink stream -r 80 -s ATTITUDE_TARGET -u 14556
mavlink stream -r 20 -s RC_CHANNELS -u 14556
mavlink stream -r 250 -s HIGHRES_IMU -u 14556
mavlink stream -r 10 -s OPTICAL_FLOW_RAD -u 14556
mavlink boot_complete
sdlog2 start -r 200 -e -t -a
@@ -27,6 +27,7 @@ param set MPC_XY_P 0.15
param set MPC_XY_VEL_P 0.05
param set MPC_XY_VEL_D 0.005
param set MPC_XY_FF 0.1
param set MPC_Z_VEL_MAX 1.0
param set SENS_BOARD_ROT 8
param set COM_RC_IN_MODE 1
rgbledsim start
@@ -115,6 +115,7 @@ __BEGIN_DECLS
#define PX4_SPI_BUS_SENSORS 1
#define PX4_SPI_BUS_RAMTRON 2
#define PX4_SPI_BUS_EXT 4
#define PX4_SPI_BUS_BARO PX4_SPI_BUS_SENSORS
/* Use these in place of the spi_dev_e enumeration to select a specific SPI device on SPI1 */
#define PX4_SPIDEV_GYRO 1
+25 -8
View File
@@ -73,7 +73,7 @@ __BEGIN_DECLS
/* LEDs */
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN11)
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN10)
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN3)
#define GPIO_LED_RED GPIO_LED1
@@ -120,15 +120,24 @@ __BEGIN_DECLS
#define PX4_SPI_BUS_SENSORS 1
#define PX4_SPI_BUS_RAMTRON 2
#define PX4_SPI_BUS_BARO PX4_SPI_BUS_RAMTRON
/* Use these in place of the spi_dev_e enumeration to select a specific SPI device on SPI1 */
#define PX4_SPIDEV_GYRO 1
#define PX4_SPIDEV_ACCEL_MAG 2
#define PX4_SPIDEV_BARO 3
#define PX4_SPIDEV_MPU 4
#define PX4_SPIDEV_HMC 5
#define PX4_SPIDEV_ICM 6
/* onboard MS5611 and FRAM are both on bus SPI2
* spi_dev_e:SPIDEV_FLASH has the value 2 and is used in the NuttX ramtron driver
* use 3 for the barometer to differentiate
*/
#define PX4_SPIDEV_BARO 3
#if (PX4_SPIDEV_BARO == SPIDEV_FLASH)
#error PX4_SPIDEV_BARO must not be equal to SPIDEV_FLASH as they share the same bus
#endif
/* I2C busses */
#define PX4_I2C_BUS_EXPANSION 1
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION
@@ -215,7 +224,7 @@ __BEGIN_DECLS
#define HRT_PPM_CHANNEL 3 /* use capture/compare channel 2 */
#define GPIO_PPM_IN (GPIO_ALT|GPIO_AF2|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN0)
#define SBUS_SERIAL_PORT "/dev/ttyS4"
#define RC_SERIAL_PORT "/dev/ttyS4"
/* PWM input driver. Use FMU AUX5 pins attached to timer4 channel 2 */
#define PWMIN_TIMER 4
@@ -226,7 +235,12 @@ __BEGIN_DECLS
#define GPIO_LED_SAFETY (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN3)
#define GPIO_BTN_SAFETY (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN4)
#define GPIO_PERIPH_3V3_EN (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN5)
#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
/* for R07, this signal is active low */
//#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
//#define INVERT_RC_INPUT(_s) stm32_gpiowrite(GPIO_SBUS_INV, 1-_s);
/* for R12, this signal is active high */
#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
#define INVERT_RC_INPUT(_s) stm32_gpiowrite(GPIO_SBUS_INV, _s);
#define GPIO_8266_GPIO0 (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN2)
#define GPIO_SPEKTRUM_PWR_EN (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN4)
@@ -235,11 +249,14 @@ __BEGIN_DECLS
/* Power switch controls ******************************************************/
#define POWER_SPEKTRUM(_s) stm32_gpiowrite(GPIO_SPEKTRUM_PWR_EN, (_s))
#define GPIO_USART1_RX_SPEKTRUM (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN7)
#define SPEKTRUM_RX_HIGH(_s) stm32_gpiowrite(GPIO_USART1_RX_SPEKTRUM, (_s))
#define POWER_SPEKTRUM(_s) stm32_gpiowrite(GPIO_SPEKTRUM_PWR_EN, (1-_s))
//#define GPIO_USART1_RX_SPEKTRUM (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN7)
#define SPEKTRUM_RX_AS_UART() stm32_configgpio(GPIO_USART1_RX)
#define SPEKTRUM_RX_AS_GPIO() stm32_configgpio(GPIO_USART1_RX_SPEKTRUM)
// FMUv4 has a separate GPIO for serial RC output
#define GPIO_RC_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN6)
#define SPEKTRUM_RX_AS_GPIO() stm32_configgpio(GPIO_RC_OUT)
#define SPEKTRUM_RX_HIGH(_s) stm32_gpiowrite(GPIO_RC_OUT, (_s))
/****************************************************************************************************
* Public Types
+9 -4
View File
@@ -233,6 +233,10 @@ __EXPORT int nsh_archinitialize(void)
stm32_configgpio(GPIO_SPEKTRUM_PWR_EN);
stm32_configgpio(GPIO_8266_PD);
stm32_configgpio(GPIO_8266_RST);
#ifdef GPIO_RC_OUT
stm32_configgpio(GPIO_RC_OUT); /* Serial RC output pin */
stm32_gpiowrite(GPIO_RC_OUT, 1); /* set it high to pull RC input up */
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
@@ -284,7 +288,6 @@ __EXPORT int nsh_archinitialize(void)
SPI_SETMODE(spi1, SPIDEV_MODE3);
SPI_SELECT(spi1, PX4_SPIDEV_GYRO, false);
SPI_SELECT(spi1, PX4_SPIDEV_HMC, false);
SPI_SELECT(spi1, PX4_SPIDEV_BARO, false);
SPI_SELECT(spi1, PX4_SPIDEV_MPU, false);
up_udelay(20);
@@ -298,14 +301,16 @@ __EXPORT int nsh_archinitialize(void)
return -ENODEV;
}
/* Default SPI2 to 37.5 MHz (40 MHz rounded to nearest valid divider, F4 max)
* and de-assert the known chip selects. */
/* Default SPI2 to 12MHz and de-assert the known chip selects.
* MS5611 has max SPI clock speed of 20MHz
*/
// XXX start with 10.4 MHz in FRAM usage and go up to 37.5 once validated
// XXX start with 10.4 MHz and go up to 20 once validated
SPI_SETFREQUENCY(spi2, 12 * 1000 * 1000);
SPI_SETBITS(spi2, 8);
SPI_SETMODE(spi2, SPIDEV_MODE3);
SPI_SELECT(spi2, SPIDEV_FLASH, false);
SPI_SELECT(spi2, PX4_SPIDEV_BARO, false);
#ifdef CONFIG_MMCSD
/* First, get an instance of the SDIO interface */
+18 -2
View File
@@ -151,8 +151,24 @@ __EXPORT uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devi
#ifdef CONFIG_STM32_SPI2
__EXPORT void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
/* there can only be one device on this bus, so always select it */
stm32_gpiowrite(GPIO_SPI_CS_FRAM, !selected);
/* SPI select is active low, so write !selected to select the device */
switch (devid) {
case SPIDEV_FLASH:
/* Making sure the other peripherals are not selected */
stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1);
stm32_gpiowrite(GPIO_SPI_CS_FRAM, !selected);
break;
case PX4_SPIDEV_BARO:
/* Making sure the other peripherals are not selected */
stm32_gpiowrite(GPIO_SPI_CS_FRAM, 1);
stm32_gpiowrite(GPIO_SPI_CS_MS5611, !selected);
break;
default:
break;
}
}
__EXPORT uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
@@ -34,7 +34,7 @@
/**
* @file camera_trigger.cpp
*
* External camera-IMU synchronisation and triggering via FMU auxillary pins.
* External camera-IMU synchronisation and triggering via FMU auxiliary pins.
*
* @author Mohammed Kabir <mhkabir98@gmail.com>
*/
@@ -79,6 +79,8 @@ PARAM_DEFINE_FLOAT(TRIG_ACT_TIME, 0.5f);
*
* 0 disables the trigger, 1 sets it to enabled on command, 2 always on
*
* @reboot_required true
*
* @min 0
* @max 2
* @group Camera trigger
+2 -2
View File
@@ -55,11 +55,11 @@
PARAM_DEFINE_INT32(GMB_USE_MNT, 0);
/**
* Auxilary switch to set mount operation mode.
* Auxiliary switch to set mount operation mode.
*
* Set to 0 to disable manual mode control.
*
* If set to an auxilary switch:
* If set to an auxiliary switch:
* Switch off means the gimbal is put into safe/locked position.
* Switch on means the gimbal can move freely, and landing gear
* will be retracted if applicable.
+1 -1
View File
@@ -72,7 +72,7 @@ typedef struct {
uint32_t msl_altitude; ///< MSL altitude in meters * 10^2
uint32_t ground_speed; ///< velocity in m/s
int32_t heading; ///< heading in degrees * 10^2
uint8_t satellites; ///< number of sattelites used
uint8_t satellites; ///< number of satellites used
uint8_t fix_type; ///< fix type: XXX correct for that
uint32_t date;
uint32_t utc_time;
+2 -2
View File
@@ -44,8 +44,8 @@
* @author Hannes Delago
* (rework, add ubx7+ compatibility)
*
* @see http://www.u-blox.com/images/downloads/Product_Docs/u-blox6_ReceiverDescriptionProtocolSpec_%28GPS.G6-SW-10018%29.pdf
* @see http://www.u-blox.com/images/downloads/Product_Docs/u-bloxM8_ReceiverDescriptionProtocolSpec_%28UBX-13003221%29_Public.pdf
* @see https://www2.u-blox.com/images/downloads/Product_Docs/u-blox6-GPS-GLONASS-QZSS-V14_ReceiverDescriptionProtocolSpec_Public_(GPS.G6-SW-12013).pdf
* @see https://www.u-blox.com/sites/default/files/products/documents/u-bloxM8_ReceiverDescrProtSpec_%28UBX-13003221%29_Public.pdf
*/
#include <assert.h>
@@ -182,7 +182,7 @@ hott_sensors_thread_main(int argc, char *argv[])
recv_data(uart, &buffer[0], &size, &id);
// Determine which moduel sent it and process accordingly.
// Determine which module sent it and process accordingly.
if (id == GAM_SENSOR_ID) {
publish_gam_message(buffer);
+1 -1
View File
@@ -291,7 +291,7 @@ build_gps_response(uint8_t *buffer, size_t *size)
msg.altitude_L = (uint8_t)alt & 0xff;
msg.altitude_H = (uint8_t)(alt >> 8) & 0xff;
/* Get any (and probably only ever one) _home_sub postion report */
/* Get any (and probably only ever one) _home_sub position report */
bool updated;
orb_check(_home_sub, &updated);
+1 -1
View File
@@ -211,7 +211,7 @@ struct gps_module_msg {
uint8_t resolution_L; /**< 48 = Low Byte m/s resolution 0.01m 48 = 30000 = 0.00m/s (1=0.01m/s) */
uint8_t resolution_H; /**< 117 = High Byte m/s resolution 0.01m */
uint8_t unknown1; /**< 120 = 0m/3s */
uint8_t gps_num_sat; /**< GPS.Satellites (number of satelites) (1 byte) */
uint8_t gps_num_sat; /**< GPS.Satellites (number of satellites) (1 byte) */
uint8_t gps_fix_char; /**< GPS.FixChar. (GPS fix character. display, if DGPS, 2D oder 3D) (1 byte) */
uint8_t home_direction; /**< HomeDirection (direction from starting point to Model position) (1 byte) */
uint8_t angle_x_direction; /**< angle x-direction (1 byte) */
+1 -1
View File
@@ -265,7 +265,7 @@ MS5611_I2C::_read_prom()
/* check if all bytes are zero */
if (i == 0) {
/* initalize to first byte read */
/* initialize to first byte read */
last_val = prom_buf[0];
}
+1 -1
View File
@@ -829,7 +829,7 @@ struct ms5611_bus_option {
{ MS5611_BUS_SPI_EXTERNAL, "/dev/ms5611_spi_ext", &MS5611_spi_interface, PX4_SPI_BUS_EXT, NULL },
#endif
#ifdef PX4_SPIDEV_BARO
{ MS5611_BUS_SPI_INTERNAL, "/dev/ms5611_spi_int", &MS5611_spi_interface, PX4_SPI_BUS_SENSORS, NULL },
{ MS5611_BUS_SPI_INTERNAL, "/dev/ms5611_spi_int", &MS5611_spi_interface, PX4_SPI_BUS_BARO, NULL },
#endif
#ifdef PX4_I2C_BUS_ONBOARD
{ MS5611_BUS_I2C_INTERNAL, "/dev/ms5611_int", &MS5611_i2c_interface, PX4_I2C_BUS_ONBOARD, NULL },
+1 -1
View File
@@ -536,7 +536,7 @@ void PWMIN::print_info(void)
/*
* Handle the interupt, gathering pulse data
* Handle the interrupt, gathering pulse data
*/
static int pwmin_tim_isr(int irq, void *context)
{
+2 -2
View File
@@ -502,8 +502,8 @@ PWMSim::task_main()
PX4_ISFINITE(outputs.output[i]) &&
outputs.output[i] >= -1.0f &&
outputs.output[i] <= 1.0f) {
/* scale for PWM output 900 - 2100us */
outputs.output[i] = 1500 + (600 * outputs.output[i]);
/* scale for PWM output 1000 - 2000us */
outputs.output[i] = 1500 + (500 * outputs.output[i]);
} else {
/*
+354 -62
View File
@@ -119,6 +119,27 @@ public:
int set_i2c_bus_clock(unsigned bus, unsigned clock_hz);
private:
enum RC_SCAN {
RC_SCAN_PPM = 0,
RC_SCAN_SBUS,
RC_SCAN_DSM,
RC_SCAN_SUMD,
RC_SCAN_ST24
};
enum RC_SCAN _rc_scan_state = RC_SCAN_SBUS;
char const *RC_SCAN_STRING[5] = {
"PPM",
"SBUS",
"DSM",
"SUMD",
"ST24"
};
hrt_abstime _rc_scan_begin = 0;
bool _rc_scan_locked = false;
bool _report_lock = true;
static const unsigned _max_actuators = DIRECT_PWM_OUTPUT_CHANNELS;
Mode _mode;
@@ -134,8 +155,8 @@ private:
orb_advert_t _outputs_pub;
unsigned _num_outputs;
int _class_instance;
int _sbus_fd;
int _dsm_fd;
int _rcs_fd;
uint8_t _rcs_buf[SBUS_FRAME_SIZE];
volatile bool _initialized;
bool _throttle_armed;
@@ -199,6 +220,14 @@ private:
/* do not allow to copy due to ptr data members */
PX4FMU(const PX4FMU &);
PX4FMU operator=(const PX4FMU &);
void fill_rc_in(uint16_t raw_rc_count,
uint16_t raw_rc_values[input_rc_s::RC_INPUT_MAX_CHANNELS],
hrt_abstime now, bool frame_drop, bool failsafe,
unsigned frame_drops, int rssi);
void dsm_bind_ioctl(int dsmMode);
void set_rc_scan_state(RC_SCAN _rc_scan_state);
void rc_io_invert();
void rc_io_invert(bool invert);
};
const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
@@ -280,8 +309,7 @@ PX4FMU::PX4FMU() :
_outputs_pub(nullptr),
_num_outputs(0),
_class_instance(0),
_sbus_fd(-1),
_dsm_fd(-1),
_rcs_fd(-1),
_initialized(false),
_throttle_armed(false),
_pwm_on(false),
@@ -613,6 +641,56 @@ PX4FMU::cycle_trampoline(void *arg)
dev->cycle();
}
void PX4FMU::fill_rc_in(uint16_t raw_rc_count,
uint16_t raw_rc_values[input_rc_s::RC_INPUT_MAX_CHANNELS],
hrt_abstime now, bool frame_drop, bool failsafe,
unsigned frame_drops, int rssi = -1)
{
// fill rc_in struct for publishing
_rc_in.channel_count = raw_rc_count;
if (_rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) {
_rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS;
}
for (uint8_t i = 0; i < _rc_in.channel_count; i++) {
_rc_in.values[i] = raw_rc_values[i];
}
_rc_in.timestamp_publication = now;
_rc_in.timestamp_last_signal = _rc_in.timestamp_publication;
_rc_in.rc_ppm_frame_length = 0;
if (rssi == -1) {
_rc_in.rssi =
(!frame_drop) ? RC_INPUT_RSSI_MAX : (RC_INPUT_RSSI_MAX / 2);
}
_rc_in.rc_failsafe = failsafe;
_rc_in.rc_lost = false;
_rc_in.rc_lost_frame_count = frame_drops;
_rc_in.rc_total_frame_count = 0;
}
#ifdef RC_SERIAL_PORT
void PX4FMU::set_rc_scan_state(RC_SCAN newState)
{
// warnx("RCscan: %s failed, trying %s", PX4FMU::RC_SCAN_STRING[_rc_scan_state], PX4FMU::RC_SCAN_STRING[newState]);
_rc_scan_begin = 0;
_rc_scan_state = newState;
}
void PX4FMU::rc_io_invert(bool invert)
{
INVERT_RC_INPUT(invert);
if (!invert) {
// set FMU_RC_OUTPUT high to pull RC_INPUT up
stm32_gpiowrite(GPIO_RC_OUT, 1);
}
}
#endif
void
PX4FMU::cycle()
{
@@ -631,19 +709,18 @@ PX4FMU::cycle()
update_pwm_rev_mask();
#ifdef SBUS_SERIAL_PORT
_sbus_fd = sbus_init(SBUS_SERIAL_PORT, false);
#endif
#ifdef DSM_SERIAL_PORT
// XXX rather than opening it we need to cycle between protocols until one is locked in
//_dsm_fd = dsm_init(DSM_SERIAL_PORT);
#ifdef RC_SERIAL_PORT
// dsm_init sets some file static variables and returns a file descriptor
_rcs_fd = dsm_init(RC_SERIAL_PORT);
// assume SBUS input
sbus_config(_rcs_fd, false);
// disable CPPM input by mapping it away from the timer capture input
stm32_configgpio(GPIO_PPM_IN & ~(GPIO_AF_MASK | GPIO_PUPD_MASK));
#endif
_initialized = true;
}
if (_groups_subscribed != _groups_required) {
subscribe();
_groups_subscribed = _groups_required;
@@ -807,74 +884,237 @@ PX4FMU::cycle()
orb_copy(ORB_ID(parameter_update), _param_sub, &pupdate);
update_pwm_rev_mask();
int32_t dsm_bind_val;
param_t dsm_bind_param;
/* see if bind parameter has been set, and reset it to -1 */
param_get(dsm_bind_param = param_find("RC_DSM_BIND"), &dsm_bind_val);
if (dsm_bind_val > -1) {
dsm_bind_ioctl(dsm_bind_val);
dsm_bind_val = -1;
param_set(dsm_bind_param, &dsm_bind_val);
}
}
bool rc_updated = false;
#ifdef SBUS_SERIAL_PORT
#ifdef RC_SERIAL_PORT
// This block scans for a supported serial RC input and locks onto the first one found
// Scan for 100 msec, then switch protocol
constexpr hrt_abstime rc_scan_max = 100 * 1000;
bool sbus_failsafe, sbus_frame_drop;
uint16_t raw_rc_values[input_rc_s::RC_INPUT_MAX_CHANNELS];
uint16_t raw_rc_count;
bool sbus_updated = sbus_input(_sbus_fd, &raw_rc_values[0], &raw_rc_count, &sbus_failsafe, &sbus_frame_drop,
input_rc_s::RC_INPUT_MAX_CHANNELS);
unsigned frame_drops;
bool dsm_11_bit;
if (sbus_updated) {
// we have a new PPM frame. Publish it.
_rc_in.channel_count = raw_rc_count;
if (_rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) {
_rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS;
}
for (uint8_t i = 0; i < _rc_in.channel_count; i++) {
_rc_in.values[i] = raw_rc_values[i];
}
_rc_in.timestamp_publication = hrt_absolute_time();
_rc_in.timestamp_last_signal = _rc_in.timestamp_publication;
_rc_in.rc_ppm_frame_length = 0;
_rc_in.rssi = (!sbus_frame_drop) ? RC_INPUT_RSSI_MAX : (RC_INPUT_RSSI_MAX / 2);
_rc_in.rc_failsafe = sbus_failsafe;
_rc_in.rc_lost = false;
_rc_in.rc_lost_frame_count = sbus_dropped_frames();
_rc_in.rc_total_frame_count = 0;
rc_updated = true;
if (_report_lock && _rc_scan_locked) {
_report_lock = false;
warnx("RCscan: %s RC input locked", RC_SCAN_STRING[_rc_scan_state]);
}
#endif
// read all available data from the serial RC input UART
hrt_abstime now = hrt_absolute_time();
int newBytes = ::read(_rcs_fd, &_rcs_buf[0], SBUS_FRAME_SIZE);
switch (_rc_scan_state) {
case RC_SCAN_SBUS:
if (_rc_scan_begin == 0) {
_rc_scan_begin = now;
// Configure serial port for SBUS
sbus_config(_rcs_fd, false);
rc_io_invert(true);
} else if (_rc_scan_locked
|| now - _rc_scan_begin < rc_scan_max) {
// parse new data
if (newBytes > 0) {
rc_updated = sbus_parse(now, &_rcs_buf[0], newBytes, &raw_rc_values[0], &raw_rc_count, &sbus_failsafe,
&sbus_frame_drop, &frame_drops, input_rc_s::RC_INPUT_MAX_CHANNELS);
if (rc_updated) {
// we have a new SBUS frame. Publish it.
_rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_SBUS;
fill_rc_in(raw_rc_count, raw_rc_values, now,
sbus_frame_drop, sbus_failsafe, frame_drops);
_rc_scan_locked = true;
}
}
} else {
// Scan the next protocol
set_rc_scan_state(RC_SCAN_DSM);
}
break;
case RC_SCAN_DSM:
if (_rc_scan_begin == 0) {
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
rc_io_invert(false);
} else if (_rc_scan_locked
|| now - _rc_scan_begin < rc_scan_max) {
if (newBytes > 0) {
// parse new data
rc_updated = dsm_parse(now, &_rcs_buf[0], newBytes, &raw_rc_values[0], &raw_rc_count,
&dsm_11_bit, &frame_drops, input_rc_s::RC_INPUT_MAX_CHANNELS);
if (rc_updated) {
// we have a new DSM frame. Publish it.
_rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_DSM;
fill_rc_in(raw_rc_count, raw_rc_values, now,
false, false, frame_drops);
_rc_scan_locked = true;
}
}
} else {
// Scan the next protocol
set_rc_scan_state(RC_SCAN_ST24);
}
break;
case RC_SCAN_ST24:
if (_rc_scan_begin == 0) {
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
rc_io_invert(false);
} else if (_rc_scan_locked
|| now - _rc_scan_begin < rc_scan_max) {
if (newBytes > 0) {
// parse new data
uint8_t st24_rssi, rx_count;
rc_updated = false;
for (unsigned i = 0; i < newBytes; i++) {
/* set updated flag if one complete packet was parsed */
st24_rssi = RC_INPUT_RSSI_MAX;
rc_updated = (OK == st24_decode(_rcs_buf[i], &st24_rssi, &rx_count,
&raw_rc_count, raw_rc_values, input_rc_s::RC_INPUT_MAX_CHANNELS));
}
if (rc_updated) {
// we have a new ST24 frame. Publish it.
_rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_ST24;
fill_rc_in(raw_rc_count, raw_rc_values, now,
false, false, frame_drops, st24_rssi);
_rc_scan_locked = true;
}
}
} else {
// Scan the next protocol
set_rc_scan_state(RC_SCAN_SUMD);
}
break;
case RC_SCAN_SUMD:
if (_rc_scan_begin == 0) {
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
rc_io_invert(false);
} else if (_rc_scan_locked
|| now - _rc_scan_begin < rc_scan_max) {
if (newBytes > 0) {
// parse new data
uint8_t sumd_rssi, rx_count;
rc_updated = false;
for (unsigned i = 0; i < newBytes; i++) {
/* set updated flag if one complete packet was parsed */
sumd_rssi = RC_INPUT_RSSI_MAX;
rc_updated = (OK == sumd_decode(_rcs_buf[i], &sumd_rssi, &rx_count,
&raw_rc_count, raw_rc_values, input_rc_s::RC_INPUT_MAX_CHANNELS));
}
if (rc_updated) {
// we have a new SUMD frame. Publish it.
_rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_SUMD;
fill_rc_in(raw_rc_count, raw_rc_values, now,
false, false, frame_drops, sumd_rssi);
_rc_scan_locked = true;
}
}
} else {
// Scan the next protocol
set_rc_scan_state(RC_SCAN_SUMD);
}
set_rc_scan_state(RC_SCAN_PPM);
break;
case RC_SCAN_PPM:
// skip PPM if it's not supported
#ifdef HRT_PPM_CHANNEL
if (_rc_scan_begin == 0) {
_rc_scan_begin = now;
// Configure timer input pin for CPPM
stm32_configgpio(GPIO_PPM_IN);
rc_io_invert(false);
} else if (_rc_scan_locked
|| now - _rc_scan_begin < rc_scan_max) {
// see if we have new PPM input data
if ((ppm_last_valid_decode != _rc_in.timestamp_last_signal)
&& ppm_decoded_channels > 3) {
// we have a new PPM frame. Publish it.
rc_updated = true;
_rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM;
fill_rc_in(ppm_decoded_channels, ppm_buffer, now,
false, false, 0);
_rc_scan_locked = true;
}
} else {
// disable CPPM input by mapping it away from the timer capture input
stm32_configgpio(GPIO_PPM_IN & ~(GPIO_AF_MASK | GPIO_PUPD_MASK));
// Scan the next protocol
set_rc_scan_state(RC_SCAN_SBUS);
}
#else // skip PPM if it's not supported
set_rc_scan_state(RC_SCAN_SBUS);
#endif // HRT_PPM_CHANNEL
break;
}
#else // RC_SERIAL_PORT not defined
#ifdef HRT_PPM_CHANNEL
// see if we have new PPM input data
if ((ppm_last_valid_decode != _rc_in.timestamp_last_signal) &&
ppm_decoded_channels > 3) {
if ((ppm_last_valid_decode != _rc_in.timestamp_last_signal)
&& ppm_decoded_channels > 3) {
// we have a new PPM frame. Publish it.
_rc_in.channel_count = ppm_decoded_channels;
if (_rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) {
_rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS;
}
for (uint8_t i = 0; i < _rc_in.channel_count; i++) {
_rc_in.values[i] = ppm_buffer[i];
}
_rc_in.timestamp_publication = ppm_last_valid_decode;
_rc_in.timestamp_last_signal = ppm_last_valid_decode;
_rc_in.rc_ppm_frame_length = ppm_frame_length;
_rc_in.rssi = RC_INPUT_RSSI_MAX;
_rc_in.rc_failsafe = false;
_rc_in.rc_lost = false;
_rc_in.rc_lost_frame_count = 0;
_rc_in.rc_total_frame_count = 0;
rc_updated = true;
fill_rc_in(ppm_decoded_channels, ppm_buffer, hrt_absolute_time(),
false, false, 0);
}
#endif
#endif // HRT_PPM_CHANNEL
#endif // RC_SERIAL_PORT
if (rc_updated) {
/* lazily advertise on first publication */
@@ -1363,6 +1603,38 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
break;
}
#ifdef RC_SERIAL_PORT
case DSM_BIND_START:
/* only allow DSM2, DSM-X and DSM-X with more than 7 channels */
warnx("fmu pwm_ioctl: DSM_BIND_START, arg: %lu", arg);
if (arg == DSM2_BIND_PULSES ||
arg == DSMX_BIND_PULSES ||
arg == DSMX8_BIND_PULSES) {
dsm_bind(DSM_CMD_BIND_POWER_DOWN, 0);
usleep(500000);
dsm_bind(DSM_CMD_BIND_SET_RX_OUT, 0);
dsm_bind(DSM_CMD_BIND_POWER_UP, 0);
usleep(72000);
dsm_bind(DSM_CMD_BIND_SEND_PULSES, arg);
usleep(50000);
dsm_bind(DSM_CMD_BIND_REINIT_UART, 0);
ret = OK;
} else {
ret = -EINVAL;
}
break;
#endif
case MIXERIOCRESET:
if (_mixers != nullptr) {
delete _mixers;
@@ -1831,6 +2103,26 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
return ret;
}
void
PX4FMU::dsm_bind_ioctl(int dsmMode)
{
if (!_armed.armed) {
// mavlink_log_info(_mavlink_fd, "[FMU] binding DSM%s RX", (dsmMode == 0) ? "2" : ((dsmMode == 1) ? "-X" : "-X8"));
warnx("[FMU] binding DSM%s RX", (dsmMode == 0) ? "2" : ((dsmMode == 1) ? "-X" : "-X8"));
int ret = ioctl(nullptr, DSM_BIND_START,
(dsmMode == 0) ? DSM2_BIND_PULSES : ((dsmMode == 1) ? DSMX_BIND_PULSES : DSMX8_BIND_PULSES));
if (ret) {
// mavlink_log_critical(_mavlink_fd, "binding failed.");
warnx("binding failed.");
}
} else {
// mavlink_log_info(_mavlink_fd, "[FMU] system armed, bind request rejected");
warnx("[FMU] system armed, bind request rejected");
}
}
namespace
{
@@ -2224,7 +2516,7 @@ fmu_main(int argc, char *argv[])
}
if (!strcmp(verb, "info")) {
#ifdef SBUS_SERIAL_PORT
#ifdef RC_SERIAL_PORT
warnx("frame drops: %u", sbus_dropped_frames());
#endif
return 0;
+12
View File
@@ -47,6 +47,8 @@
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -58,6 +60,8 @@ PARAM_DEFINE_INT32(PWM_AUX_REV1, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -69,6 +73,8 @@ PARAM_DEFINE_INT32(PWM_AUX_REV2, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -80,6 +86,8 @@ PARAM_DEFINE_INT32(PWM_AUX_REV3, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -91,6 +99,8 @@ PARAM_DEFINE_INT32(PWM_AUX_REV4, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -102,6 +112,8 @@ PARAM_DEFINE_INT32(PWM_AUX_REV5, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
+16
View File
@@ -47,6 +47,8 @@
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -58,6 +60,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV1, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -69,6 +73,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV2, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -80,6 +86,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV3, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -91,6 +99,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV4, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -102,6 +112,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV5, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -113,6 +125,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV6, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
@@ -124,6 +138,8 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV7, 0);
*
* Set to 1 to invert the channel, 0 for default direction.
*
* @reboot_required true
*
* @min 0
* @max 1
* @group PWM Outputs
+2 -2
View File
@@ -599,7 +599,7 @@ error:
#endif /* HRT_PPM_CHANNEL */
/**
* Handle the compare interupt by calling the callout dispatcher
* Handle the compare interrupt by calling the callout dispatcher
* and then re-scheduling the next deadline.
*/
static int
@@ -750,7 +750,7 @@ hrt_store_absolute_time(volatile hrt_abstime *now)
}
/**
* Initalise the high-resolution timing module.
* Initialise the high-resolution timing module.
*/
void
hrt_init(void)
+1 -1
View File
@@ -36,7 +36,7 @@ add_dependencies(run_config mainapp)
foreach(viewer none jmavsim gazebo)
foreach(debugger none gdb lldb ddd valgrind)
foreach(model none iris tailsitter)
foreach(model none iris tailsitter standard_vtol)
if (debugger STREQUAL "none")
if (model STREQUAL "none")
set(_targ_name "${viewer}")
+14 -16
View File
@@ -1,32 +1,30 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes")
px4_qurt_generate_builtin_commands(
OUT ${CMAKE_BINARY_DIR}/apps.h
MODULE_LIST ${module_libraries})
# Clear -rdynamic flag which fails for hexagon
# this change is scoped in this directory and below
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable build without HexagonSDK to check link dependencies
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
add_definitions(-DQURT_EXE_BUILD)
add_executable(mainapp
${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c
${CMAKE_BINARY_DIR}/apps.h)
else()
add_library(mainapp
QURT_BUNDLE(APP_NAME
mainapp
DSP_SOURCES
${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c
${CMAKE_BINARY_DIR}/apps.h)
${CMAKE_BINARY_DIR}/apps.h
DSP_LINK_LIBS
${module_libraries}
${target_libraries}
df_driver_framework
m
)
endif()
target_link_libraries(mainapp
-Wl,--whole-archive
${module_libraries}
${target_libraries}
df_driver_framework
m
-Wl,--no-whole-archive
-Wl,${TOOLSLIB}/pic/libstdc++.a)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
+41
View File
@@ -0,0 +1,41 @@
/****************************************************************************
* Copyright (c) 2015 Mark Charlebois. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name ATLFlight nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef MAINAPP_IDL
#define MAINAPP_IDL
#include "AEEStdDef.idl"
interface mainapp{
uint32 test();
};
#endif /*MAINAPP_IDL*/
+1 -1
View File
@@ -51,7 +51,7 @@ enum LaunchDetectionResult {
up and still be set to 'throttlePreTakeoff'.
For instance this is used to have a delay for the motor
when launching a fixed wing aircraft from a bungee */
LAUNCHDETECTION_RES_DETECTED_ENABLEMOTORS = 2 /**< Launch has been detected, teh controller should control
LAUNCHDETECTION_RES_DETECTED_ENABLEMOTORS = 2 /**< Launch has been detected, the controller should control
attitude and also throttle up the motors. */
};
@@ -54,7 +54,7 @@
PARAM_DEFINE_INT32(LAUN_ALL_ON, 0);
/**
* Catapult accelerometer theshold.
* Catapult accelerometer threshold.
*
* LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection.
*
@@ -64,7 +64,7 @@ PARAM_DEFINE_INT32(LAUN_ALL_ON, 0);
PARAM_DEFINE_FLOAT(LAUN_CAT_A, 30.0f);
/**
* Catapult time theshold.
* Catapult time threshold.
*
* LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection.
*
+1 -1
View File
@@ -615,7 +615,7 @@ sbus_decode(uint64_t frame_time, uint8_t *frame, uint16_t *values, uint16_t *num
*
* Attention! This flag indicates a skipped frame only, not a total link loss! Handling this
* condition as fail-safe greatly reduces the reliability and range of the radio link,
* e.g. by prematurely issueing return-to-launch!!! */
* e.g. by prematurely issuing return-to-launch!!! */
*sbus_failsafe = false;
*sbus_frame_drop = true;
@@ -2,7 +2,7 @@ function [xa_apo,Pa_apo,Rot_matrix,eulerAngles,debugOutput]...
= AttitudeEKF(approx_prediction,use_inertia_matrix,zFlag,dt,z,q_rotSpeed,q_rotAcc,q_acc,q_mag,r_gyro,r_accel,r_mag,J)
%LQG Postion Estimator and Controller
%LQG Position Estimator and Controller
% Observer:
% x[n|n] = x[n|n-1] + M(y[n] - Cx[n|n-1] - Du[n])
% x[n+1|n] = Ax[n|n] + Bu[n]
@@ -499,7 +499,7 @@ void AttitudeEKF(unsigned char approx_prediction, unsigned char
float b_z[6];
/* LQG Postion Estimator and Controller */
/* LQG Position Estimator and Controller */
/* Observer: */
/* x[n|n] = x[n|n-1] + M(y[n] - Cx[n|n-1] - Du[n]) */
/* x[n+1|n] = Ax[n|n] + Bu[n] */
+3 -3
View File
@@ -417,7 +417,7 @@ int commander_main(int argc, char *argv[])
/* see if we got a home position */
if (status.condition_home_position_valid) {
if (TRANSITION_CHANGED == arm_disarm(true, mavlink_fd_local, "command line")) {
if (TRANSITION_DENIED != arm_disarm(true, mavlink_fd_local, "command line")) {
vehicle_command_s cmd = {};
cmd.target_system = status.system_id;
@@ -3018,8 +3018,8 @@ set_control_mode()
control_mode.flag_control_attitude_enabled = true;
control_mode.flag_control_altitude_enabled = true;
control_mode.flag_control_climb_rate_enabled = true;
control_mode.flag_control_position_enabled = true;
control_mode.flag_control_velocity_enabled = true;
control_mode.flag_control_position_enabled = !status.in_transition_mode;
control_mode.flag_control_velocity_enabled = !status.in_transition_mode;
control_mode.flag_control_termination_enabled = false;
break;
@@ -75,11 +75,11 @@ bool StateMachineHelperTest::armingStateTransitionTest(void)
} ArmingTransitionVolatileState_t;
// This structure represents a test case for arming_state_transition. It contains the machine
// state prior to transtion, the requested state to transition to and finally the expected
// state prior to transition, the requested state to transition to and finally the expected
// machine state after transition.
typedef struct {
const char* assertMsg; // Text to show when test case fails
ArmingTransitionVolatileState_t current_state; // Machine state prior to transtion
ArmingTransitionVolatileState_t current_state; // Machine state prior to transition
hil_state_t hil_state; // Current vehicle_status_s.hil_state
bool condition_system_sensors_initialized; // Current vehicle_status_s.condition_system_sensors_initialized
bool safety_switch_available; // Current safety_s.safety_switch_available
+18 -4
View File
@@ -82,9 +82,10 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_pref
template <class T>
BlockParam<T>::BlockParam(Block *block, const char *name,
bool parent_prefix) :
bool parent_prefix, T *extern_address) :
BlockParamBase(block, name, parent_prefix),
_val()
_val(),
_extern_address(extern_address)
{
update();
}
@@ -93,12 +94,25 @@ template <class T>
T BlockParam<T>::get() { return _val; }
template <class T>
void BlockParam<T>::set(T val) { _val = val; }
void BlockParam<T>::set(T val)
{
_val = val;
if (_extern_address != NULL) {
*_extern_address = val;
}
}
template <class T>
void BlockParam<T>::update()
{
if (_handle != PARAM_INVALID) { param_get(_handle, &_val); }
if (_handle != PARAM_INVALID) {
param_get(_handle, &_val);
if (_extern_address != NULL) {
*_extern_address = _val;
}
}
}
template <class T>
+2 -1
View File
@@ -77,7 +77,7 @@ class BlockParam : public BlockParamBase
{
public:
BlockParam(Block *block, const char *name,
bool parent_prefix = true);
bool parent_prefix = true, T *extern_address = NULL);
T get();
void commit();
void set(T val);
@@ -85,6 +85,7 @@ public:
virtual ~BlockParam();
protected:
T _val;
T *_extern_address;
};
typedef BlockParam<float> BlockParamFloat;
+74 -9
View File
@@ -63,6 +63,7 @@
#include <mavlink/mavlink_log.h>
#include <platforms/px4_defines.h>
#include <drivers/drv_hrt.h>
#include <controllib/uorb/blocks.hpp>
#include <uORB/topics/sensor_combined.h>
#include <uORB/topics/vehicle_gps_position.h>
@@ -71,6 +72,7 @@
#include <uORB/topics/vehicle_local_position.h>
#include <uORB/topics/control_state.h>
#include <uORB/topics/vehicle_global_position.h>
#include <uORB/topics/parameter_update.h>
#include <ecl/EKF/ekf.h>
@@ -86,7 +88,7 @@ Ekf2 *instance;
}
class Ekf2
class Ekf2 : public control::SuperBlock
{
public:
/**
@@ -133,6 +135,31 @@ private:
math::LowPassFilter2p _lp_pitch_rate;
math::LowPassFilter2p _lp_yaw_rate;
control::BlockParamFloat *_mag_delay_ms;
control::BlockParamFloat *_baro_delay_ms;
control::BlockParamFloat *_gps_delay_ms;
control::BlockParamFloat *_airspeed_delay_ms;
control::BlockParamFloat *_requiredEph;
control::BlockParamFloat *_requiredEpv;
control::BlockParamFloat *_gyro_noise;
control::BlockParamFloat *_accel_noise;
// process noise
control::BlockParamFloat *_gyro_bias_p_noise;
control::BlockParamFloat *_accel_bias_p_noise;
control::BlockParamFloat *_gyro_scale_p_noise;
control::BlockParamFloat *_mag_p_noise;
control::BlockParamFloat *_wind_vel_p_noise;
control::BlockParamFloat *_gps_vel_noise;
control::BlockParamFloat *_gps_pos_noise;
control::BlockParamFloat *_baro_noise;
control::BlockParamFloat *_mag_heading_noise; // measurement noise used for simple heading fusion
control::BlockParamFloat *_mag_declination_deg; // magnetic declination in degrees
control::BlockParamFloat *_heading_innov_gate; // innovation gate for heading innovation test
EstimatorBase *_ekf;
@@ -143,14 +170,40 @@ private:
};
Ekf2::Ekf2():
_lp_roll_rate(250.0f, 30.0f),
_lp_pitch_rate(250.0f, 30.0f),
_lp_yaw_rate(250.0f, 20.0f)
SuperBlock(NULL, "EKF"),
_lp_roll_rate(250.0f, 30.0f),
_lp_pitch_rate(250.0f, 30.0f),
_lp_yaw_rate(250.0f, 20.0f)
{
_ekf = new Ekf();
_att_pub = nullptr;
_lpos_pub = nullptr;
_control_state_pub = nullptr;
parameters *params = _ekf->getParamHandle();
_mag_delay_ms = new control::BlockParamFloat(this, "EKF2_MAG_DELAY", false, &params->mag_delay_ms);
_baro_delay_ms = new control::BlockParamFloat(this, "EKF2_BARO_DELAY", false, &params->baro_delay_ms);
_gps_delay_ms = new control::BlockParamFloat(this, "EKF2_GPS_DELAY", false, &params->gps_delay_ms);
_airspeed_delay_ms = new control::BlockParamFloat(this, "EKF2_ASP_DELAY", false, &params->airspeed_delay_ms);
_requiredEph = new control::BlockParamFloat(this, "EKF2_REQ_EPH", false, &params->requiredEph);
_requiredEpv = new control::BlockParamFloat(this, "EKF2_REQ_EPV", false, &params->requiredEpv);
_gyro_noise = new control::BlockParamFloat(this, "EKF2_G_NOISE", false, &params->gyro_noise);
_accel_noise = new control::BlockParamFloat(this, "EKF2_ACC_NOISE", false, &params->accel_noise);
_gyro_bias_p_noise = new control::BlockParamFloat(this, "EKF2_GB_NOISE", false, &params->gyro_bias_p_noise);
_accel_bias_p_noise = new control::BlockParamFloat(this, "EKF2_ACCB_NOISE", false, &params->accel_bias_p_noise);
_gyro_scale_p_noise = new control::BlockParamFloat(this, "EKF2_GS_NOISE", false, &params->gyro_scale_p_noise);
_mag_p_noise = new control::BlockParamFloat(this, "EKF2_MAG_NOISE", false, &params->mag_p_noise);
_wind_vel_p_noise = new control::BlockParamFloat(this, "EKF2_WIND_NOISE", false, &params->wind_vel_p_noise);
_gps_vel_noise = new control::BlockParamFloat(this, "EKF2_GPS_V_NOISE", false, &params->gps_vel_noise);
_gps_pos_noise = new control::BlockParamFloat(this, "EKF2_GPS_P_NOISE", false, &params->gps_pos_noise);
_baro_noise = new control::BlockParamFloat(this, "EKF2_BARO_NOISE", false, &params->baro_noise);
_mag_heading_noise = new control::BlockParamFloat(this, "EKF2_HEAD_NOISE", false, &params->mag_heading_noise);
_mag_declination_deg = new control::BlockParamFloat(this, "EKF2_MAG_DECL", false, &params->mag_declination_deg);
_heading_innov_gate = new control::BlockParamFloat(this, "EKF2_H_INOV_GATE", false, &params->heading_innov_gate);
}
Ekf2::~Ekf2()
@@ -182,6 +235,9 @@ void Ekf2::task_main()
fds[0].fd = _sensors_sub;
fds[0].events = POLLIN;
// initialise parameter cache
updateParams();
while (!_task_should_exit) {
int ret = px4_poll(fds, 1, 1000);
@@ -195,6 +251,8 @@ void Ekf2::task_main()
continue;
}
updateParams();
bool gps_updated = false;
bool airspeed_updated = false;
@@ -294,11 +352,13 @@ void Ekf2::task_main()
// Position of local NED origin in GPS / WGS84 frame
lpos.ref_timestamp = _ekf->_last_gps_origin_time_us; // Time when reference position was set
lpos.xy_global = _ekf->position_is_valid();// true if position (x, y) is valid and has valid global reference (ref_lat, ref_lon)
lpos.z_global = true;// true if z is valid and has valid global reference (ref_alt)
lpos.xy_global =
_ekf->position_is_valid();// true if position (x, y) is valid and has valid global reference (ref_lat, ref_lon)
lpos.z_global = true;// true if z is valid and has valid global reference (ref_alt)
lpos.ref_lat = _ekf->_posRef.lat_rad * (double)180.0 * M_PI; // Reference point latitude in degrees
lpos.ref_lon = _ekf->_posRef.lon_rad * (double)180.0 * M_PI; // Reference point longitude in degrees
lpos.ref_alt = _ekf->_gps_alt_ref; // Reference altitude AMSL in meters, MUST be set to current (not at reference point!) ground level
lpos.ref_alt =
_ekf->_gps_alt_ref; // Reference altitude AMSL in meters, MUST be set to current (not at reference point!) ground level
// The rotation of the tangent plane vs. geographical north
lpos.yaw = 0.0f;
@@ -308,7 +368,7 @@ void Ekf2::task_main()
lpos.surface_bottom_timestamp = 0; // Time when new bottom surface found
lpos.dist_bottom_valid = false; // true if distance to bottom surface is valid
// TODO: uORB definition does not define what thes variables are. We have assumed them to be horizontal and vertical 1-std dev accuracy in metres
// TODO: uORB definition does not define what thes variables are. We have assumed them to be horizontal and vertical 1-std dev accuracy in metres
// TODO: Should use sqrt of filter position variances
lpos.eph = gps.eph;
lpos.epv = gps.epv;
@@ -316,6 +376,7 @@ void Ekf2::task_main()
// publish vehicle local position data
if (_lpos_pub == nullptr) {
_lpos_pub = orb_advertise(ORB_ID(vehicle_local_position), &lpos);
} else {
orb_publish(ORB_ID(vehicle_local_position), _lpos_pub, &lpos);
}
@@ -335,6 +396,7 @@ void Ekf2::task_main()
// publish control state data
if (_control_state_pub == nullptr) {
_control_state_pub = orb_advertise(ORB_ID(control_state), &ctrl_state);
} else {
orb_publish(ORB_ID(control_state), _control_state_pub, &ctrl_state);
}
@@ -353,12 +415,14 @@ void Ekf2::task_main()
// publish vehicle attitude data
if (_att_pub == nullptr) {
_att_pub = orb_advertise(ORB_ID(vehicle_attitude), &att);
} else {
orb_publish(ORB_ID(vehicle_attitude), _att_pub, &att);
}
// generate and publish global position data
struct vehicle_global_position_s global_pos;
if (_ekf->position_is_valid()) {
// TODO: local origin is currenlty at GPS height origin - this is different to ekf_att_pos_estimator
@@ -391,6 +455,7 @@ void Ekf2::task_main()
if (_vehicle_global_position_pub == nullptr) {
_vehicle_global_position_pub = orb_advertise(ORB_ID(vehicle_global_position), &global_pos);
} else {
orb_publish(ORB_ID(vehicle_global_position), _vehicle_global_position_pub, &global_pos);
}
@@ -467,7 +532,7 @@ int ekf2_main(int argc, char *argv[])
if (!strcmp(argv[1], "print")) {
if (ekf2::instance != nullptr) {
return 0;
}
+226
View File
@@ -0,0 +1,226 @@
/****************************************************************************
*
* Copyright (c) 2015 Estimation and Control Library (ECL). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name ECL nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file parameters.c
* Parameter definition for ekf2.
*
* @author Roman Bast <bapstroman@gmail.com>
*
*/
#include <systemlib/param/param.h>
/**
* Magnetometer measurement delay
*
* @group EKF2
* @min 0
* @max 300
* @unit ms
*/
PARAM_DEFINE_FLOAT(EKF2_MAG_DELAY, 0);
/**
* Barometer measurement delay
*
* @group EKF2
* @min 0
* @max 300
* @unit ms
*/
PARAM_DEFINE_FLOAT(EKF2_BARO_DELAY, 0);
/**
* GPS measurement delay
*
* @group EKF2
* @min 0
* @max 300
* @unit ms
*/
PARAM_DEFINE_FLOAT(EKF2_GPS_DELAY, 200);
/**
* Airspeed measurement delay
*
* @group EKF2
* @min 0
* @max 300
* @unit ms
*/
PARAM_DEFINE_FLOAT(EKF2_ASP_DELAY, 200);
/**
* Required EPH to use GPS.
*
* @group EKF2
* @min 2
* @max 100
* @unit m
*/
PARAM_DEFINE_FLOAT(EKF2_REQ_EPH, 10);
/**
* Required EPV to use GPS.
*
* @group EKF2
* @min 2
* @max 100
* @unit m
*/
PARAM_DEFINE_FLOAT(EKF2_REQ_EPV, 20);
/**
* Gyro noise.
*
* @group EKF2
* @min 0.0001
* @max 0.05
*/
PARAM_DEFINE_FLOAT(EKF2_G_NOISE, 0.001f);
/**
* Process noise for delta velocity prediction.
*
* @group EKF2
* @min 0.01
* @max 1
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_ACC_NOISE, 0.1f);
/**
* Process noise for delta angle bias prediction.
*
* @group EKF2
* @min 0
* @max 0.0001
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_GB_NOISE, 1e-5f);
/**
* Process noise for delta velocity z bias prediction.
*
* @group EKF2
* @min 0.000001
* @max 0.01
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_ACCB_NOISE, 1e-3f);
/**
* Process noise for delta angle scale prediction.
*
* @group EKF2
* @min 0.000001
* @max 0.01
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_GS_NOISE, 1e-4f);
/**
* Process noise for earth magnetic field and bias prediction.
*
* @group EKF2
* @min 0.0001
* @max 0.1
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_MAG_NOISE, 1e-2f);
/**
* Process noise for wind velocity prediction.
*
* @group EKF2
* @min 0.01
* @max 1
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_WIND_NOISE, 0.05f);
/**
* Measurement noise for gps velocity.
*
* @group EKF2
* @min 0.001
* @max 0.5
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_GPS_V_NOISE, 0.05f);
/**
* Measurement noise for gps position.
*
* @group EKF2
* @min 0.01
* @max 5
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_GPS_P_NOISE, 1.0f);
/**
* Measurement noise for barometer.
*
* @group EKF2
* @min 0.001
* @max 1
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_BARO_NOISE, 0.1f);
/**
* Measurement noise for mag heading fusion.
*
* @group EKF2
* @min 0.0001
* @max 0.1
* @unit
*/
PARAM_DEFINE_FLOAT(EKF2_HEAD_NOISE, 3e-2f);
/**
* Magnetic declination
*
* @group EKF2
* @unit degrees
*/
PARAM_DEFINE_FLOAT(EKF2_MAG_DECL, 0);
/**
* Gate for maginetic heading fusion
*
* @group EKF2
*/
PARAM_DEFINE_FLOAT(EKF2_H_INOV_GATE, 0.5f);
@@ -74,12 +74,17 @@ static uint64_t IMUusec = 0;
static constexpr float rc = 10.0f; // RC time constant of 1st order LPF in seconds
static constexpr uint64_t FILTER_INIT_DELAY = 1 * 1000 * 1000; ///< units: microseconds
static constexpr float POS_RESET_THRESHOLD = 5.0f; ///< Seconds before we signal a total GPS failure
// These are unused
#if 0
static constexpr unsigned MAG_SWITCH_HYSTERESIS =
10; ///< Ignore the first few mag failures (which amounts to a few milliseconds)
static constexpr unsigned GYRO_SWITCH_HYSTERESIS =
5; ///< Ignore the first few gyro failures (which amounts to a few milliseconds)
static constexpr unsigned ACCEL_SWITCH_HYSTERESIS =
5; ///< Ignore the first few accel failures (which amounts to a few milliseconds)
#endif
static constexpr float EPH_LARGE_VALUE = 1000.0f;
static constexpr float EPV_LARGE_VALUE = 1000.0f;
@@ -973,24 +973,41 @@ void FixedwingPositionControl::get_waypoint_heading_distance(float heading, floa
{
waypoint_prev.valid = true;
waypoint_prev.alt = _hold_alt;
position_setpoint_s temp_next {};
position_setpoint_s temp_prev {};
if (flag_init) {
// on init set first waypoint to momentary position
waypoint_prev.lat = _global_pos.lat - cos(heading) * (double)(HDG_HOLD_SET_BACK_DIST) / 1e6;
waypoint_prev.lon = _global_pos.lon - sin(heading) * (double)(HDG_HOLD_SET_BACK_DIST) / 1e6;
// on init set previous waypoint HDG_HOLD_SET_BACK_DIST meters behind us
waypoint_from_heading_and_distance(_global_pos.lat, _global_pos.lon, heading + 180.0f * M_DEG_TO_RAD_F ,
HDG_HOLD_SET_BACK_DIST,
&temp_prev.lat, &temp_prev.lon);
// set next waypoint HDG_HOLD_DIST_NEXT meters in front of us
waypoint_from_heading_and_distance(_global_pos.lat, _global_pos.lon, heading, HDG_HOLD_DIST_NEXT,
&temp_next.lat, &temp_next.lon);
waypoint_prev = temp_prev;
waypoint_next = temp_next;
waypoint_next.valid = true;
waypoint_next.alt = _hold_alt;
return;
} else {
/*
for previous waypoint use the one still in front of us but shift it such that it is
located on the desired flight path but HDG_HOLD_SET_BACK_DIST behind us
*/
waypoint_prev.lat = waypoint_next.lat - cos(heading) * (double)(HDG_HOLD_REACHED_DIST + HDG_HOLD_SET_BACK_DIST) / 1e6;
waypoint_prev.lon = waypoint_next.lon - sin(heading) * (double)(HDG_HOLD_REACHED_DIST + HDG_HOLD_SET_BACK_DIST) / 1e6;
// for previous waypoint use the one still in front of us but shift it such that it is
// located on the desired flight path but HDG_HOLD_SET_BACK_DIST behind us
create_waypoint_from_line_and_dist(waypoint_next.lat, waypoint_next.lon, waypoint_prev.lat, waypoint_prev.lon,
HDG_HOLD_REACHED_DIST + HDG_HOLD_SET_BACK_DIST,
&temp_prev.lat, &temp_prev.lon);
}
waypoint_next.valid = true;
waypoint_next.lat = waypoint_prev.lat + cos(heading) * (double)(distance + HDG_HOLD_SET_BACK_DIST) / 1e6;
waypoint_next.lon = waypoint_prev.lon + sin(heading) * (double)(distance + HDG_HOLD_SET_BACK_DIST) / 1e6;
create_waypoint_from_line_and_dist(waypoint_next.lat, waypoint_next.lon, waypoint_prev.lat, waypoint_prev.lon,
-(HDG_HOLD_DIST_NEXT + HDG_HOLD_REACHED_DIST),
&temp_next.lat, &temp_next.lon);
waypoint_prev = temp_prev;
waypoint_next = temp_next;
waypoint_next.alt = _hold_alt;
}
@@ -145,7 +145,7 @@ private:
// predict the next state
void predict();
// correct the state prediction wtih a measurement
// correct the state prediction with a measurement
void correctBaro();
void correctGps();
void correctLidar();
+8 -5
View File
@@ -788,6 +788,7 @@ Mavlink::enable_flow_control(bool enabled)
{
// We can't do this on USB - skip
if (_is_usb_uart) {
_flow_control_enabled = false;
return OK;
}
@@ -843,7 +844,7 @@ Mavlink::get_free_tx_buf()
*/
int buf_free = 0;
// if we are using network sockets, return max lenght of one packet
// if we are using network sockets, return max length of one packet
if (get_protocol() == UDP || get_protocol() == TCP ) {
return 1500;
} else {
@@ -1045,7 +1046,7 @@ Mavlink::init_udp()
return;
}
/* set default target address, but not for onboard mode (will be set on first recieved packet) */
/* set default target address, but not for onboard mode (will be set on first received packet) */
memset((char *)&_src_addr, 0, sizeof(_src_addr));
if (_mode != MAVLINK_MODE_ONBOARD) {
set_client_source_initialized();
@@ -1459,7 +1460,7 @@ Mavlink::update_rate_mult()
/* scale down if we have a TX err rate suggesting link congestion */
if (_rate_txerr > 0.0f && !radio_critical) {
hardware_mult = (_rate_tx) / (_rate_tx + _rate_txerr);
} else if (radio_found && tstatus.timestamp != _last_hw_rate_timestamp) {
} else if (radio_found && tstatus.telem_time != _last_hw_rate_timestamp) {
if (tstatus.txbuf < RADIO_BUFFER_CRITICAL_LOW_PERCENTAGE) {
/* this indicates link congestion, reduce rate by 20% */
@@ -1473,12 +1474,13 @@ Mavlink::update_rate_mult()
/* limit to a max multiplier of 1 */
hardware_mult = fminf(1.0f, hardware_mult);
}
} else {
} else if (!radio_found) {
/* no limitation, set hardware to 1 */
hardware_mult = 1.0f;
}
_last_hw_rate_timestamp = tstatus.timestamp;
_last_hw_rate_timestamp = tstatus.telem_time;
/* pick the minimum from bandwidth mult and hardware mult as limit */
_rate_mult = fminf(bandwidth_mult, hardware_mult);
@@ -2201,6 +2203,7 @@ Mavlink::display_status()
printf("\tremote noise:\t%u\n", _rstatus.remote_noise);
printf("\trx errors:\t%u\n", _rstatus.rxerrors);
printf("\tfixed:\t\t%u\n", _rstatus.fixed);
printf("\tflow control:\t%s\n", (_flow_control_enabled) ? "ON" : "OFF");
} else {
printf("\tno telem status.\n");
+7
View File
@@ -780,6 +780,13 @@ MavlinkMissionManager::parse_mavlink_mission_item(const mavlink_mission_item_t *
case MAV_FRAME_MISSION:
// This is a mission item with no coordinate
mission_item->params[0] = mavlink_mission_item->param1;
mission_item->params[1] = mavlink_mission_item->param2;
mission_item->params[2] = mavlink_mission_item->param3;
mission_item->params[3] = mavlink_mission_item->param4;
mission_item->params[4] = mavlink_mission_item->x;
mission_item->params[5] = mavlink_mission_item->y;
mission_item->params[6] = mavlink_mission_item->z;
break;
default:
@@ -291,12 +291,6 @@ private:
namespace mc_att_control
{
/* oddly, ERROR is not defined for c++ */
#ifdef ERROR
# undef ERROR
#endif
static const int ERROR = -1;
MulticopterAttitudeControl *g_control;
}
@@ -1025,4 +1019,4 @@ int mc_att_control_main(int argc, char *argv[])
warnx("unrecognized command");
return 1;
}
}
@@ -333,12 +333,6 @@ private:
namespace pos_control
{
/* oddly, ERROR is not defined for c++ */
#ifdef ERROR
# undef ERROR
#endif
static const int ERROR = -1;
MulticopterPositionControl *g_control;
}
@@ -1500,6 +1494,9 @@ MulticopterPositionControl::task_main()
_landing_started = hrt_absolute_time();
}
#if 0
// TODO quick fix: remove this since in combination with the non-working fall detection
// it can lead to the copter falling out of the sky
/* don't let it throttle up again during landing */
if (thrust_sp(2) < 0.0f && thrust_abs < _landing_thrust
/* fix landing thrust after a certain time when velocity change is minimal */
@@ -1508,6 +1505,7 @@ MulticopterPositionControl::task_main()
&& hrt_elapsed_time(&_landing_started) > 15e5) {
_landing_thrust = thrust_abs;
}
#endif
/* assume ground, reduce thrust */
if (hrt_elapsed_time(&_landing_started) > 15e5
@@ -1766,7 +1764,8 @@ MulticopterPositionControl::task_main()
}
/* do not move yaw while sitting on the ground */
else if (!_vehicle_status.condition_landed) {
else if (!_vehicle_status.condition_landed &&
!(!_control_mode.flag_control_altitude_enabled && _manual.z < 0.1f)) {
const float yaw_offset_max = _params.man_yaw_max / _params.mc_att_yaw_p;
_att_sp.yaw_sp_move_rate = _manual.r * _params.man_yaw_max;
@@ -72,7 +72,7 @@ PARAM_DEFINE_FLOAT(MPC_THR_MAX, 0.9f);
* @max 1.0
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_MANTHR_MIN, 0.12f);
PARAM_DEFINE_FLOAT(MPC_MANTHR_MIN, 0.08f);
/**
* Maximum manual thrust
@@ -35,10 +35,9 @@
#include <algorithm>
#include <drivers/drv_hrt.h>
// static intialization.
// static initialization.
uORB::FastRpcChannel uORB::FastRpcChannel::_Instance;
static hrt_abstime _check_time;
static unsigned long _dropped_pkts;
static unsigned long _get_min = 0xFFFFFF;
static unsigned long _get_max = 0;
@@ -136,7 +135,6 @@ int16_t uORB::FastRpcChannel::send_message(const char *messageName, int32_t leng
int16_t rc = 0;
hrt_abstime t1, t2;
static hrt_abstime check_time = 0;
int32_t initial_queue_size = 0;
if (_RemoteSubscribers.find(messageName) == _RemoteSubscribers.end()) {
//there is no-remote subscriber. So do not queue the message.
@@ -280,7 +278,7 @@ int16_t uORB::FastRpcChannel::get_data
static hrt_abstime check_time = 0;
hrt_abstime t1 = hrt_absolute_time();
_DataAvailableSemaphore.wait();
hrt_abstime t2 = hrt_absolute_time();
// hrt_abstime t2 = hrt_absolute_time();
_QueueMutex.lock();
if (DataQSize() != 0 || ControlQSize() != 0) {
@@ -395,7 +393,7 @@ int16_t uORB::FastRpcChannel::get_bulk_data
static hrt_abstime check_time = 0;
hrt_abstime t1 = hrt_absolute_time();
_DataAvailableSemaphore.wait();
hrt_abstime t2 = hrt_absolute_time();
//hrt_abstime t2 = hrt_absolute_time();
_QueueMutex.lock();
@@ -44,7 +44,7 @@ uORB::KraitFastRpcChannel uORB::KraitFastRpcChannel::_Instance;
static void DumpData(uint8_t *buffer, int32_t length, int32_t num_topics);
// static intialization.
// static initialization.
static std::string _log_file_name = "./hex_dump.txt";
static unsigned long _snd_msg_min = 0xFFFFFF;
+62 -19
View File
@@ -51,6 +51,7 @@
#include <uORB/uORB.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/vehicle_command.h>
#include "navigator.h"
#include "mission_block.h"
@@ -66,7 +67,8 @@ MissionBlock::MissionBlock(Navigator *navigator, const char *name) :
_waypoint_yaw_reached(false),
_time_first_inside_orbit(0),
_actuators{},
_actuator_pub(nullptr)
_actuator_pub(nullptr),
_cmd_pub(nullptr)
{
}
@@ -77,27 +79,48 @@ MissionBlock::~MissionBlock()
bool
MissionBlock::is_mission_item_reached()
{
if (_mission_item.nav_cmd == NAV_CMD_DO_SET_SERVO) {
actuator_pub_fd = orb_advertise(ORB_ID(actuator_controls_2), &actuators);
memset(&actuators, 0, sizeof(actuators));
actuators.control[_mission_item.actuator_num] = 1.0f / 2000 * -_mission_item.actuator_value;
actuators.timestamp = hrt_absolute_time();
orb_publish(ORB_ID(actuator_controls_2), actuator_pub_fd, &actuators);
return true;
}
/* handle non-navigation or indefinite waypoints */
switch (_mission_item.nav_cmd) {
case NAV_CMD_DO_SET_SERVO: {
memset(&actuators, 0, sizeof(actuators));
actuators.control[_mission_item.actuator_num] = 1.0f / 2000 * -_mission_item.actuator_value;
actuators.timestamp = hrt_absolute_time();
if (_actuator_pub != nullptr) {
orb_publish(ORB_ID(actuator_controls_2), _actuator_pub, &actuators);
} else {
_actuator_pub = orb_advertise(ORB_ID(actuator_controls_2), &actuators);
}
return true;
}
if (_mission_item.nav_cmd == NAV_CMD_IDLE) {
return false;
}
case NAV_CMD_LAND:
return _navigator->get_vstatus()->condition_landed;
if (_mission_item.nav_cmd == NAV_CMD_LAND) {
return _navigator->get_vstatus()->condition_landed;
}
/* TODO: count turns */
/*_mission_item.nav_cmd == NAV_CMD_LOITER_TURN_COUNT ||*/
case NAV_CMD_IDLE: /* fall through */
case NAV_CMD_LOITER_UNLIMITED:
return false;
/* TODO: count turns */
if (/*_mission_item.nav_cmd == NAV_CMD_LOITER_TURN_COUNT ||*/
_mission_item.nav_cmd == NAV_CMD_LOITER_UNLIMITED) {
return false;
case vehicle_command_s::VEHICLE_CMD_DO_DIGICAM_CONTROL: /* fallthrough */
case vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION:
{
/* forward the command to other processes */
warnx("got instantaneous command, forwarding.\n");
struct vehicle_command_s cmd = {};
cmd.command = _mission_item.nav_cmd;
mission_item_to_vehicle_command(&_mission_item, &cmd);
if (_cmd_pub != nullptr) {
orb_publish(ORB_ID(vehicle_command), _cmd_pub, &cmd);
} else {
_cmd_pub = orb_advertise(ORB_ID(vehicle_command), &cmd);
}
return true;
}
default:
/* do nothing, this is a 3D waypoint */
break;
}
hrt_abstime now = hrt_absolute_time();
@@ -210,6 +233,26 @@ MissionBlock::reset_mission_item_reached()
_time_first_inside_orbit = 0;
}
void
MissionBlock::mission_item_to_vehicle_command(const struct mission_item_s *item, struct vehicle_command_s *cmd)
{
// we're expecting a mission command item here so assign the "raw" inputs to the command
// (MAV_FRAME_MISSION mission item)
cmd->param1 = item->params[0];
cmd->param2 = item->params[1];
cmd->param3 = item->params[2];
cmd->param4 = item->params[3];
cmd->param5 = item->params[4];
cmd->param6 = item->params[5];
cmd->param7 = item->params[6];
cmd->target_system = _navigator->get_vstatus()->system_id;
cmd->target_component = _navigator->get_vstatus()->component_id;
cmd->source_system = _navigator->get_vstatus()->system_id;
cmd->source_component = _navigator->get_vstatus()->component_id;
cmd->confirmation = false;
}
void
MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *item, struct position_setpoint_s *sp)
{
+6 -1
View File
@@ -111,6 +111,11 @@ protected:
*/
void set_idle_item(struct mission_item_s *item);
/**
* Convert a mission item to a command
*/
void mission_item_to_vehicle_command(const struct mission_item_s *item, struct vehicle_command_s *cmd);
mission_item_s _mission_item;
bool _waypoint_position_reached;
bool _waypoint_yaw_reached;
@@ -118,7 +123,7 @@ protected:
actuator_controls_s _actuators;
orb_advert_t _actuator_pub;
orb_advert_t _cmd_pub;
};
#endif
@@ -50,6 +50,7 @@
#include <fcntl.h>
#include <errno.h>
#include <uORB/topics/fence.h>
#include <uORB/topics/vehicle_command.h>
MissionFeasibilityChecker::MissionFeasibilityChecker() :
_mavlink_fd(-1),
@@ -199,7 +200,9 @@ bool MissionFeasibilityChecker::checkMissionItemValidity(dm_item_t dm_current, s
missionitem.nav_cmd != NAV_CMD_TAKEOFF &&
missionitem.nav_cmd != NAV_CMD_PATHPLANNING &&
missionitem.nav_cmd != NAV_CMD_DO_JUMP &&
missionitem.nav_cmd != NAV_CMD_DO_SET_SERVO) {
missionitem.nav_cmd != NAV_CMD_DO_SET_SERVO &&
missionitem.nav_cmd != vehicle_command_s::VEHICLE_CMD_DO_DIGICAM_CONTROL &&
missionitem.nav_cmd != vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION) {
mavlink_log_critical(_mavlink_fd, "Rejecting mission item %i: unsupported action.", (int)(i+1));
return false;
+1
View File
@@ -103,6 +103,7 @@ struct mission_item_s {
unsigned do_jump_current_count; /**< count how many times the jump has been done */
int actuator_num; /**< actuator number to be set 0..5 ( corresponds to AUX outputs 1..6 */
int actuator_value; /**< new value for selected actuator in ms 900...2000 */
float params[7]; /**< array to store mission command values for MAV_FRAME_MISSION ***/
};
#pragma pack(pop)
#include <uORB/topics/mission.h>
+12
View File
@@ -2300,6 +2300,8 @@ PARAM_DEFINE_INT32(SENS_EN_LL40LS, 0);
*
* Set to 1000 for industry default or 900 to increase servo travel.
*
* @reboot_required true
*
* @min 800
* @max 1400
* @unit microseconds
@@ -2316,6 +2318,8 @@ PARAM_DEFINE_INT32(PWM_MIN, 1000);
*
* Set to 2000 for industry default or 2100 to increase servo travel.
*
* @reboot_required true
*
* @min 1600
* @max 2200
* @unit microseconds
@@ -2333,6 +2337,8 @@ PARAM_DEFINE_INT32(PWM_MAX, 2000);
* This is the PWM pulse the autopilot is outputting if not armed.
* The main use of this parameter is to silence ESCs when they are disarmed.
*
* @reboot_required true
*
* @min 0
* @max 2200
* @unit microseconds
@@ -2349,6 +2355,8 @@ PARAM_DEFINE_INT32(PWM_DISARMED, 0);
*
* Set to 1000 for default or 900 to increase servo travel
*
* @reboot_required true
*
* @min 800
* @max 1400
* @unit microseconds
@@ -2365,6 +2373,8 @@ PARAM_DEFINE_INT32(PWM_AUX_MIN, 1000);
*
* Set to 2000 for default or 2100 to increase servo travel
*
* @reboot_required true
*
* @min 1600
* @max 2200
* @unit microseconds
@@ -2382,6 +2392,8 @@ PARAM_DEFINE_INT32(PWM_AUX_MAX, 2000);
* This is the PWM pulse the autopilot is outputting if not armed.
* The main use of this parameter is to silence ESCs when they are disarmed.
*
* @reboot_required true
*
* @min 0
* @max 2200
* @unit microseconds
+3 -3
View File
@@ -185,7 +185,7 @@ private:
switch_pos_t get_rc_sw2pos_position(uint8_t func, float on_th, bool on_inv);
/**
* Update paramters from RC channels if the functionality is activated and the
* Update parameters from RC channels if the functionality is activated and the
* input has changed since the last update
*
* @param
@@ -346,7 +346,7 @@ private:
param_t rc_map_aux5;
param_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN];
param_t rc_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; /**< param handles for the paramters which are bound
param_t rc_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; /**< param handles for the parameters which are bound
to a RC channel, equivalent float values in the
_parameters struct are not existing
because these parameters are never read. */
@@ -1568,7 +1568,7 @@ Sensors::rc_parameter_map_poll(bool forced)
if (map_updated) {
orb_copy(ORB_ID(rc_parameter_map), _rc_parameter_map_sub, &_rc_parameter_map);
/* update paramter handles to which the RC channels are mapped */
/* update parameter handles to which the RC channels are mapped */
for (int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) {
if (_rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_PARAM_1 + i] < 0 || !_rc_parameter_map.valid[i]) {
/* This RC channel is not mapped to a RC-Parameter Channel (e.g. RC_MAP_PARAM1 == 0)
+1 -1
View File
@@ -119,7 +119,7 @@ void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg)
actuator_msg.throttle = out[3];
actuator_msg.aux1 = out[4];
actuator_msg.aux2 = out[5];
actuator_msg.aux3 = out[6];
actuator_msg.aux3 = _actuators.output[6] > PWM_DEFAULT_MIN / 2 ? out[6] : -1.0f;;
actuator_msg.aux4 = out[7];
actuator_msg.mode = 0; // need to put something here
actuator_msg.nav_mode = 0;
+1 -1
View File
@@ -481,7 +481,7 @@ public:
* compared to thrust.
* @param yaw_wcale Scaling factor applied to yaw inputs compared
* to thrust.
* @param idle_speed Minumum rotor control output value; usually
* @param idle_speed Minimum rotor control output value; usually
* tuned to ensure that rotors never stall at the
* low end of their control range.
*/
+1 -1
View File
@@ -118,7 +118,7 @@ extern uint32_t _etext;
* This function should then be called in the application-specific
* user_start logic in order to perform the C++ initialization. NOTE
* that no component of the core NuttX RTOS logic is involved; This
* function defintion only provides the 'contract' between application
* function definition only provides the 'contract' between application
* specific C++ code and platform-specific toolchain support
*
***************************************************************************/
@@ -1058,7 +1058,7 @@ always used with the `users_by_name` hash table).
Several sort orders
~~~~~~~~~~~~~~~~~~~
It comes as no suprise that two hash tables can have different sort orders, but
It comes as no surprise that two hash tables can have different sort orders, but
this fact can also be used advantageously to sort the 'same items' in several
ways. This is based on the ability to store a structure in several hash tables.
@@ -423,7 +423,7 @@ VtolAttitudeControl::is_fixed_wing_requested()
{
bool to_fw = _manual_control_sp.aux1 > 0.0f;
if (_v_control_mode.flag_control_offboard_enabled) {
if (_v_control_mode.flag_control_offboard_enabled || _v_control_mode.flag_control_auto_enabled) {
to_fw = _transition_command == vehicle_status_s::VEHICLE_VTOL_STATE_FW;
}
+2 -2
View File
@@ -35,7 +35,7 @@
* Basic shell to execute builtin "apps"
*
* @author Mark Charlebois <charlebm@gmail.com>
* @auther Roman Bapst <bapstroman@gmail.com>
* @author Roman Bapst <bapstroman@gmail.com>
*/
#include <iostream>
@@ -238,7 +238,7 @@ int main(int argc, char **argv)
const char *folderpath = "/rootfs/";
if (nullptr == getcwd(pwd_path, sizeof(pwd_path))) {
PX4_ERR("Failed aquiring working dir, abort.");
PX4_ERR("Failed acquiring working dir, abort.");
exit(1);
}
+1 -1
View File
@@ -51,7 +51,7 @@
/************************************************************
* Name: dq_rem
*
* Descripton:
* Description:
* dq_rem removes 'node' from 'queue'
*
************************************************************/
+3 -3
View File
@@ -132,7 +132,7 @@ public:
void spinOnce() { ros::spinOnce(); }
/**
* Keeps calling callbacks for incomming messages, returns when module is terminated
* Keeps calling callbacks for incoming messages, returns when module is terminated
*/
void spin() { ros::spin(); }
@@ -266,7 +266,7 @@ public:
}
/**
* Keeps calling callbacks for incomming messages, returns when module is terminated
* Keeps calling callbacks for incoming messages, returns when module is terminated
*/
void spin()
{
@@ -292,7 +292,7 @@ protected:
static const uint16_t kMaxPublications = 100;
List<SubscriberNode *> _subs; /**< Subcriptions of node */
List<PublisherNode *> _pubs; /**< Publications of node */
SubscriberNode *_sub_min_interval; /**< Points to the sub wtih the smallest interval
SubscriberNode *_sub_min_interval; /**< Points to the sub with the smallest interval
of all Subscriptions in _subs*/
AppState &_appState;
+1 -1
View File
@@ -129,7 +129,7 @@ typedef struct {
pollevent_t events; /* The input event flags */
pollevent_t revents; /* The output event flags */
/* Required for PX4 compatability */
/* Required for PX4 compatibility */
px4_sem_t *sem; /* Pointer to semaphore used to post output event */
void *priv; /* For use by drivers */
} px4_pollfd_struct_t;
+1 -1
View File
@@ -17,7 +17,7 @@ enum spi_dev_e {
SPIDEV_AUDIO_CTRL, /* Select SPI audio codec device control port */
};
/* Certain SPI devices may required differnt clocking modes */
/* Certain SPI devices may required different clocking modes */
enum spi_mode_e {
SPIDEV_MODE0 = 0, /* CPOL=0 CHPHA=0 */
+8 -2
View File
@@ -61,14 +61,20 @@ static void do_dlopen()
#endif
}
#ifdef QURT_EXE_BUILD
int dlinit(int a, char **b)
{
return 0;
}
#endif
int main(int argc, char *argv[])
{
int ret = 0;
char *builtin[] = {"libgcc.so", "libc.so", "libstdc++.so"};
char *builtin[] = {"libgcc.so", "libc.so"};
printf("In DSPAL main\n");
dlinit(3, builtin);
dlinit(2, builtin);
do_dlopen();
return ret;

Some files were not shown because too many files have changed in this diff Show More