From 5a402ed3f16c3bb989f9732be4efa9565a1c5170 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Mon, 2 Mar 2015 15:29:43 +0100 Subject: [PATCH 01/16] - publish offboard mode with manual input so the vehicle control status is correct - trigger offboard in mavros attitude test --- integrationtests/demo_tests/manual_input.py | 33 +++++++++++++++++-- .../demo_tests/mavros_offboard_attctl_test.py | 3 +- .../demo_tests/mavros_offboard_posctl_test.py | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/integrationtests/demo_tests/manual_input.py b/integrationtests/demo_tests/manual_input.py index cf139bb1da..9b2471a00e 100755 --- a/integrationtests/demo_tests/manual_input.py +++ b/integrationtests/demo_tests/manual_input.py @@ -39,6 +39,7 @@ import sys import rospy from px4.msg import manual_control_setpoint +from px4.msg import offboard_control_mode from mav_msgs.msg import CommandAttitudeThrust from std_msgs.msg import Header @@ -46,13 +47,15 @@ from std_msgs.msg import Header # Manual input control helper # # FIXME: this is not the way to do it! ATM it fakes input to iris/command/attitude because else -# the simulator does not instantiate our controller. +# the simulator does not instantiate our controller. Probably this whole class will disappear once +# arming works correctly. # class ManualInput: def __init__(self): rospy.init_node('test_node', anonymous=True) self.pubMcsp = rospy.Publisher('px4_multicopter/manual_control_setpoint', manual_control_setpoint, queue_size=10) + self.pubOff = rospy.Publisher('px4_multicopter/offboard_control_mode', offboard_control_mode, queue_size=10) self.pubAtt = rospy.Publisher('iris/command/attitude', CommandAttitudeThrust, queue_size=10) def arm(self): @@ -119,9 +122,35 @@ class ManualInput: rate.sleep() count = count + 1 - def offboard(self): + + def offboard_attctl(self): + self.offboard(False, False, True, True, True, True) + + def offboard_posctl(self): + self.offboard(False, False, True, False, True, True) + + # Trigger offboard and set offboard control mode before + def offboard(self, ignore_thrust=False, ignore_attitude=False, ignore_bodyrate=True, + ignore_position=False, ignore_velocity=True, ignore_acceleration_force=True): rate = rospy.Rate(10) # 10hz + mode = offboard_control_mode() + mode.ignore_thrust = ignore_thrust + mode.ignore_attitude = ignore_attitude + mode.ignore_bodyrate = ignore_bodyrate + mode.ignore_position = ignore_position + mode.ignore_velocity = ignore_velocity + mode.ignore_acceleration_force = ignore_acceleration_force + + count = 0 + while not rospy.is_shutdown() and count < 5: + rospy.loginfo("setting offboard mode") + time = rospy.get_rostime().now() + mode.timestamp = time.secs * 1e6 + time.nsecs / 1000 + self.pubOff.publish(mode) + rate.sleep() + count = count + 1 + # triggers offboard pos = manual_control_setpoint() pos.x = 0 diff --git a/integrationtests/demo_tests/mavros_offboard_attctl_test.py b/integrationtests/demo_tests/mavros_offboard_attctl_test.py index 27885635a1..a52f7ffc1b 100755 --- a/integrationtests/demo_tests/mavros_offboard_attctl_test.py +++ b/integrationtests/demo_tests/mavros_offboard_attctl_test.py @@ -100,6 +100,7 @@ class MavrosOffboardAttctlTest(unittest.TestCase): # FIXME: this must go ASAP when arming is implemented manIn = ManualInput() manIn.arm() + manIn.offboard_attctl() self.assertTrue(self.arm(), "Could not arm") self.rateSec.sleep() @@ -111,7 +112,7 @@ class MavrosOffboardAttctlTest(unittest.TestCase): att.header = Header() att.header.frame_id = "base_footprint" att.header.stamp = rospy.Time.now() - quaternion = quaternion_from_euler(0.2, 0.2, 0) + quaternion = quaternion_from_euler(0.15, 0.15, 0) att.pose.orientation = Quaternion(*quaternion) throttle = Float64() diff --git a/integrationtests/demo_tests/mavros_offboard_posctl_test.py b/integrationtests/demo_tests/mavros_offboard_posctl_test.py index a1f1cf3c55..a3739ae5ce 100755 --- a/integrationtests/demo_tests/mavros_offboard_posctl_test.py +++ b/integrationtests/demo_tests/mavros_offboard_posctl_test.py @@ -136,7 +136,7 @@ class MavrosOffboardPosctlTest(unittest.TestCase): # FIXME: this must go ASAP when arming is implemented manIn = ManualInput() manIn.arm() - manIn.offboard() + manIn.offboard_posctl() self.assertTrue(self.arm(), "Could not arm") self.rateSec.sleep() From b1dcb10f25862d7d833d91518a007b618236ad64 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 5 Jan 2015 23:16:30 -0500 Subject: [PATCH 02/16] add make check_format to check astyle code formatting --- .gitignore | 2 ++ Makefile | 4 ++++ Tools/check_code_style.sh | 28 ++++++++++++++++++++++++++++ Tools/fix_code_style.sh | 1 + 4 files changed, 35 insertions(+) create mode 100755 Tools/check_code_style.sh diff --git a/.gitignore b/.gitignore index 611325444e..0e553fa365 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ Firmware.zip unittests/build *.generated.h .vagrant +*.pretty + diff --git a/Makefile b/Makefile index 7620099f98..201187e021 100644 --- a/Makefile +++ b/Makefile @@ -262,6 +262,10 @@ testbuild: tests: generateuorbtopicheaders $(Q) (mkdir -p $(PX4_BASE)/unittests/build && cd $(PX4_BASE)/unittests/build && cmake .. && $(MAKE) unittests) +.PHONY: format check_format +check_format: + $(Q) (./Tools/check_code_style.sh | sort -n) + # # Cleanup targets. 'clean' should remove all built products and force # a complete re-compilation, 'distclean' should remove everything diff --git a/Tools/check_code_style.sh b/Tools/check_code_style.sh new file mode 100755 index 0000000000..491fbb0ce2 --- /dev/null +++ b/Tools/check_code_style.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -eu +failed=0 +for fn in $(find . -path './src/lib/uavcan' -prune -o \ + -path './NuttX' -prune -o \ + -path './Build' -prune -o \ + -path './mavlink' -prune -o \ + -path './unittests/gtest' -prune -o \ + -name '*.c' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -type f); do + if [ -f "$fn" ]; + then + ./Tools/fix_code_style.sh --quiet < $fn > $fn.pretty + diffsize=$(diff -y --suppress-common-lines $fn $fn.pretty | wc -l) + rm -f $fn.pretty + if [ $diffsize -ne 0 ]; then + failed=1 + echo $diffsize $fn + fi + fi +done + +if [ $failed -eq 0 ]; then + echo "Format checks passed" + exit 0 +else + echo "Format checks failed; please run ./Tools/fix_code_style.sh on each file" + exit 1 +fi diff --git a/Tools/fix_code_style.sh b/Tools/fix_code_style.sh index 5995d428ea..e73a5a8af2 100755 --- a/Tools/fix_code_style.sh +++ b/Tools/fix_code_style.sh @@ -18,4 +18,5 @@ astyle \ --exclude=EASTL \ --add-brackets \ --max-code-length=120 \ + --preserve-date \ $* From 92a3b9ce1fad65f6c0b941b7c77c6b286f547ede Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 7 Jan 2015 23:01:02 -0500 Subject: [PATCH 03/16] add astyle pre-commit git hook --- Tools/pre-commit | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 Tools/pre-commit diff --git a/Tools/pre-commit b/Tools/pre-commit new file mode 100755 index 0000000000..db5863d3eb --- /dev/null +++ b/Tools/pre-commit @@ -0,0 +1,29 @@ +#!/bin/sh +echo "hello world" + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# Redirect output to stderr. +exec 1>&2 + +CHANGED_FILES=`git diff --cached --name-only --diff-filter=ACM $against | grep '\.c\|\.cpp\|\.h\|\.hpp'` +FAILED=0 +if [ ! -z "$CHANGED_FILES" -a "$CHANGED_FILES" != " " ]; then + echo $CHANGED_FILES + for FILE in $CHANGED_FILES; do + ./Tools/fix_code_style.sh --quiet < $FILE > $FILE.pretty + diff -u $FILE $FILE.pretty || FAILED=1 + rm -f $FILE.pretty + if [ $FAILED -ne 0 ]; then + echo "There are code formatting errors. Please fix them by running ./Tools/fix_code_style.sh $FILE" + exit $FAILED + fi + done +fi +exit 0 From b5a2c8708ceea21bdea0c61f6999b5b3272d3f09 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 22 Feb 2015 17:41:02 -0500 Subject: [PATCH 04/16] check_code_style.sh ignore unittests/build directory --- Tools/check_code_style.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/check_code_style.sh b/Tools/check_code_style.sh index 491fbb0ce2..df6afced45 100755 --- a/Tools/check_code_style.sh +++ b/Tools/check_code_style.sh @@ -6,6 +6,7 @@ for fn in $(find . -path './src/lib/uavcan' -prune -o \ -path './Build' -prune -o \ -path './mavlink' -prune -o \ -path './unittests/gtest' -prune -o \ + -path './unittests/build' -prune -o \ -name '*.c' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -type f); do if [ -f "$fn" ]; then From b2082c124aed3f6e90b4925e98dfadf877b1636e Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 22 Feb 2015 17:50:55 -0500 Subject: [PATCH 05/16] git pre-commit hook don't echo files changed --- Tools/pre-commit | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tools/pre-commit b/Tools/pre-commit index db5863d3eb..13cd4aaddb 100755 --- a/Tools/pre-commit +++ b/Tools/pre-commit @@ -1,6 +1,4 @@ #!/bin/sh -echo "hello world" - if git rev-parse --verify HEAD >/dev/null 2>&1 then against=HEAD @@ -15,7 +13,6 @@ exec 1>&2 CHANGED_FILES=`git diff --cached --name-only --diff-filter=ACM $against | grep '\.c\|\.cpp\|\.h\|\.hpp'` FAILED=0 if [ ! -z "$CHANGED_FILES" -a "$CHANGED_FILES" != " " ]; then - echo $CHANGED_FILES for FILE in $CHANGED_FILES; do ./Tools/fix_code_style.sh --quiet < $FILE > $FILE.pretty diff -u $FILE $FILE.pretty || FAILED=1 From 8de2b8af146826ff0495f495ffef509a988f85f8 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 22 Feb 2015 18:55:05 -0500 Subject: [PATCH 06/16] check_code_style.sh ignore mathlib/CMSIS --- Tools/check_code_style.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/check_code_style.sh b/Tools/check_code_style.sh index df6afced45..387aab92bf 100755 --- a/Tools/check_code_style.sh +++ b/Tools/check_code_style.sh @@ -2,6 +2,7 @@ set -eu failed=0 for fn in $(find . -path './src/lib/uavcan' -prune -o \ + -path './src/lib/mathlib/CMSIS' -prune -o \ -path './NuttX' -prune -o \ -path './Build' -prune -o \ -path './mavlink' -prune -o \ From 265147ce7f64d40124c615623afdde86fb2bb8f9 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 23 Feb 2015 13:10:12 -0500 Subject: [PATCH 07/16] make check_format ignore src/modules/attitude_estimator_ekf/codegen --- Tools/check_code_style.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/check_code_style.sh b/Tools/check_code_style.sh index 387aab92bf..8d1ab6363b 100755 --- a/Tools/check_code_style.sh +++ b/Tools/check_code_style.sh @@ -3,6 +3,7 @@ set -eu failed=0 for fn in $(find . -path './src/lib/uavcan' -prune -o \ -path './src/lib/mathlib/CMSIS' -prune -o \ + -path './src/modules/attitude_estimator_ekf/codegen/' -prune -o \ -path './NuttX' -prune -o \ -path './Build' -prune -o \ -path './mavlink' -prune -o \ From a31fccb0b0d2182b20e6d4b001a710f98f1d84ac Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 2 Mar 2015 21:11:21 +0100 Subject: [PATCH 08/16] Uploader: Fix flashing if multiple board types are connected --- Tools/px_uploader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index f4e317cfa8..91ac084ef4 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -565,8 +565,12 @@ try: except RuntimeError as ex: - # print the error - print("\nERROR: %s" % ex.args) + if "not suitable" in ex.args: + up.close() + continue + else: + # print the error + print("\nERROR: %s" % ex.args) finally: # always close the port From 7a0db340f7363a678963e5761a006ac099d94c54 Mon Sep 17 00:00:00 2001 From: Roman Bapst Date: Mon, 2 Mar 2015 12:56:12 +0100 Subject: [PATCH 09/16] added quaternion methods for inverse and vector rotation --- src/lib/mathlib/math/Quaternion.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/lib/mathlib/math/Quaternion.hpp b/src/lib/mathlib/math/Quaternion.hpp index 38400beef5..d28966fca6 100644 --- a/src/lib/mathlib/math/Quaternion.hpp +++ b/src/lib/mathlib/math/Quaternion.hpp @@ -115,6 +115,35 @@ public: return Vector<3>(&data[1]); } + /** + * inverse of quaternion + */ + math::Quaternion inverse() { + Quaternion res; + memcpy(res.data,data,sizeof(res.data)); + res.data[1] = -res.data[1]; + res.data[2] = -res.data[2]; + res.data[3] = -res.data[3]; + return res; + } + + + /** + * rotate vector by quaternion + */ + Vector<3> rotate(const Vector<3> &w) { + Quaternion q_w; // extend vector to quaternion + Quaternion q = {data[0],data[1],data[2],data[3]}; + Quaternion q_rotated; // quaternion representation of rotated vector + q_w(0) = 0; + q_w(1) = w.data[0]; + q_w(2) = w.data[1]; + q_w(3) = w.data[2]; + q_rotated = q*q_w*q.inverse(); + Vector<3> res = {q_rotated.data[1],q_rotated.data[2],q_rotated.data[3]}; + return res; + } + /** * set quaternion to rotation defined by euler angles */ From 200f0e9a93ec9039d2fb5a2e519f2dd424a9d814 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 2 Mar 2015 23:05:03 +0100 Subject: [PATCH 10/16] Better error handling for multi-board setups --- Tools/px_uploader.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index 91ac084ef4..859c821e5b 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -416,7 +416,7 @@ class uploader(object): def upload(self, fw): # Make sure we are doing the right thing if self.board_type != fw.property('board_id'): - raise RuntimeError("Firmware not suitable for this board") + raise IOError("Firmware not suitable for this board") if self.fw_maxsize < fw.property('image_size'): raise RuntimeError("Firmware image is too large for this board") @@ -564,13 +564,12 @@ try: up.upload(fw) except RuntimeError as ex: + # print the error + print("\nERROR: %s" % ex.args) - if "not suitable" in ex.args: - up.close() - continue - else: - # print the error - print("\nERROR: %s" % ex.args) + except IOError as e: + up.close(); + continue finally: # always close the port From 6ad5243a516af1b3d12c826d4bf4dc30c6f6b11d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 3 Mar 2015 00:19:48 +0100 Subject: [PATCH 11/16] Fixed NuttX submodule to correct version --- NuttX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuttX b/NuttX index 787aca971a..11afcdfee6 160000 --- a/NuttX +++ b/NuttX @@ -1 +1 @@ -Subproject commit 787aca971a86219d4e791100646b54ed8245a733 +Subproject commit 11afcdfee6a3961952dd92f02c1abaa4756b115f From 3e5b8ded8cdd650e961008ce65c93dd64a326554 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 3 Mar 2015 17:27:50 +0100 Subject: [PATCH 12/16] Increase rate of MAVLink output on companion link --- ROMFS/px4fmu_common/init.d/rcS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index ea3f721f34..9118f26013 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -436,7 +436,7 @@ then then if param compare SYS_COMPANION 921600 then - mavlink start -d /dev/ttyS2 -b 921600 -m onboard + mavlink start -d /dev/ttyS2 -b 921600 -m onboard -r 20000 fi fi From f7ef6e19502aabbb4b8b1131b88854669885b178 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 3 Mar 2015 17:28:14 +0100 Subject: [PATCH 13/16] Fix stack sizes based on observed usage. Frees some more RAM --- nuttx-configs/aerocore/nsh/defconfig | 6 +++--- nuttx-configs/px4fmu-v1/nsh/defconfig | 7 ++++--- nuttx-configs/px4fmu-v2/nsh/defconfig | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/nuttx-configs/aerocore/nsh/defconfig b/nuttx-configs/aerocore/nsh/defconfig index 29dff64aad..08ff4a9885 100644 --- a/nuttx-configs/aerocore/nsh/defconfig +++ b/nuttx-configs/aerocore/nsh/defconfig @@ -332,7 +332,7 @@ CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_DRAM_START=0x20000000 CONFIG_DRAM_SIZE=262144 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y -CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_INTERRUPTSTACK=1500 # # Boot options @@ -415,8 +415,8 @@ CONFIG_PREALLOC_TIMERS=50 # # Stack and heap information # -CONFIG_IDLETHREAD_STACKSIZE=6000 -CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_IDLETHREAD_STACKSIZE=1000 +CONFIG_USERMAIN_STACKSIZE=3000 CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 diff --git a/nuttx-configs/px4fmu-v1/nsh/defconfig b/nuttx-configs/px4fmu-v1/nsh/defconfig index 86ed041fff..cd410051c7 100644 --- a/nuttx-configs/px4fmu-v1/nsh/defconfig +++ b/nuttx-configs/px4fmu-v1/nsh/defconfig @@ -325,7 +325,8 @@ CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_DRAM_START=0x20000000 CONFIG_DRAM_SIZE=196608 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y -CONFIG_ARCH_INTERRUPTSTACK=4096 +# The actual usage is 420 bytes +CONFIG_ARCH_INTERRUPTSTACK=1500 # # Boot options @@ -416,8 +417,8 @@ CONFIG_PREALLOC_TIMERS=50 # # Stack and heap information # -CONFIG_IDLETHREAD_STACKSIZE=3500 -CONFIG_USERMAIN_STACKSIZE=2600 +CONFIG_IDLETHREAD_STACKSIZE=1000 +CONFIG_USERMAIN_STACKSIZE=3000 CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 diff --git a/nuttx-configs/px4fmu-v2/nsh/defconfig b/nuttx-configs/px4fmu-v2/nsh/defconfig index 6a1aec22bd..4ccc5dacb6 100644 --- a/nuttx-configs/px4fmu-v2/nsh/defconfig +++ b/nuttx-configs/px4fmu-v2/nsh/defconfig @@ -367,7 +367,7 @@ CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_DRAM_START=0x20000000 CONFIG_DRAM_SIZE=262144 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y -CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_INTERRUPTSTACK=1500 # # Boot options @@ -451,8 +451,8 @@ CONFIG_PREALLOC_TIMERS=50 # # Stack and heap information # -CONFIG_IDLETHREAD_STACKSIZE=3500 -CONFIG_USERMAIN_STACKSIZE=2600 +CONFIG_IDLETHREAD_STACKSIZE=1000 +CONFIG_USERMAIN_STACKSIZE=3000 CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 From 1d90e86ec463bdcfed49ef09dd27206e1451b8c4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 3 Mar 2015 01:08:03 +0100 Subject: [PATCH 14/16] Commander and MAVLink: Adjust stack sizes as required --- src/modules/commander/commander.cpp | 2 +- src/modules/mavlink/module.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 74ebe0ae43..f832f761ef 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -966,7 +966,7 @@ int commander_thread_main(int argc, char *argv[]) pthread_attr_t commander_low_prio_attr; pthread_attr_init(&commander_low_prio_attr); - pthread_attr_setstacksize(&commander_low_prio_attr, 2600); + pthread_attr_setstacksize(&commander_low_prio_attr, 2400); struct sched_param param; (void)pthread_attr_getschedparam(&commander_low_prio_attr, ¶m); diff --git a/src/modules/mavlink/module.mk b/src/modules/mavlink/module.mk index f9d30dcbea..e82b8bd935 100644 --- a/src/modules/mavlink/module.mk +++ b/src/modules/mavlink/module.mk @@ -51,7 +51,7 @@ INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink MAXOPTIMIZATION = -Os -MODULE_STACKSIZE = 1024 +MODULE_STACKSIZE = 1200 EXTRACXXFLAGS = -Weffc++ -Wno-attributes -Wno-packed From 0261f5dfbee1ee498c2b40acb6a2651664a367c1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 3 Mar 2015 01:27:35 +0100 Subject: [PATCH 15/16] MAVLink: Reduce stack usage --- src/modules/mavlink/mavlink_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 0132a3193d..f8e819ce7a 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1621,7 +1621,7 @@ Mavlink::start(int argc, char *argv[]) task_spawn_cmd(buf, SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT, - 2700, + 2400, (main_t)&Mavlink::start_helper, (char * const *)argv); From dfd6be78bf4165d388bd073b28a54f6b7fb3300d Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 3 Mar 2015 09:22:01 -0800 Subject: [PATCH 16/16] Add RC_CHAN_CNT, RC_TH_USER These are used by ground station software --- src/modules/sensors/sensor_params.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/modules/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index 5ec6780331..272e4b14f3 100644 --- a/src/modules/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c @@ -993,6 +993,36 @@ PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.00459340659f); PARAM_DEFINE_FLOAT(BAT_C_SCALING, 0.0124); /* scaling for 3DR power brick */ +/** + * RC channel count + * + * This parameter is used by Ground Station software to save the number + * of channels which were used during RC calibration. It is only meant + * for ground station use. + * + * @min 0 + * @max 18 + * @group Radio Calibration + */ + +PARAM_DEFINE_INT32(RC_CHAN_CNT, 0); + +/** + * RC mode switch threshold automaic distribution + * + * This parameter is used by Ground Station software to specify whether + * the threshold values for flight mode switches were automatically calculated. + * 0 indicates that the threshold values were set by the user. Any other value + * indicates that the threshold value where automatically set by the ground + * station software. It is only meant for ground station use. + * + * @min 0 + * @max 1 + * @group Radio Calibration + */ + +PARAM_DEFINE_INT32(RC_TH_USER, 1); + /** * Roll control channel mapping. *