diff --git a/.gitignore b/.gitignore index bd835e271f..68d385950e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ unittests/build .vagrant *.pretty xcode +ROMFS/*/*/rc.autostart diff --git a/ROMFS/px4fmu_common/init.d/10015_tbs_discovery b/ROMFS/px4fmu_common/init.d/10015_tbs_discovery index ce5e1c71dc..2058d10091 100644 --- a/ROMFS/px4fmu_common/init.d/10015_tbs_discovery +++ b/ROMFS/px4fmu_common/init.d/10015_tbs_discovery @@ -1,6 +1,6 @@ #!nsh # -# @name Team Blacksheep Discovery Quadcopter +# @name Team Blacksheep Discovery # # @type Quadrotor Wide # diff --git a/ROMFS/px4fmu_common/init.d/10018_tbs_endurance b/ROMFS/px4fmu_common/init.d/10018_tbs_endurance index fd74e17807..e26e2a8105 100644 --- a/ROMFS/px4fmu_common/init.d/10018_tbs_endurance +++ b/ROMFS/px4fmu_common/init.d/10018_tbs_endurance @@ -1,8 +1,6 @@ #!nsh # -# @name Team Blacksheep Discovery Long Range Quadcopter -# -# Setup: 15 x 5" Props, 6S 4000mAh TBS LiPo, TBS 30A ESCs, TBS 400kV Motors +# @name Team Blacksheep Discovery Endurance # # @type Quadrotor Wide # diff --git a/ROMFS/px4fmu_common/init.d/10020_3dr_quad b/ROMFS/px4fmu_common/init.d/10020_3dr_quad new file mode 100644 index 0000000000..0dbffba00f --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/10020_3dr_quad @@ -0,0 +1,37 @@ +#!nsh +# +# @name 3DR Iris Quadrotor +# +# @type Quadrotor Wide +# +# @maintainer Anton Babushkin +# + +sh /etc/init.d/rc.mc_defaults + +if [ $AUTOCNF == yes ] +then + # TODO tune roll/pitch separately + param set MC_ROLL_P 7.0 + param set MC_ROLLRATE_P 0.13 + param set MC_ROLLRATE_I 0.05 + param set MC_ROLLRATE_D 0.004 + param set MC_PITCH_P 7.0 + param set MC_PITCHRATE_P 0.13 + param set MC_PITCHRATE_I 0.05 + param set MC_PITCHRATE_D 0.004 + param set MC_YAW_P 2.5 + param set MC_YAWRATE_P 0.25 + param set MC_YAWRATE_I 0.25 + param set MC_YAWRATE_D 0.0 + + param set BAT_V_SCALING 0.00989 + param set BAT_C_SCALING 0.0124 +fi + +set MIXER quad_x + +set PWM_OUT 1234 + +set PWM_MIN 1100 +set PWM_MAX 1950 diff --git a/ROMFS/px4fmu_common/init.d/11001_hexa_cox b/ROMFS/px4fmu_common/init.d/11001_hexa_cox index 16d34ecab6..f85b06f87d 100644 --- a/ROMFS/px4fmu_common/init.d/11001_hexa_cox +++ b/ROMFS/px4fmu_common/init.d/11001_hexa_cox @@ -4,7 +4,7 @@ # # @type Hexarotor Coaxial # -# Lorenz Meier +# @maintainer Lorenz Meier # sh /etc/init.d/rc.mc_defaults diff --git a/ROMFS/px4fmu_common/init.d/13001_caipirinha_vtol b/ROMFS/px4fmu_common/init.d/13001_caipirinha_vtol index e9f48d401b..a9e7ff35b2 100644 --- a/ROMFS/px4fmu_common/init.d/13001_caipirinha_vtol +++ b/ROMFS/px4fmu_common/init.d/13001_caipirinha_vtol @@ -2,8 +2,6 @@ # # @name Duorotor Tailsitter # -# Generic configuration file for a tailsitter with motors in tandem configuration. -# # @type VTOL Tailsitter # # @maintainer Roman Bapst diff --git a/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter b/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter index b41ad749cf..016f13816f 100644 --- a/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter +++ b/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter @@ -2,8 +2,6 @@ # # @name Quadrotor X Tailsitter # -# Generic configuration file for a tailsitter with motors in X configuration. -# # @type VTOL Tailsitter # # @maintainer Roman Bapst diff --git a/ROMFS/px4fmu_common/init.d/13004_quad+_tailsitter b/ROMFS/px4fmu_common/init.d/13004_quad+_tailsitter index 672a809354..dcf2fc8679 100644 --- a/ROMFS/px4fmu_common/init.d/13004_quad+_tailsitter +++ b/ROMFS/px4fmu_common/init.d/13004_quad+_tailsitter @@ -2,8 +2,6 @@ # # @name Quadrotor + Tailsitter # -# Generic configuration file for a tailsitter with motors in X configuration. -# # @type VTOL Tailsitter # # @maintainer Roman Bapst diff --git a/ROMFS/px4fmu_common/init.d/14001_tri_y_yaw+ b/ROMFS/px4fmu_common/init.d/14001_tri_y_yaw+ index 4a85405199..b4c7885dab 100644 --- a/ROMFS/px4fmu_common/init.d/14001_tri_y_yaw+ +++ b/ROMFS/px4fmu_common/init.d/14001_tri_y_yaw+ @@ -1,8 +1,6 @@ #!nsh # -# @name Generic Tricopter Y Geometry -# -# Yaw Servo +Output ==> +Yaw Vehicle Rotation +# @name Generic Tricopter Y+ Geometry # # @type Tricopter Y+ # diff --git a/ROMFS/px4fmu_common/init.d/14002_tri_y_yaw- b/ROMFS/px4fmu_common/init.d/14002_tri_y_yaw- index a3443e43ad..7fa0af009a 100644 --- a/ROMFS/px4fmu_common/init.d/14002_tri_y_yaw- +++ b/ROMFS/px4fmu_common/init.d/14002_tri_y_yaw- @@ -1,8 +1,6 @@ #!nsh # -# @name Generic Tricopter Y Geometry -# -# Yaw Servo +Output ==> -Yaw Vehicle Rotation +# @name Generic Tricopter Y- Geometry # # @type Tricopter Y- # diff --git a/ROMFS/px4fmu_common/init.d/2102_3dr_skywalker b/ROMFS/px4fmu_common/init.d/2102_3dr_skywalker index e2e1b307f4..d2347c98c8 100644 --- a/ROMFS/px4fmu_common/init.d/2102_3dr_skywalker +++ b/ROMFS/px4fmu_common/init.d/2102_3dr_skywalker @@ -1,6 +1,6 @@ #!nsh # -# @name Skywalker (3DR or Generic) +# @name Skywalker (3DR Aero) # # @type Standard Plane # diff --git a/ROMFS/px4fmu_common/init.d/4020_hk_micro_pcb b/ROMFS/px4fmu_common/init.d/4020_hk_micro_pcb index 4fd3a50c28..a6a31a30a9 100644 --- a/ROMFS/px4fmu_common/init.d/4020_hk_micro_pcb +++ b/ROMFS/px4fmu_common/init.d/4020_hk_micro_pcb @@ -1,7 +1,6 @@ #!nsh # -# @name Hobbyking Micro Integrated PCB Quadcopter -# with SimonK ESC firmware and Mystery A1510 motors +# @name Hobbyking Micro PCB # # @type Quadrotor x # diff --git a/ROMFS/px4fmu_common/init.d/50001_axialracing_ax10 b/ROMFS/px4fmu_common/init.d/50001_axialracing_ax10 index 8b60805a2f..b3e7f0978e 100644 --- a/ROMFS/px4fmu_common/init.d/50001_axialracing_ax10 +++ b/ROMFS/px4fmu_common/init.d/50001_axialracing_ax10 @@ -4,10 +4,7 @@ # # @type Rover # -# loading default values for the axialracing ax10 -# -#load some defaults e.g. PWM values sh /etc/init.d/rc.axialracing_ax10_defaults #choose a mixer, for rover control we need a plain passthrough to the servos diff --git a/ROMFS/px4fmu_common/init.d/rc.autostart b/ROMFS/px4fmu_common/init.d/rc.autostart deleted file mode 100644 index 0bb66a4b49..0000000000 --- a/ROMFS/px4fmu_common/init.d/rc.autostart +++ /dev/null @@ -1,318 +0,0 @@ -# -# SYS_AUTOSTART = 0 means no autostart (default) -# -# AUTOSTART PARTITION: -# 0 .. 999 Reserved (historical) -# 1000 .. 1999 Simulation setups -# 2000 .. 2999 Standard planes -# 3000 .. 3999 Flying wing -# 4000 .. 4999 Quad X -# 5000 .. 5999 Quad + -# 6000 .. 6999 Hexa X -# 7000 .. 7999 Hexa + -# 8000 .. 8999 Octo X -# 9000 .. 9999 Octo + -# 10000 .. 10999 Wide arm / H frame -# 11000 .. 11999 Hexa Cox -# 12000 .. 12999 Octo Cox -# 13000 .. 13999 VTOL -# 14000 .. 14999 Tri Y - -# -# Simulation -# - -if param compare SYS_AUTOSTART 901 -then - sh /etc/init.d/901_bottle_drop_test.hil - set MODE custom -fi - -if param compare SYS_AUTOSTART 1000 -then - sh /etc/init.d/1000_rc_fw_easystar.hil -fi - -if param compare SYS_AUTOSTART 1001 -then - sh /etc/init.d/1001_rc_quad_x.hil -fi - -if param compare SYS_AUTOSTART 1003 -then - sh /etc/init.d/1003_rc_quad_+.hil -fi - -if param compare SYS_AUTOSTART 1004 -then - sh /etc/init.d/1004_rc_fw_Rascal110.hil -fi - -if param compare SYS_AUTOSTART 1005 -then - sh /etc/init.d/1005_rc_fw_Malolo1.hil -fi - -# -# Plane -# - -if param compare SYS_AUTOSTART 2100 100 -then - sh /etc/init.d/2100_mpx_easystar - set MODE custom -fi - -if param compare SYS_AUTOSTART 2101 101 -then - sh /etc/init.d/2101_fw_AERT - set MODE custom -fi - -if param compare SYS_AUTOSTART 2102 102 -then - sh /etc/init.d/2102_3dr_skywalker - set MODE custom -fi - -if param compare SYS_AUTOSTART 2103 103 -then - sh /etc/init.d/2103_skyhunter_1800 - set MODE custom -fi - -if param compare SYS_AUTOSTART 2104 -then - sh /etc/init.d/2104_fw_AETR - set MODE custom -fi - -# -# Flying wing -# - -if param compare SYS_AUTOSTART 3030 30 -then - sh /etc/init.d/3030_io_camflyer -fi - -if param compare SYS_AUTOSTART 3031 31 -then - sh /etc/init.d/3031_phantom -fi - -if param compare SYS_AUTOSTART 3032 32 -then - sh /etc/init.d/3032_skywalker_x5 -fi - -if param compare SYS_AUTOSTART 3033 33 -then - sh /etc/init.d/3033_wingwing -fi - -if param compare SYS_AUTOSTART 3034 34 -then - sh /etc/init.d/3034_fx79 -fi - -if param compare SYS_AUTOSTART 3035 35 -then - sh /etc/init.d/3035_viper -fi - -if param compare SYS_AUTOSTART 3100 -then - sh /etc/init.d/3100_tbs_caipirinha -fi - -# -# Quad X -# - -if param compare SYS_AUTOSTART 4001 -then - sh /etc/init.d/4001_quad_x -fi - -# -# ARDrone -# - -if param compare SYS_AUTOSTART 4008 8 -then - sh /etc/init.d/4008_ardrone -fi - -if param compare SYS_AUTOSTART 4010 10 -then - sh /etc/init.d/4010_dji_f330 -fi - -if param compare SYS_AUTOSTART 4011 11 -then - sh /etc/init.d/4011_dji_f450 -fi - -if param compare SYS_AUTOSTART 4012 -then - sh /etc/init.d/4012_quad_x_can -fi - -if param compare SYS_AUTOSTART 4020 -then - sh /etc/init.d/4020_hk_micro_pcb -fi - -# -# Quad + -# - -if param compare SYS_AUTOSTART 5001 -then - sh /etc/init.d/5001_quad_+ -fi - -# -# Hexa X -# - -if param compare SYS_AUTOSTART 6001 -then - sh /etc/init.d/6001_hexa_x -fi - -# -# Hexa + -# - -if param compare SYS_AUTOSTART 7001 -then - sh /etc/init.d/7001_hexa_+ -fi - -# -# Octo X -# - -if param compare SYS_AUTOSTART 8001 -then - sh /etc/init.d/8001_octo_x -fi - -# -# Octo + -# - -if param compare SYS_AUTOSTART 9001 -then - sh /etc/init.d/9001_octo_+ -fi - -# -# Wide arm / H frame -# - -if param compare SYS_AUTOSTART 10015 15 -then - sh /etc/init.d/10015_tbs_discovery -fi - -if param compare SYS_AUTOSTART 10016 16 -then - sh /etc/init.d/10016_3dr_iris -fi - -if param compare SYS_AUTOSTART 10017 -then - sh /etc/init.d/10017_steadidrone_qu4d -fi - -if param compare SYS_AUTOSTART 10018 18 -then - sh /etc/init.d/10018_tbs_endurance -fi - -if param compare SYS_AUTOSTART 10019 -then - sh /etc/init.d/10019_sk450_deadcat -fi - -# -# Hexa Coaxial -# - -if param compare SYS_AUTOSTART 11001 -then - sh /etc/init.d/11001_hexa_cox -fi - -# -# Octo Coaxial -# - -if param compare SYS_AUTOSTART 12001 -then - sh /etc/init.d/12001_octo_cox -fi - -# 13000 is historically reserved for the quadshot - -# -# VTOL Caipririnha (Tailsitter) -# -if param compare SYS_AUTOSTART 13001 -then - sh /etc/init.d/13001_caipirinha_vtol -fi - -# -# VTOL BirdsEyeView FireFly x6 (Tilt-Rotor) -# -if param compare SYS_AUTOSTART 13002 -then - sh /etc/init.d/13002_firefly6 -fi - -# -# Tailsitter with 4 motors in x config -# -if param compare SYS_AUTOSTART 13003 -then - sh /etc/init.d/13003_quad_tailsitter -fi - -# -# Tailsitter with 4 motors in + config -# -if param compare SYS_AUTOSTART 13004 -then - sh /etc/init.d/13004_quad+_tailsitter -fi - -# -# TriCopter Y Yaw+ -# -if param compare SYS_AUTOSTART 14001 -then - sh /etc/init.d/14001_tri_y_yaw+ -fi - -# -# TriCopter Y Yaw- -# -if param compare SYS_AUTOSTART 14002 -then - sh /etc/init.d/14002_tri_y_yaw- -fi - - - -# -# Ground Rover AxialRacing AX10 -# -if param compare SYS_AUTOSTART 50001 -then - sh /etc/init.d/50001_axialracing_ax10 -fi - diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 81b301fe18..e158cb3dba 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -457,13 +457,13 @@ then if [ $TTYS1_BUSY == yes ] then # Start MAVLink on ttyS0, because FMU ttyS1 pins configured as something else - set MAVLINK_F "-r 5000 -d /dev/ttyS0" + set MAVLINK_F "-r 1200 -d /dev/ttyS0" # Exit from nsh to free port for mavlink set EXIT_ON_END yes else # Start MAVLink on default port: ttyS1 - set MAVLINK_F "-r 5000" + set MAVLINK_F "-r 1200" fi fi diff --git a/ROMFS/px4fmu_common/mixers/quad_+_vtol.main.mix b/ROMFS/px4fmu_common/mixers/quad_+_vtol.main.mix index 1f79661f9a..3021221d80 100644 --- a/ROMFS/px4fmu_common/mixers/quad_+_vtol.main.mix +++ b/ROMFS/px4fmu_common/mixers/quad_+_vtol.main.mix @@ -18,11 +18,11 @@ S: 1 0 10000 10000 0 -10000 10000 S: 1 1 -10000 -10000 0 -10000 10000 # mixer for canard surface -M: 2 +M: 1 O: 10000 10000 0 -10000 10000 S: 1 1 -10000 -10000 0 -10000 10000 # mixer for rudder -M: 2 +M: 1 O: 10000 10000 0 -10000 10000 S: 1 2 -10000 -10000 0 -10000 10000 diff --git a/Tools/airframes.xml b/Tools/airframes.xml deleted file mode 100644 index 1a68e23878..0000000000 --- a/Tools/airframes.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - 1 - - - - - - - - - - diff --git a/Tools/px4airframes/__init__.py b/Tools/px4airframes/__init__.py index 3a9f1e2c6d..43e82d2643 100644 --- a/Tools/px4airframes/__init__.py +++ b/Tools/px4airframes/__init__.py @@ -1 +1 @@ -__all__ = ["srcscanner", "srcparser", "xmlout", "dokuwikiout", "dokuwikirpc"] \ No newline at end of file +__all__ = ["srcscanner", "srcparser", "xmlout", "rcout"] \ No newline at end of file diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py new file mode 100644 index 0000000000..de5af0f305 --- /dev/null +++ b/Tools/px4airframes/rcout.py @@ -0,0 +1,54 @@ +from xml.sax.saxutils import escape +import codecs + +class RCOutput(): + def __init__(self, groups, board): + result = ( "#\n" + "#\n" + "# THIS FILE IS AUTO-GENERATED. DO NOT EDIT!\n" + "#\n" + "#\n" + "# SYS_AUTOSTART = 0 means no autostart (default)\n" + "#\n" + "# AUTOSTART PARTITION:\n" + "# 0 .. 999 Reserved (historical)\n" + "# 1000 .. 1999 Simulation setups\n" + "# 2000 .. 2999 Standard planes\n" + "# 3000 .. 3999 Flying wing\n" + "# 4000 .. 4999 Quadrotor x\n" + "# 5000 .. 5999 Quadrotor +\n" + "# 6000 .. 6999 Hexarotor x\n" + "# 7000 .. 7999 Hexarotor +\n" + "# 8000 .. 8999 Octorotor x\n" + "# 9000 .. 9999 Octorotor +\n" + "# 10000 .. 10999 Quadrotor Wide arm / H frame\n" + "# 11000 .. 11999 Hexa Cox\n" + "# 12000 .. 12999 Octo Cox\n" + "# 13000 .. 13999 VTOL\n" + "# 14000 .. 14999 Tri Y\n" + "\n") + for group in groups: + result += "# GROUP: %s\n\n" % group.GetName() + for param in group.GetParams(): + path = param.GetPath().rsplit('/', 1)[1] + id_val = param.GetId() + name = param.GetFieldValue("short_desc") + long_desc = param.GetFieldValue("long_desc") + + result += "#\n" + result += "# %s\n" % param.GetName() + result += "if param compare SYS_AUTOSTART %s\n" % id_val + result += "then\n" + result += "\tsh /etc/init.d/%s\n" % path + result += "fi\n" + + #if long_desc is not None: + # result += "# %s\n" % long_desc + result += "\n" + + result += "\n" + self.output = result; + + def Save(self, filename): + with codecs.open(filename, 'w', 'utf-8') as f: + f.write(self.output) diff --git a/Tools/px4airframes/srcparser.py b/Tools/px4airframes/srcparser.py index 130b0f24cf..699a2cdc3b 100644 --- a/Tools/px4airframes/srcparser.py +++ b/Tools/px4airframes/srcparser.py @@ -46,14 +46,18 @@ class Parameter(object): # all others == 0 (sorted alphabetically) } - def __init__(self, name, airframe_type, airframe_id, maintainer): + def __init__(self, path, name, airframe_type, airframe_id, maintainer): self.fields = {} self.outputs = {} + self.path = path self.name = name self.type = airframe_type self.id = airframe_id self.maintainer = maintainer + def GetPath(self): + return self.path + def GetName(self): return self.name @@ -259,7 +263,7 @@ class SourceParser(object): return False # We already know this is an airframe config, so add it - param = Parameter(airframe_name, airframe_type, airframe_id, maintainer) + param = Parameter(path, airframe_name, airframe_type, airframe_id, maintainer) # Done with file, store for tag in tags: diff --git a/Tools/px4airframes/xmlout.py b/Tools/px4airframes/xmlout.py index f5d254bbc0..427b1090a2 100644 --- a/Tools/px4airframes/xmlout.py +++ b/Tools/px4airframes/xmlout.py @@ -35,20 +35,22 @@ class XMLOutput(): xml_group.attrib["image"] = "AirframeQuadRotorX.png" elif (group.GetName() == "Quadrotor +"): xml_group.attrib["image"] = "AirframeQuadRotorPlus.png" - elif (group.GetName() == "Hexa x"): + elif (group.GetName() == "Hexarotor x"): xml_group.attrib["image"] = "AirframeHexaRotorX.png" - elif (group.GetName() == "Hexa +"): + elif (group.GetName() == "Hexarotor +"): xml_group.attrib["image"] = "AirframeHexaRotorPlus.png" - elif (group.GetName() == "Octo +"): + elif (group.GetName() == "Octorotor +"): xml_group.attrib["image"] = "AirframeOctoRotorPlus.png" - elif (group.GetName() == "Octo X"): + elif (group.GetName() == "Octorotor x"): xml_group.attrib["image"] = "AirframeOctoRotorX.png" + elif (group.GetName() == "Quadrotor Wide"): + xml_group.attrib["image"] = "AirframeQuadRotorH.png" elif (group.GetName() == "Quadrotor H"): xml_group.attrib["image"] = "AirframeQuadRotorH.png" elif (group.GetName() == "Simulation"): xml_group.attrib["image"] = "AirframeSimulation.png" else: - xml_group.attrib["image"] = "AirframeStandardPlane.png" + xml_group.attrib["image"] = "" 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") diff --git a/Tools/px_process_airframes.py b/Tools/px_process_airframes.py index 50aaa699ef..7d7d28a2b2 100755 --- a/Tools/px_process_airframes.py +++ b/Tools/px_process_airframes.py @@ -46,7 +46,7 @@ from __future__ import print_function import sys import os import argparse -from px4airframes import srcscanner, srcparser, xmlout +from px4airframes import srcscanner, srcparser, xmlout, rcout def main(): # Parse command line arguments @@ -61,6 +61,11 @@ def main(): metavar="FILENAME", help="Create XML file" " (default FILENAME: airframes.xml)") + parser.add_argument("-s", "--start-script", + nargs='?', + const="rc.autostart", + metavar="FILENAME", + help="Create start script file") parser.add_argument("-b", "--board", nargs='?', const="", @@ -69,7 +74,7 @@ def main(): args = parser.parse_args() # Check for valid command - if not (args.xml): + if not (args.xml) and not (args.start_script): print("Error: You need to specify at least one output method!\n") parser.print_usage() sys.exit(1) @@ -93,6 +98,11 @@ def main(): out = xmlout.XMLOutput(param_groups, args.board) out.Save(args.xml) + if args.start_script: + print("Creating start script " + args.start_script) + out = rcout.RCOutput(param_groups, args.board) + out.Save(args.start_script) + print("All done!") diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 8ab53089ed..0aff25cfea 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -350,6 +350,9 @@ ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) LIBS += $(ROMFS_OBJ) LINK_DEPS += $(ROMFS_OBJ) +# Add autostart script +ROMFS_AUTOSTART = $(PX4_BASE)/Tools/px_process_airframes.py + # Remove all comments from startup and mixer files ROMFS_PRUNER = $(PX4_BASE)/Tools/px_romfs_pruner.py @@ -372,6 +375,10 @@ ifneq ($(ROMFS_EXTRA_FILES),) $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras $(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras endif + $(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d -s $(ROMFS_SCRATCH)/init.d/rc.autostart + # Execute in standard dir as well + # so developers notice the generated file + $(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d -s $(ROMFS_ROOT)/init.d/rc.autostart $(Q) $(PYTHON) -u $(ROMFS_PRUNER) --folder $(ROMFS_SCRATCH) EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG) diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp index f250eef475..6c377ccfe6 100644 --- a/src/modules/commander/accelerometer_calibration.cpp +++ b/src/modules/commander/accelerometer_calibration.cpp @@ -559,6 +559,7 @@ int do_level_calibration(int mavlink_fd) { const unsigned cal_time = 5; const unsigned cal_hz = 100; const unsigned settle_time = 30; + bool success = false; int att_sub = orb_subscribe(ORB_ID(vehicle_attitude)); struct vehicle_attitude_s att; memset(&att, 0, sizeof(att)); @@ -597,7 +598,15 @@ int do_level_calibration(int mavlink_fd) { start = hrt_absolute_time(); // average attitude for 5 seconds while(hrt_elapsed_time(&start) < cal_time * 1000000) { - poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); + int pollret = poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); + + if (pollret <= 0) { + // attitude estimator is not running + mavlink_and_console_log_critical(mavlink_fd, "attitude estimator not running - check system boot"); + mavlink_and_console_log_critical(mavlink_fd, CAL_QGC_FAILED_MSG, "level"); + goto out; + } + orb_copy(ORB_ID(vehicle_attitude), att_sub, &att); roll_mean += att.roll; pitch_mean += att.pitch; @@ -606,7 +615,6 @@ int do_level_calibration(int mavlink_fd) { mavlink_and_console_log_info(mavlink_fd, CAL_QGC_PROGRESS_MSG, 100); - bool success = false; if (counter > (cal_time * cal_hz / 2 )) { roll_mean /= counter; pitch_mean /= counter; diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index a23b3f8736..655a918844 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1232,6 +1232,7 @@ Mavlink::update_rate_mult() float const_rate = 0.0f; float rate = 0.0f; + /* scale down rates if their theoretical bandwidth is exceeding the link bandwidth */ MavlinkStream *stream; LL_FOREACH(_streams, stream) { if (stream->const_rate()) { @@ -1244,6 +1245,11 @@ Mavlink::update_rate_mult() /* don't scale up rates, only scale down if needed */ _rate_mult = fminf(1.0f, ((float)_datarate - const_rate) / rate); + + /* scale down if we have a TX err rate suggesting link congestion */ + if (_rate_txerr > 0.0f) { + _rate_mult = (_rate_tx) / (_rate_tx + _rate_txerr); + } } int