From d04d62c37ef72914454a99036ff5f675e24f626f Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 25 Sep 2017 11:17:50 -0400 Subject: [PATCH] airframe metadata sort by SYS_AUTOSTART and minor cleanup (#8009) --- ROMFS/px4fmu_common/init.d/11001_hexa_cox | 2 +- .../init.d/13000_generic_vtol_standard | 38 ++++++++++++ ROMFS/px4fmu_common/init.d/3000_generic_wing | 18 ++++++ ROMFS/px4fmu_common/init.d/3030_io_camflyer | 3 +- ROMFS/px4fmu_common/init.d/3032_skywalker_x5 | 2 +- ROMFS/px4fmu_common/init.d/4001_quad_x | 2 +- ROMFS/px4fmu_common/init.d/4002_quad_x_mount | 2 +- .../init.d/{10021_H4_680mm => 4004_H4_680mm} | 0 .../init.d/{4030_solo => 4030_3dr_solo} | 0 .../init.d/{10020_3dr_quad => 4031_3dr_quad} | 0 .../init.d/50000_generic_ground_vehicle | 61 +++++++++++++++++++ .../init.d/50002_traxxas_stampede_2wd | 3 +- .../init.d/{rc.gnd_apps => rc.ugv_apps} | 0 .../{rc.gnd_defaults => rc.ugv_defaults} | 2 +- ROMFS/px4fmu_common/init.d/rcS | 4 +- ROMFS/px4fmu_common/mixers/Q.main.mix | 51 ---------------- .../{X5.main.mix => fw_generic_wing.main.mix} | 8 +-- .../px4fmu_common/mixers/ugv_generic.main.mix | 37 +++++++++++ Tools/px4airframes/srcparser.py | 29 +-------- Tools/px4airframes/xmlout.py | 1 + 20 files changed, 173 insertions(+), 90 deletions(-) create mode 100644 ROMFS/px4fmu_common/init.d/13000_generic_vtol_standard create mode 100644 ROMFS/px4fmu_common/init.d/3000_generic_wing rename ROMFS/px4fmu_common/init.d/{10021_H4_680mm => 4004_H4_680mm} (100%) rename ROMFS/px4fmu_common/init.d/{4030_solo => 4030_3dr_solo} (100%) rename ROMFS/px4fmu_common/init.d/{10020_3dr_quad => 4031_3dr_quad} (100%) create mode 100644 ROMFS/px4fmu_common/init.d/50000_generic_ground_vehicle rename ROMFS/px4fmu_common/init.d/{rc.gnd_apps => rc.ugv_apps} (100%) rename ROMFS/px4fmu_common/init.d/{rc.gnd_defaults => rc.ugv_defaults} (99%) delete mode 100644 ROMFS/px4fmu_common/mixers/Q.main.mix rename ROMFS/px4fmu_common/mixers/{X5.main.mix => fw_generic_wing.main.mix} (85%) create mode 100644 ROMFS/px4fmu_common/mixers/ugv_generic.main.mix diff --git a/ROMFS/px4fmu_common/init.d/11001_hexa_cox b/ROMFS/px4fmu_common/init.d/11001_hexa_cox index 708b172b41..a61f5eac08 100644 --- a/ROMFS/px4fmu_common/init.d/11001_hexa_cox +++ b/ROMFS/px4fmu_common/init.d/11001_hexa_cox @@ -1,6 +1,6 @@ #!nsh # -# @name Generic Hexa coaxial geometry +# @name Generic Hexarotor coaxial geometry # # @type Hexarotor Coaxial # @class Copter diff --git a/ROMFS/px4fmu_common/init.d/13000_generic_vtol_standard b/ROMFS/px4fmu_common/init.d/13000_generic_vtol_standard new file mode 100644 index 0000000000..674fc40910 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/13000_generic_vtol_standard @@ -0,0 +1,38 @@ +#!nsh +# +# @name Generic Quadplane VTOL +# +# @type Standard VTOL +# @class VTOL +# +# @maintainer +# +# @output MAIN1 motor 1 +# @output MAIN2 motor 2 +# @output MAIN3 motor 3 +# @output MAIN4 motor 4 +# @output AUX1 Aileron 1 +# @output AUX2 Aileron 2 +# @output AUX3 Elevator +# @output AUX4 Rudder +# @output AUX5 Throttle +# +# @board px4fmu-v1 exclude + +sh /etc/init.d/rc.vtol_defaults + +if [ $AUTOCNF == yes ] +then + param set VT_TYPE 2 + param set VT_MOT_COUNT 4 +fi + +set MIXER quad_x +set PWM_OUT 1234 +set PWM_RATE 400 + +set MIXER_AUX vtol_AAERT +set PWM_ACHDIS 5 +set PWM_AUX_DISARMED 950 + +set MAV_TYPE 22 diff --git a/ROMFS/px4fmu_common/init.d/3000_generic_wing b/ROMFS/px4fmu_common/init.d/3000_generic_wing new file mode 100644 index 0000000000..8ce2d55f83 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/3000_generic_wing @@ -0,0 +1,18 @@ +#!nsh +# +# @name Generic Flying Wing +# +# @type Flying Wing +# @class Plane +# +# @maintainer +# + +sh /etc/init.d/rc.fw_defaults + +if [ $AUTOCNF == yes ] +then + +fi + +set MIXER fw_generic_wing diff --git a/ROMFS/px4fmu_common/init.d/3030_io_camflyer b/ROMFS/px4fmu_common/init.d/3030_io_camflyer index 2e88892795..f5cee7b918 100644 --- a/ROMFS/px4fmu_common/init.d/3030_io_camflyer +++ b/ROMFS/px4fmu_common/init.d/3030_io_camflyer @@ -43,7 +43,8 @@ then param set FW_RR_P 0.04 fi -set MIXER Q +set MIXER fw_generic_wing + # Provide ESC a constant 1000 us pulse while disarmed set PWM_OUT 4 set PWM_DISARMED 1000 diff --git a/ROMFS/px4fmu_common/init.d/3032_skywalker_x5 b/ROMFS/px4fmu_common/init.d/3032_skywalker_x5 index 4e24659351..5ee10c2c4a 100644 --- a/ROMFS/px4fmu_common/init.d/3032_skywalker_x5 +++ b/ROMFS/px4fmu_common/init.d/3032_skywalker_x5 @@ -40,4 +40,4 @@ then param set FW_RR_P 0.04 fi -set MIXER X5 +set MIXER fw_generic_wing diff --git a/ROMFS/px4fmu_common/init.d/4001_quad_x b/ROMFS/px4fmu_common/init.d/4001_quad_x index cac569c01b..f122cece3d 100644 --- a/ROMFS/px4fmu_common/init.d/4001_quad_x +++ b/ROMFS/px4fmu_common/init.d/4001_quad_x @@ -1,6 +1,6 @@ #!nsh # -# @name Generic Quadrotor X config +# @name Generic Quadrotor x # # @type Quadrotor x # @class Copter diff --git a/ROMFS/px4fmu_common/init.d/4002_quad_x_mount b/ROMFS/px4fmu_common/init.d/4002_quad_x_mount index 646907c0c2..d4f7b8b501 100644 --- a/ROMFS/px4fmu_common/init.d/4002_quad_x_mount +++ b/ROMFS/px4fmu_common/init.d/4002_quad_x_mount @@ -1,6 +1,6 @@ #!nsh # -# @name Generic Quadrotor X config with mount (e.g. gimbal) +# @name Generic Quadrotor x with mount (e.g. gimbal) # # @type Quadrotor x # @class Copter diff --git a/ROMFS/px4fmu_common/init.d/10021_H4_680mm b/ROMFS/px4fmu_common/init.d/4004_H4_680mm similarity index 100% rename from ROMFS/px4fmu_common/init.d/10021_H4_680mm rename to ROMFS/px4fmu_common/init.d/4004_H4_680mm diff --git a/ROMFS/px4fmu_common/init.d/4030_solo b/ROMFS/px4fmu_common/init.d/4030_3dr_solo similarity index 100% rename from ROMFS/px4fmu_common/init.d/4030_solo rename to ROMFS/px4fmu_common/init.d/4030_3dr_solo diff --git a/ROMFS/px4fmu_common/init.d/10020_3dr_quad b/ROMFS/px4fmu_common/init.d/4031_3dr_quad similarity index 100% rename from ROMFS/px4fmu_common/init.d/10020_3dr_quad rename to ROMFS/px4fmu_common/init.d/4031_3dr_quad diff --git a/ROMFS/px4fmu_common/init.d/50000_generic_ground_vehicle b/ROMFS/px4fmu_common/init.d/50000_generic_ground_vehicle new file mode 100644 index 0000000000..165b34b039 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/50000_generic_ground_vehicle @@ -0,0 +1,61 @@ +#!nsh +# +# @name Generic Ground Vehicle +# +# @type Rover +# @class Rover +# +# @output MAIN2 steering +# @output MAIN4 throttle +# +# @maintainer +# + +sh /etc/init.d/rc.ugv_defaults + +if [ $AUTOCNF == yes ] +then + param set BAT_N_CELLS 2 + + param set FW_AIRSPD_MIN 0 + param set FW_AIRSPD_TRIM 1 + param set FW_AIRSPD_MAX 3 + + param set NAV_ACC_RAD 0.5 + + param set MIS_LTRMIN_ALT 0.01 + param set MIS_TAKEOFF_ALT 0.01 + + param set EKF2_GBIAS_INIT 0.01 + param set EKF2_ANGERR_INIT 0.01 + param set EKF2_MAG_TYPE 1 + + param set GND_WR_P 2 + param set GND_WR_I 0.9674 + param set GND_WR_IMAX 0.1 + param set GND_WR_D 1.2 + param set GND_SP_CTRL_MODE 1 + param set GND_L1_DIST 10 + param set GND_THR_IDLE 0 + param set GND_THR_CRUISE 0 + param set GND_THR_MAX 0.5 + param set GND_THR_MIN 0 + param set GND_SPEED_P 0.25 + param set GND_SPEED_I 0.001 + param set GND_SPEED_D 3 + param set GND_SPEED_IMAX 0.125 + param set GND_SPEED_THR_SC 1 + +fi + +# Configure this as ugv +set MAV_TYPE 10 + +# Set mixer +set MIXER ugv_generic + +# Provide ESC a constant 1500 us pulse +set PWM_DISARMED 1500 +set PWM_MAIN_REV2 1 +set PWM_MAX 2000 +set PWM_MIN 1000 diff --git a/ROMFS/px4fmu_common/init.d/50002_traxxas_stampede_2wd b/ROMFS/px4fmu_common/init.d/50002_traxxas_stampede_2wd index c229b1453c..11f837c71b 100644 --- a/ROMFS/px4fmu_common/init.d/50002_traxxas_stampede_2wd +++ b/ROMFS/px4fmu_common/init.d/50002_traxxas_stampede_2wd @@ -13,7 +13,7 @@ # @maintainer Marco Zorzi # -sh /etc/init.d/rc.gnd_defaults +sh /etc/init.d/rc.ugv_defaults if [ $AUTOCNF == yes ] then @@ -52,6 +52,7 @@ fi # Configure this as ugv set MAV_TYPE 10 + # Set mixer set MIXER stampede diff --git a/ROMFS/px4fmu_common/init.d/rc.gnd_apps b/ROMFS/px4fmu_common/init.d/rc.ugv_apps similarity index 100% rename from ROMFS/px4fmu_common/init.d/rc.gnd_apps rename to ROMFS/px4fmu_common/init.d/rc.ugv_apps diff --git a/ROMFS/px4fmu_common/init.d/rc.gnd_defaults b/ROMFS/px4fmu_common/init.d/rc.ugv_defaults similarity index 99% rename from ROMFS/px4fmu_common/init.d/rc.gnd_defaults rename to ROMFS/px4fmu_common/init.d/rc.ugv_defaults index 556098f924..1af7920217 100644 --- a/ROMFS/px4fmu_common/init.d/rc.gnd_defaults +++ b/ROMFS/px4fmu_common/init.d/rc.ugv_defaults @@ -9,7 +9,7 @@ then # param set NAV_DLL_ACT 0 param set NAV_ACC_RAD 2.0 - + # temporary param set NAV_FW_ALT_RAD 1000 diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 9349126c2a..79d5bc2d1b 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -865,7 +865,7 @@ then if [ $MIXER == none ] then # Set default mixer for UGV if not defined - set MIXER stampede + set MIXER ugv_generic fi if [ $MAV_TYPE == none ] @@ -880,7 +880,7 @@ then sh /etc/init.d/rc.interface # Start standard UGV apps - sh /etc/init.d/rc.gnd_apps + sh /etc/init.d/rc.ugv_apps fi # diff --git a/ROMFS/px4fmu_common/mixers/Q.main.mix b/ROMFS/px4fmu_common/mixers/Q.main.mix deleted file mode 100644 index 95a3d226d3..0000000000 --- a/ROMFS/px4fmu_common/mixers/Q.main.mix +++ /dev/null @@ -1,51 +0,0 @@ -Delta-wing mixer for PX4FMU -=========================== - -Designed for Bormatec Camflyer Q - -This file defines mixers suitable for controlling a delta wing aircraft using -PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU -servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is -assumed to be unused. - -Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0 -(roll), 1 (pitch) and 3 (thrust). - -See the README for more information on the scaler format. - -Elevon mixers -------------- -Three scalers total (output, roll, pitch). - -On the assumption that the two elevon servos are physically reversed, the pitch -input is inverted between the two servos. - -The scaling factor for roll inputs is adjusted to implement differential travel -for the elevons. - -M: 2 -O: 10000 10000 0 -10000 10000 -S: 0 0 -8000 -8000 0 -10000 10000 -S: 0 1 6000 6000 0 -10000 10000 - -M: 2 -O: 10000 10000 0 -10000 10000 -S: 0 0 -8000 -8000 0 -10000 10000 -S: 0 1 -6000 -6000 0 -10000 10000 - -Output 2 --------- -This mixer is empty. - -Z: - -Motor speed mixer ------------------ -Two scalers total (output, thrust). - -This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1) -range. Inputs below zero are treated as zero. - -M: 1 -O: 10000 10000 0 -10000 10000 -S: 0 3 0 20000 -10000 -10000 10000 diff --git a/ROMFS/px4fmu_common/mixers/X5.main.mix b/ROMFS/px4fmu_common/mixers/fw_generic_wing.main.mix similarity index 85% rename from ROMFS/px4fmu_common/mixers/X5.main.mix rename to ROMFS/px4fmu_common/mixers/fw_generic_wing.main.mix index 4a3093c2e6..b33afc15fe 100644 --- a/ROMFS/px4fmu_common/mixers/X5.main.mix +++ b/ROMFS/px4fmu_common/mixers/fw_generic_wing.main.mix @@ -1,9 +1,9 @@ -Delta-wing mixer for PX4FMU +Generic wing mixer =========================== -This file defines mixers suitable for controlling a delta wing aircraft using -PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU -servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is +This file defines mixers suitable for controlling a delta wing aircraft. +The configuration assumes the elevon servos are connected to servo +outputs 0 and 1 and the motor speed control to output 3. Output 2 is assumed to be unused. Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0 diff --git a/ROMFS/px4fmu_common/mixers/ugv_generic.main.mix b/ROMFS/px4fmu_common/mixers/ugv_generic.main.mix new file mode 100644 index 0000000000..aacfef1f5b --- /dev/null +++ b/ROMFS/px4fmu_common/mixers/ugv_generic.main.mix @@ -0,0 +1,37 @@ +Generic car mixer (eg Traxxas Stampede RC Car) +=========================== + +Designed for Traxxas Stampede + +This file defines mixers suitable for controlling a Traxxas Stampede rover using +PX4FMU. The configuration assumes the steering is connected to PX4FMU +servo outputs 1 and the motor speed control to output 3. Output 0 and 2 is +assumed to be unused. + +Inputs to the mixer come from channel group 0 (vehicle attitude), channels 2 (yaw), and 3 (thrust). + +See the README for more information on the scaler format. + + +Output 0 +--------------------------------------- +Z: + +Steering mixer using roll on output 1 +--------------------------------------- +M: 1 +O: 10000 10000 0 -10000 10000 +S: 0 2 10000 10000 0 -10000 10000 + + +Output 2 +--------------------------------------- +This mixer is empty. +Z: + + +Output 3 +--------------------------------------- +M: 1 +O: 10000 10000 0 -10000 10000 +S: 0 3 10000 10000 0 -10000 10000 diff --git a/Tools/px4airframes/srcparser.py b/Tools/px4airframes/srcparser.py index 6704352158..eec9dffb11 100644 --- a/Tools/px4airframes/srcparser.py +++ b/Tools/px4airframes/srcparser.py @@ -90,16 +90,14 @@ class ParameterGroup(object): return "Boat" return "AirframeUnknown" - - def GetParams(self): """ Returns the parsed list of parameters. Every parameter is a Parameter object. Note that returned object is not a copy. Modifications affect state of the parser. """ - return sorted(self.params, - key=lambda x: x.GetFieldValue("code")) + + return sorted(self.params, key=lambda x: x.GetId()) class Parameter(object): """ @@ -443,28 +441,7 @@ class SourceParser(object): sys.stderr.write("Duplicate parameter definition: {0}\n".format(name_plus_board)) return False seenParamNames.append(name_plus_board) - # Validate values - default = param.GetDefault() - min = param.GetFieldValue("min") - max = param.GetFieldValue("max") - #sys.stderr.write("{0} default:{1} min:{2} max:{3}\n".format(name, default, min, max)) - if default != "" and not self.IsNumber(default): - sys.stderr.write("Default value not number: {0} {1}\n".format(name, default)) - return False - if min != "": - if not self.IsNumber(min): - sys.stderr.write("Min value not number: {0} {1}\n".format(name, min)) - return False - if default != "" and float(default) < float(min): - sys.stderr.write("Default value is smaller than min: {0} default:{1} min:{2}\n".format(name, default, min)) - return False - if max != "": - if not self.IsNumber(max): - sys.stderr.write("Max value not number: {0} {1}\n".format(name, max)) - return False - if default != "" and float(default) > float(max): - sys.stderr.write("Default value is larger than max: {0} default:{1} max:{2}\n".format(name, default, max)) - return False + return True def GetParamGroups(self): diff --git a/Tools/px4airframes/xmlout.py b/Tools/px4airframes/xmlout.py index 6d9ba02ac5..6de2e1b920 100644 --- a/Tools/px4airframes/xmlout.py +++ b/Tools/px4airframes/xmlout.py @@ -57,6 +57,7 @@ class XMLOutput(): attribstrs = attrib.split(":") xml_field.attrib[attribstrs[0].strip()] = attribstrs[1].strip() xml_field.text = valstrs[0] + indent(xml_parameters) self.xml_document = ET.ElementTree(xml_parameters)