Compare commits

..

1 Commits

Author SHA1 Message Date
Daniel Agar f9973e0464 WIP: enable -Wfloat-conversion everywhere 2021-10-07 11:44:25 -04:00
456 changed files with 4783 additions and 7176 deletions
+1
View File
@@ -86,6 +86,7 @@ pipeline {
"px4_fmu-v3_default",
"px4_fmu-v4_default",
"px4_fmu-v4pro_default",
"px4_fmu-v5_ctrlalloc",
"px4_fmu-v5_debug",
"px4_fmu-v5_default",
"px4_fmu-v5_rtps",
+81 -38
View File
@@ -21,7 +21,7 @@ pipeline {
sh 'make cubepilot_cubeorange_test'
sh 'make cubepilot_cubeorange_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'cubepilot_cubeorange_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'cubepilot_cubeorange_test'
}
post {
always {
@@ -70,7 +70,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/cubepilot_cubeorange_test/cubepilot_cubeorange_test.elf || true'
resetBoard()
}
}
@@ -92,7 +91,7 @@ pipeline {
sh 'make cuav_x7pro_test'
sh 'make cuav_x7pro_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'cuav_x7pro_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'cuav_x7pro_test'
}
post {
always {
@@ -139,7 +138,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/cuav_x7pro_test/cuav_x7pro_test.elf || true'
resetBoard()
}
}
@@ -161,7 +159,7 @@ pipeline {
sh 'make px4_fmu-v3_test'
sh 'make px4_fmu-v3_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v3_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v3_test'
}
post {
always {
@@ -208,7 +206,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v3_test/px4_fmu-v3_test.elf || true'
resetBoard()
}
}
@@ -230,7 +227,7 @@ pipeline {
sh 'make px4_fmu-v4_test'
sh 'make px4_fmu-v4_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v4_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v4_test'
}
post {
always {
@@ -276,7 +273,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v4_test/px4_fmu-v4_test.elf || true'
resetBoard()
}
}
@@ -298,7 +294,7 @@ pipeline {
sh 'make px4_fmu-v4pro_test'
sh 'make px4_fmu-v4pro_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v4pro_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v4pro_test'
}
post {
always {
@@ -345,7 +341,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v4pro_test/px4_fmu-v4pro_test.elf || true'
resetBoard()
}
}
@@ -367,7 +362,7 @@ pipeline {
sh 'make px4_fmu-v5_debug'
sh 'make px4_fmu-v5_debug bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_debug'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_debug'
}
post {
always {
@@ -425,7 +420,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v5_debug/px4_fmu-v5_debug.elf || true'
resetBoard()
}
}
@@ -447,7 +441,7 @@ pipeline {
sh 'make px4_fmu-v5_stackcheck'
sh 'make px4_fmu-v5_stackcheck bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_stackcheck'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_stackcheck'
}
post {
always {
@@ -504,7 +498,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf || true'
resetBoard()
}
}
@@ -526,7 +519,7 @@ pipeline {
sh 'make px4_fmu-v5_test'
sh 'make px4_fmu-v5_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_test'
}
post {
always {
@@ -573,7 +566,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/px4_fmu-v5_test/px4_fmu-v5_test.elf || true'
resetBoard()
}
}
@@ -581,6 +573,73 @@ pipeline {
}
}
// stage("modalai_fc-v1_test") {
// stages {
// stage("build modalai_fc-v1_test") {
// agent {
// docker {
// image 'px4io/px4-dev-nuttx-focal:2021-09-08'
// args '--cpu-shares 512 -e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
// }
// }
// steps {
// checkout scm
// sh 'export'
// sh 'make distclean'
// sh 'ccache -s'
// sh 'git fetch --tags'
// sh 'make modalai_fc-v1_test'
// sh 'make modalai_fc-v1_test bootloader_elf'
// sh 'ccache -s'
// stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'modalai_fc-v1_test'
// }
// post {
// always {
// sh 'make distclean'
// }
// }
// } // stage build
// stage("hardware") {
// agent {
// label 'modalai_fc-v1'
// }
// stages {
// stage("flash") {
// steps {
// sh 'export'
// sh 'find /dev/serial'
// unstash 'modalai_fc-v1_test'
// sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/modalai_fc-v1_test/modalai_fc-v1_bootloader.elf'
// // flash board and watch bootup
// sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/modalai_fc-v1_test/modalai_fc-v1_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
// }
// }
// stage("tests") {
// steps {
// runTests()
// }
// }
// stage("status") {
// steps {
// // configure
// resetParameters()
// sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "SYS_AUTOSTART" --value "4001"' // generic quadcopter
// sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "SYS_BL_UPDATE" --value "1"' // update bootloader
// checkStatus()
// quickCalibrate()
// }
// }
// stage("print topics") {
// steps {
// printTopics()
// }
// }
// }
// } // stage test
// }
// }
stage("nxp_fmuk66-v3_test") {
stages {
stage("build nxp_fmuk66-v3_test") {
@@ -595,7 +654,7 @@ pipeline {
sh 'make nxp_fmuk66-v3_test'
//sh 'make nxp_fmuk66-v3_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'nxp_fmuk66-v3_test'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'nxp_fmuk66-v3_test'
}
post {
always {
@@ -642,7 +701,6 @@ pipeline {
}
post {
always {
sh './platforms/nuttx/Debug/jlink_gdb_backtrace.sh build/nxp_fmuk66-v3_test/nxp_fmuk66-v3_test.elf || true'
resetBoard()
}
}
@@ -676,26 +734,12 @@ void checkoutSCM() {
}
void quickCalibrate() {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate accel quick; sleep 1; param show CAL_ACC*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate gyro; sleep 1; param show CAL_GYRO*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate level; sleep 1; param show SENS_BOARD*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate mag quick; sleep 1; param show CAL_MAG*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show CAL_*"' // parameters before
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sensors status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "gyro_calibration status || true"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate accel quick"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show CAL_ACC*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate gyro"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show CAL_GYRO*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate level"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show SENS*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander calibrate mag quick"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show CAL_MAG*"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show CAL_*"' // parameters after
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sensors status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "gyro_calibration status; param show CAL_GYRO*"'
}
void checkStatus() {
@@ -787,7 +831,6 @@ void runTests() {
//sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sd_stress"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "commander stop"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sensors stop"' // ignore irrelevant sensor timeouts during microbenchmarks
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "microbench all"'
-2
View File
@@ -74,7 +74,6 @@ Checks: '*,
-modernize-deprecated-headers,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-raw-string-literal,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-bool-literals,
@@ -82,7 +81,6 @@ Checks: '*,
-modernize-use-equals-default,
-modernize-use-equals-delete,
-modernize-use-override,
-modernize-use-trailing-return-type,
-modernize-use-using,
-performance-inefficient-string-concatenation,
-readability-avoid-const-params-in-decls,
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 100M" >> ~/.ccache/ccache.conf
echo "max_size = 40M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
+1 -1
View File
@@ -40,7 +40,7 @@ jobs:
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 100M" >> ~/.ccache/ccache.conf
echo "max_size = 40M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
+2 -5
View File
@@ -13,7 +13,6 @@ jobs:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2021-09-08
strategy:
fail-fast: false
matrix:
config: [
airmind_mindpx-v2,
@@ -82,7 +81,7 @@ jobs:
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 100M" >> ~/.ccache/ccache.conf
echo "max_size = 50M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
@@ -111,6 +110,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: px4_package_${{matrix.config}}
path: |
build/**/*.px4
build/**/*.bin
path: build/**/*.px4
@@ -0,0 +1,64 @@
name: NuttX UAVCAN firmware
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2021-09-08
strategy:
matrix:
config: [
ark_can-flow_default,
ark_can-gps_default,
ark_can-rtk-gps_default,
cuav_can-gps-v1_default,
freefly_can-rtk-gps_default,
holybro_can-gps-v1_default,
nxp_ucans32k146_default
]
steps:
- uses: actions/checkout@v1
with:
token: ${{secrets.ACCESS_TOKEN}}
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{matrix.config}}-ccache-
- name: setup ccache
run: |
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 20M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: make ${{matrix.config}}
run: make ${{matrix.config}}
- name: ccache post-run
run: ccache -s
- name: Upload px4 package
uses: actions/upload-artifact@v2
with:
name: px4_cannode_${{matrix.config}}
path: build/${{matrix.config}}/*.uavcan.bin
-5
View File
@@ -106,11 +106,6 @@ CONFIG:
buildType: MinSizeRel
settings:
CONFIG: ark_can-rtk-gps_default
ark_can-rtk-gps_debug:
short: ark_can-rtk-gps_debug
buildType: MinSizeRel
settings:
CONFIG: ark_can-rtk-gps_debug
ark_can-rtk-gps_canbootloader:
short: ark_can-rtk-gps_canbootloader
buildType: MinSizeRel
+1 -1
View File
@@ -464,7 +464,7 @@ shellcheck_all:
@make px4_fmu-v5_default shellcheck
validate_module_configs:
@find "$(SRC_DIR)"/src/modules "$(SRC_DIR)"/src/drivers "$(SRC_DIR)"/src/lib -name *.yaml -type f -not -path "$(SRC_DIR)/src/lib/mixer_module/*" -print0 | xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml
@find "$(SRC_DIR)"/src/modules "$(SRC_DIR)"/src/drivers "$(SRC_DIR)"/src/lib -name *.yaml -type f -print0 | xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml
# Cleanup
# --------------------------------------------------------------------
@@ -8,8 +8,7 @@
#
. ${R}etc/init.d/rc.mc_defaults
param set-default SYS_CTRL_ALLOC 1
. ${R}etc/init.d/rc.ctrlalloc
param set-default MPC_USE_HTE 0
@@ -46,10 +45,4 @@ param set-default CA_MC_R3_PY 0.1875
param set-default CA_MC_R3_CT 6.5
param set-default CA_MC_R3_KM -0.05
param set-default PWM_MAIN_FUNC1 101
param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
set MIXER skip
set MIXER_AUX none
set MIXER direct
@@ -1,9 +0,0 @@
#!/bin/sh
#
# @name Plane SITL with catapult
#
. ${R}etc/init.d-posix/airframes/1030_plane
param set-default FW_THR_CRUISE 0.0
param set-default RWTO_TKOFF 0
@@ -6,17 +6,7 @@
#
. ${R}etc/init.d/rc.mc_defaults
param set-default SYS_CTRL_ALLOC 1
param set-default MC_PITCHRATE_P 0.0800
param set-default MC_PITCHRATE_I 0.0400
param set-default MC_PITCHRATE_D 0.0010
param set-default MC_PITCH_P 9.0
param set-default MC_ROLLRATE_P 0.0800
param set-default MC_ROLLRATE_I 0.0400
param set-default MC_ROLLRATE_D 0.0010
param set-default MC_ROLL_P 9.0
. ${R}etc/init.d/rc.ctrlalloc
param set-default MPC_XY_VEL_I_ACC 4
param set-default MPC_XY_VEL_P_ACC 3
@@ -76,14 +66,7 @@ param set-default CA_MC_R5_PY -0.5
param set-default CA_MC_R5_CT 9.5
param set-default CA_MC_R5_KM -0.05
param set-default PWM_MAIN_FUNC1 101
param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
param set-default PWM_MAIN_FUNC5 105
param set-default PWM_MAIN_FUNC6 106
set MAV_TYPE 13
set MIXER skip
set MIXER_AUX none
# set MIXER hexa_x
set MIXER direct
@@ -61,7 +61,6 @@ px4_add_romfs_files(
1035_techpod
1036_malolo
1037_believer
1038_glider
1040_standard_vtol
1041_tailsitter
1042_tiltrotor
@@ -77,6 +76,6 @@ px4_add_romfs_files(
2507_cloudship
6011_typhoon_h480
6011_typhoon_h480.post
6012_typhoon_h480_ctrlalloc
6012_typhoon_h480_ctrlalloc.post
6012_typhoon_ctrlalloc
6012_typhoon_ctrlalloc.post
)
@@ -55,4 +55,5 @@ px4_add_romfs_files(
rc.vehicle_setup
rc.vtol_apps
rc.vtol_defaults
rc.ctrlalloc
)
@@ -18,6 +18,7 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT1_N_CELLS 3
param set-default FW_AIRSPD_MAX 20
@@ -39,6 +40,7 @@ param set-default FW_RR_P 0.3
param set-default RWTO_TKOFF 1
param set SYS_HITL 1
# disable some checks to allow to fly
@@ -34,3 +34,5 @@ param set-default MC_PITCHRATE_D 0.0025
param set-default MC_YAWRATE_P 0.28
set MIXER quad_w
set PWM_OUT 1234
@@ -23,6 +23,7 @@
. ${R}etc/init.d/rc.mc_defaults
# TODO tune roll/pitch separately
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_I 0.05
@@ -38,3 +39,5 @@ param set-default BAT1_V_DIV 12.27559
param set-default BAT1_A_PER_V 15.39103
set MIXER quad_w
set PWM_OUT 1234
@@ -25,6 +25,7 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default BAT1_N_CELLS 4
param set-default MC_ROLL_P 7
@@ -37,3 +38,5 @@ param set-default MC_PITCHRATE_I 0.05
param set-default MC_PITCHRATE_D 0.004
param set-default MC_YAW_P 4
set MIXER quad_w
set PWM_OUT 1234
@@ -25,6 +25,7 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default BAT1_N_CELLS 6
param set-default BAT1_V_EMPTY 3.5
@@ -41,3 +42,5 @@ param set-default MPC_XY_VEL_MAX 2
param set-default PWM_MAIN_MIN 1080
set MIXER quad_w
set PWM_OUT 1234
@@ -12,6 +12,7 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set SYS_HITL 1
@@ -9,7 +9,6 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
@@ -19,7 +19,6 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
@@ -14,7 +14,6 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
@@ -22,11 +22,11 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default PWM_MAIN_MAX 2000
param set-default VT_IDLE_PWM_MC 1080
param set-default VT_TYPE 0
set MAV_TYPE 20
set MIXER quad_+_vtol
@@ -19,13 +19,14 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default PWM_AUX_DIS5 950
param set-default MC_ROLL_P 6
param set-default MC_ROLLRATE_P 0.17
param set-default MC_ROLLRATE_I 0.002
@@ -17,7 +17,6 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
@@ -27,6 +26,7 @@ param set-default MC_ROLLRATE_I 0.01
param set-default MC_PITCHRATE_I 0.01
param set-default MC_YAW_P 3.5
param set-default MC_YAWRATE_MAX 50
param set-default MPC_XY_P 0.8
@@ -9,7 +9,6 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
@@ -9,11 +9,11 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default FW_AIRSPD_MAX 22
param set-default FW_AIRSPD_MIN 14
param set-default FW_AIRSPD_TRIM 16
@@ -68,6 +68,7 @@ param set-default PWM_AUX_REV4 1
param set-default PWM_AUX_DIS5 950
param set-default VT_ARSP_TRANS 15
param set-default VT_F_TRANS_THR 0.6
param set-default VT_IDLE_PWM_MC 1180
@@ -13,6 +13,7 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default PWM_AUX_DISARM 1000
param set-default PWM_AUX_MAX 2000
param set-default PWM_AUX_MIN 1000
@@ -22,6 +22,7 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default CBRK_AIRSPD_CHK 162128
param set-default FW_ARSP_MODE 1
@@ -22,6 +22,7 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default BAT1_CAPACITY 23000
param set-default BAT1_N_CELLS 4
param set-default BAT1_R_INTERNAL 0.0025
@@ -18,11 +18,11 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default BAT1_N_CELLS 6
param set-default FW_AIRSPD_MAX 30
@@ -22,11 +22,12 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default VT_IDLE_PWM_MC 1100
param set-default VT_TYPE 1
param set-default VT_MOT_ID 1234
@@ -21,11 +21,11 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default PWM_AUX_DIS5 950
param set-default VT_TYPE 2
@@ -14,11 +14,11 @@
#
# @board px4_fmu-v2 exclude
# @board bitcraze_crazyflie exclude
# @board holybro_kakutef7 exclude
#
. ${R}etc/init.d/rc.vtol_defaults
param set-default VT_ELEV_MC_LOCK 0
param set-default VT_MOT_COUNT 2
param set-default VT_TYPE 0
@@ -19,3 +19,5 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER tri_y_yaw+
set PWM_OUT 1234
@@ -19,3 +19,5 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER tri_y_yaw-
set PWM_OUT 1234
@@ -19,6 +19,7 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER coax
param set-default MC_ROLLRATE_P 0.17
param set-default MC_ROLLRATE_I 0.05
param set-default MC_ROLLRATE_D 0.005
@@ -40,4 +41,5 @@ param set-default RTL_DESCEND_ALT 10
set MIXER_AUX pass
# use PWM parameters for throttle channel
set PWM_AUX_OUT 1234
set PWM_OUT 34
@@ -24,7 +24,8 @@ set MAV_TYPE 4
set MIXER blade130
set PWM_OUT none
#set PWM_OUT 1234
param set-default ATT_BIAS_MAX 0
@@ -15,6 +15,7 @@
. ${R}etc/init.d/rc.balloon_defaults
param set-default COM_PREARM_MODE 2 # always in prearm state
param set-default CBRK_IO_SAFETY 22027
param set-default SDLOG_PROFILE 17
@@ -27,5 +28,6 @@ param set-default SER_TEL2_BAUD 9600
set MAV_TYPE 8
param set MAV_TYPE ${MAV_TYPE}
set MIXER IO_pass
set MIXER_AUX pass
@@ -28,6 +28,7 @@
set VEHICLE_TYPE mc
param set-default NAV_ACC_RAD 2
param set-default PWM_AUX_RATE 400
@@ -18,5 +18,6 @@
param set-default COM_PREARM_MODE 2
param set-default CBRK_IO_SAFETY 22027
set MIXER cloudship
set PWM_OUT 1234
@@ -37,4 +37,5 @@ param set-default FW_PR_FF 0.35
param set-default FW_RR_FF 0.6
param set-default FW_RR_P 0.04
set MIXER fw_generic_wing
@@ -41,6 +41,7 @@ param set-default FW_RR_P 0.04
param set-default PWM_MAIN_DISARM 1000
# Configure this as plane.
set MAV_TYPE 1
@@ -21,6 +21,7 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default FW_AIRSPD_MAX 25
param set-default FW_AIRSPD_MIN 12.5
param set-default FW_AIRSPD_TRIM 16.5
@@ -21,3 +21,7 @@
#
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLL_P 8
param set-default MC_ROLLRATE_P 0.08
param set-default MC_ROLLRATE_I 0.16
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default ATT_BIAS_MAX 0
param set-default CBRK_IO_SAFETY 22027
@@ -11,6 +11,9 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_I 0.05
param set-default MC_PITCH_P 7
@@ -10,6 +10,9 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_I 0.05
param set-default MC_PITCH_P 7
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLLRATE_P 0.18
param set-default MC_PITCHRATE_P 0.18
param set-default MC_ROLLRATE_I 0.15
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default IMU_GYRO_CUTOFF 30
param set-default MC_ROLLRATE_P 0.14
@@ -16,6 +16,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
# System parameters
# use FMU motor outputs for less delay in the rate control loop
param set-default SYS_USE_IO 0
@@ -18,6 +18,9 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default IMU_DGYRO_CUTOFF 20
param set-default MC_ROLLRATE_P 0.18
@@ -11,11 +11,8 @@
#
. ${R}etc/init.d/rc.mc_defaults
. ${R}etc/init.d/rc.ctrlalloc
set MIXER skip
set MIXER_AUX none
param set-default SYS_CTRL_ALLOC 1
param set-default MPC_USE_HTE 0
@@ -52,7 +49,8 @@ param set-default CA_MC_R3_PY 0.177
param set-default CA_MC_R3_CT 6.5
param set-default CA_MC_R3_KM -0.05
param set-default PWM_MAIN_FUNC1 101
param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
set MIXER direct
set PWM_OUT 1234
set MIXER_AUX direct_aux
set PWM_AUX_OUT 1234
@@ -18,6 +18,7 @@
. ${R}etc/init.d/rc.mc_defaults
# tuning
param set-default MC_PITCHRATE_P 0.11
param set-default MC_ROLLRATE_P 0.11
@@ -82,5 +83,7 @@ param set-default RC5_TRIM 1500
param set-default MAV_0_RATE 80000
param set-default MAV_0_MODE 2
param set-default SER_TEL1_BAUD 921600
set MIXER quad_x
set PWM_OUT 1234
set MIXER_AUX none
@@ -13,6 +13,9 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLLRATE_P 0.14
param set-default MC_ROLLRATE_I 0.1
param set-default MC_ROLLRATE_D 0.004
@@ -42,4 +42,8 @@ param set-default RTL_DESCEND_ALT 10
set MIXER quad_h
set PWM_OUT 1234
set MIXER_AUX pass
set PWM_AUX_OUT 1234
@@ -23,6 +23,7 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default CBRK_SUPPLY_CHK 894281
param set-default CBRK_USB_CHK 197848
@@ -56,3 +57,5 @@ param set-default SYS_HAS_MAG 0
param set-default BAT1_N_CELLS 2
# The Whoop uses reversed props
set MIXER quad_h
set PWM_OUT 1234
@@ -12,6 +12,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLL_P 8
param set-default MC_ROLLRATE_P 0.08
param set-default MC_ROLLRATE_I 0.25
@@ -23,9 +23,11 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_s250aq
set MAV_TYPE 2
set PWM_OUT 1234
param set-default ATT_BIAS_MAX 0
param set-default CBRK_IO_SAFETY 22027
@@ -15,6 +15,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
# The set does not include a battery, but most people will probably use 4S
param set-default BAT1_N_CELLS 4
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default BAT1_N_CELLS 4
param set-default GPS_1_CONFIG 0
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default BAT1_N_CELLS 6
param set-default MC_ROLLRATE_P 0.05
@@ -19,6 +19,7 @@
set MIXER none
set MIXER_AUX none
# Battery settings
param set-default BAT_CRIT_THR 0.20
param set-default BAT_LOW_THR 0.25
@@ -28,8 +28,10 @@ set PWM_OUT 1234
# Attitude & rate gains
param set-default MC_ROLLRATE_D 0.0013
param set-default MC_PITCHRATE_D 0.0016
param set-default MC_YAW_FF 0.5
param set-default MPC_MANTHR_MAX 0.9
@@ -22,6 +22,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
# use the Q attitude estimator, it works w/o mag or GPS.
param set-default SYS_MC_EST_GROUP 3
param set-default ATT_ACC_COMP 0
@@ -77,3 +81,4 @@ param set-default IMU_DGYRO_CUTOFF 100
# enable to use high-rate logging for better rate tracking analysis
param set-default SDLOG_PROFILE 27
@@ -17,6 +17,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default BAT1_N_CELLS 1
param set-default MC_ROLL_P 8
@@ -31,3 +31,5 @@
# Set mixer
set MIXER tilt_quad
set MIXER_AUX tilt_quad
set PWM_OUT 1234
@@ -0,0 +1,190 @@
#!/bin/sh
#
# @name Teal One
#
# @type Quadrotor x
# @class Copter
#
# @output MAIN1 motor 1
# @output MAIN2 motor 2
# @output MAIN3 motor 3
# @output MAIN4 motor 4
#
# @maintainer Matt McFadden <matt.mcfadden@tealdrones.com>
#
# @board px4_fmu-v2 exclude
# @board px4_fmu-v3 exclude
# @board px4_fmu-v4pro exclude
# @board px4_fmu-v5 exclude
# @board px4_fmu-v5x exclude
# @board bitcraze_crazyflie exclude
#
echo "Executing 4250_teal script."
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
# First thing, reset all params to default... EXCEPT THIS LIST
param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* CAL_MAG* SENS_BOARD* EKF2_MAGBIAS*
# battery
param set-default BAT_CRIT_THR 0.15
param set-default BAT_EMERGEN_THR 0.075
param set-default BAT_LOW_THR 0.20
param set-default BAT1_CAPACITY 2750
param set-default BAT1_N_CELLS 4
param set-default BAT1_R_INTERNAL 0.06
param set-default BAT1_SOURCE 1
param set-default BAT1_V_CHARGED 4.15
param set-default BAT1_V_DIV 11.1625
param set-default BAT1_V_EMPTY 3.65
param set-default BAT1_V_OFFS_CURR -0.0045
# sensor calibration
param set-default CAL_MAG_SIDES 63
# circuit breakers
param set-default CBRK_IO_SAFETY 22027
param set-default CBRK_USB_CHK 197848
# commander
param set-default COM_DISARM_LAND 0.1
# Return mode at critically low level, Land mode at current position if reaching dangerously low levels.
param set-default COM_LOW_BAT_ACT 3
# ekf2
param set-default EKF2_MAG_TYPE 1
param set-default EKF2_GPS_CHECK 511
param set-default EKF2_GPS_POS_X -0.04
param set-default EKF2_IMU_POS_X -0.06
param set-default EKF2_PCOEF_XN 0.1
param set-default EKF2_PCOEF_XP -0.5
param set-default EKF2_RNG_A_VMAX 20
param set-default EKF2_RNG_NOISE 0.2
param set-default EKF2_MIN_RNG 0.07
# geofence
# Geofence violation action -- Warning.
param set-default GF_ACTION 1
# land detector
param set-default LNDMC_XY_VEL_MAX 1
# This is set high because we have lots of vibrations while in contact with ground.
param set-default LNDMC_ROT_MAX 50
# serial comms
param set-default SER_TEL1_BAUD 921600
param set-default SER_TEL2_BAUD 921600
# mavlink stream configuration
# TEL1 ttyS1 -- disabled. TX1 FTDI UART has issues.
param set-default MAV_0_CONFIG 0
param set-default MAV_0_RATE 800000
# TEL2 ttyS2 -- Primary MAVLINK stream to companion computer.
param set-default MAV_1_CONFIG 102
param set-default MAV_1_RATE 800000
# mc_att_control
param set-default MC_ACRO_P_MAX 360
param set-default MC_ACRO_R_MAX 360
param set-default MC_ACRO_Y_MAX 360
param set-default MC_ROLL_P 6
param set-default MC_ROLLRATE_P 0.055
param set-default MC_ROLLRATE_D 0.0012
param set-default MC_ROLLRATE_MAX 180
param set-default MC_PITCHRATE_P 0.06
param set-default MC_PITCHRATE_D 0.0012
param set-default MC_PITCHRATE_MAX 180
param set-default MC_YAW_P 1
param set-default MC_YAWRATE_P 0.08
param set-default MC_YAWRATE_I 0.08
param set-default MC_YAWRATE_MAX 180
# Set to reduce voltage transients as seen by battery management system.
param set-default MOT_SLEW_MAX 0.15
#### CONTROLLER ###
param set-default MPC_LAND_ALT1 8
param set-default MPC_LAND_ALT2 5
param set-default MPC_TKO_RAMP_T 0.75
param set-default MPC_TKO_SPEED 0.75
param set-default MPC_TILTMAX_LND 18
param set-default MPC_TILTMAX_AIR 45
param set-default MPC_MAN_TILT_MAX 45
param set-default MPC_MANTHR_MAX 0.85
param set-default MPC_MANTHR_MIN 0.15
# Full throttle can trip over current protection on BMS.
param set-default MPC_THR_MAX 0.85
param set-default MPC_THR_MIN 0.15
param set-default MPC_VEL_MANUAL 26.5
# RTL speed, it was too fast and scaring people.
param set-default MPC_XY_CRUISE 15
param set-default MPC_MAN_Y_MAX 200
param set-default MPC_JERK_MAX 5
param set-default MPC_ACC_UP_MAX 10
param set-default MPC_ACC_DOWN_MAX 10
param set-default MPC_ACC_HOR 10
param set-default MPC_ACC_HOR_MAX 15
param set-default MPC_XY_P 1.15
param set-default MPC_XY_VEL_P_ACC 2.8
param set-default MPC_XY_VEL_I_ACC 0.28
param set-default MPC_XY_VEL_D_ACC 0.28
param set-default MPC_XY_VEL_MAX 26.5
param set-default MPC_Z_P 0.85
param set-default MPC_Z_VEL_P_ACC 5
param set-default MPC_Z_VEL_I_ACC 1.7
param set-default MPC_Z_VEL_D_ACC 0.4
# Documentation says limit is 8.0, but does not seem to be enforced in code.
param set-default MPC_Z_VEL_MAX_UP 20
param set-default MPC_Z_VEL_MAX_DN 2.5
#### CONTROLLER ###
# navigator
param set-default NAV_ACC_RAD 2.5
# RC loss failsafe behavior -- hold mode.
param set-default NAV_RCL_ACT 1
# pwm control
param set-default PWM_MAIN_DISARM 900
param set-default PWM_MAIN_MAX 1850
param set-default PWM_MAIN_MIN 1075
# Oneshot125
param set-default PWM_MAIN_RATE 0
# rtl
param set-default RTL_DESCEND_ALT 5
param set-default RTL_LAND_DELAY 5
param set-default RTL_MIN_DIST 7.5
param set-default RTL_RETURN_ALT 25
# calibration
param set-default CAL_ACC0_PRIO 255
param set-default CAL_ACC1_PRIO 0
param set-default CAL_GYRO0_PRIO 255
param set-default CAL_GYRO1_PRIO 0
# Logger mode. Default(1) + estimator replay(2) + thermal calibration(4)
param set-default SDLOG_PROFILE 6
# Do not start frsky_telemetry on port ttyS6 by default, PGA460 lives there. 500 is in arbitrary unused number.
param set TEL_FRSKY_CONFIG 500
# We want to make sure these always start
param set SENS_EN_PGA460 1
param set SENS_EN_THERMAL 1
param set SENS_EN_BATT 1
@@ -13,6 +13,10 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_PITCHRATE_P 0.087
param set-default MC_PITCHRATE_I 0.037
param set-default MC_PITCHRATE_D 0.0044
@@ -17,6 +17,7 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x_cw
set PWM_OUT 1234
param set-default BAT1_N_CELLS 1
param set-default BAT1_CAPACITY 240
@@ -68,3 +69,4 @@ set PWM_MAIN_MIN none
syslink start
mavlink start -d /dev/bridge0 -b 57600 -m osd -r 40000
@@ -17,6 +17,7 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x_cw
set PWM_OUT 1234
param set-default SYS_MC_EST_GROUP 2
param set-default SYS_HAS_MAG 0
@@ -60,6 +61,7 @@ param set-default PWM_MAIN_RATE 3921
param set-default SENS_FLOW_MINRNG 0.05
set PWM_MAIN_DISARM none
set PWM_MAIN_MAX none
set PWM_MAIN_MIN none
@@ -18,6 +18,7 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT1_N_CELLS 4
param set-default EKF2_GBIAS_INIT 0.01
@@ -20,6 +20,7 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT1_N_CELLS 2
param set-default EKF2_GBIAS_INIT 0.01
@@ -26,3 +26,5 @@
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_+
set PWM_OUT 1234
@@ -22,6 +22,7 @@
. ${R}etc/init.d/rc.uuv_defaults
#Set data link loss failsafe mode (0: disabled)
# disable circuit breaker for airspeed sensor
@@ -42,3 +43,4 @@ param set-default BAT_V_OFFS_CURR 0.33
set PWM_OUT 12345678
# set MIXER IO_pass
set MIXER vectored6dof
@@ -26,7 +26,6 @@
#
. ${R}etc/init.d/rc.mc_defaults
set MIXER hexa_x
set PWM_OUT 12345678
@@ -11,8 +11,9 @@
#
. ${R}etc/init.d/rc.mc_defaults
. ${R}etc/init.d/rc.ctrlalloc
param set-default SYS_CTRL_ALLOC 1
param set-default MPC_USE_HTE 0
param set-default VM_MASS 1.5
@@ -66,12 +67,8 @@ param set-default CA_MC_R5_PY -0.1375
param set-default CA_MC_R5_CT 6.5
param set-default CA_MC_R5_KM -0.05
param set-default PWM_MAIN_FUNC1 101
param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
param set-default PWM_MAIN_FUNC5 105
param set-default PWM_MAIN_FUNC6 106
set MIXER direct
set PWM_OUT 123456
set MIXER skip
set MIXER_AUX none
set MIXER_AUX direct_aux
set PWM_AUX_OUT 123456
@@ -88,6 +88,7 @@ px4_add_romfs_files(
4080_zmr250
4090_nanomind
4100_tiltquadrotor
4250_teal
4500_clover4
4900_crazyflie
4901_crazyflie21
@@ -1,12 +0,0 @@
#!/bin/sh
#
# External airframe startup script (on SD card)
#
set SDCARD_MIXERS_PATH ${SDCARD_EXT_PATH}/mixers
if [ -e ${SDCARD_EXT_PATH}/rc.autostart ]
then
. ${SDCARD_EXT_PATH}/rc.autostart
else
echo "Error: ${SDCARD_EXT_PATH}/rc.autostart does not exist"
fi
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
#
# Standard apps for new control allocation and controllers
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#
#
# Start angular velocity controller
#
angular_velocity_controller start
mc_rate_control stop
#
# Start Control Allocator
#
control_allocator start
#
# Disable hover thrust estimator and prearming
# These features are currently incompatible with control allocation
#
# TODO: fix
#
param set MPC_USE_HTE 0
param set COM_PREARM_MODE 0
+5 -11
View File
@@ -96,16 +96,10 @@ then
if [ $OUTPUT_MODE = $OUTPUT_CMD -o $OUTPUT_MODE = io ]
then
if param compare SYS_CTRL_ALLOC 1
if ! $OUTPUT_CMD start
then
pwm_out start
dshot start
else
if ! $OUTPUT_CMD start
then
echo "$OUTPUT_CMD start failed"
tune_control play error
fi
echo "$OUTPUT_CMD start failed"
tune_control play error
fi
fi
fi
@@ -220,10 +214,10 @@ fi
if [ $OUTPUT_MODE = pwm_out -o $OUTPUT_MODE = io ]
then
if [ $PWM_OUT != none -a $PWM_MAIN_RATE != none ]
if [ $PWM_OUT != none ]
then
# Set PWM output frequency.
if ! param compare SYS_CTRL_ALLOC 1
if [ $PWM_MAIN_RATE != none ]
then
pwm rate -c ${PWM_OUT} -r ${PWM_MAIN_RATE}
fi
-16
View File
@@ -48,22 +48,6 @@ fi
# End Estimator Group Selection #
###############################################################################
if param compare SYS_CTRL_ALLOC 1
then
#
# Start Control Allocator
#
control_allocator start
#
# Disable hover thrust estimator and prearming
# These features are currently incompatible with control allocation
#
# TODO: fix
#
param set MPC_USE_HTE 0
fi
#
# Start Multicopter Rate Controller.
#
+1 -5
View File
@@ -15,7 +15,7 @@ param set-default RTL_RETURN_ALT 30
param set-default RTL_DESCEND_ALT 10
param set-default PWM_MAIN_MAX 1950
param set-default PWM_MAIN_MIN1 1075
param set-default PWM_MAIN_MIN 1075
param set-default PWM_MAIN_RATE 400
param set-default GPS_UBX_DYNMODEL 6
@@ -25,8 +25,4 @@ param set-default GPS_UBX_DYNMODEL 6
#
set MIXER_AUX pass
set MIXER quad_x
set PWM_OUT 1234
set PWM_AUX_OUT 1234
+16 -31
View File
@@ -44,8 +44,6 @@ set PWM_EXTRA_OUT none
set PWM_EXTRA_RATE p:PWM_EXTRA_RATE
set EXTRA_MIXER_MODE none
set RC_INPUT_ARGS ""
set SDCARD_AVAILABLE no
set SDCARD_EXT_PATH /fs/microsd/ext_autostart
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
set STARTUP_TUNE 1
set USE_IO no
@@ -59,6 +57,7 @@ ver all
#
# Try to mount the microSD card.
#
set SDCARD_AVAILABLE no
# REBOOTWORK this needs to start after the flight control loop.
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
@@ -98,13 +97,15 @@ if [ $SDCARD_AVAILABLE = yes ]
then
if hardfault_log check
then
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
# Error tune.
set STARTUP_TUNE 2
if hardfault_log commit
then
hardfault_log reset
fi
fi
fi
unset SDCARD_AVAILABLE
#
# Look for an init script on the microSD card.
@@ -181,6 +182,15 @@ else
#
tone_alarm start
#
# Play the startup tune (if not disabled or there is an error)
#
param compare CBRK_BUZZER 782090
if [ $? != 0 -o $STARTUP_TUNE != 1 ]
then
tune_control play -t $STARTUP_TUNE
fi
#
# Waypoint storage.
# REBOOTWORK this needs to start in parallel.
@@ -206,22 +216,10 @@ else
#
# Set parameters and env variables for selected AUTOSTART.
#
set AUTOSTART_PATH etc/init.d/rc.autostart
if ! param compare SYS_AUTOSTART 0
then
if param greater SYS_AUTOSTART 1000000
then
# Use external startup file
if [ $SDCARD_AVAILABLE = yes ]
then
set AUTOSTART_PATH etc/init.d/rc.autostart_ext
else
echo "ERROR [init] SD card not mounted - trying to load airframe from ROMFS"
fi
fi
. ${R}$AUTOSTART_PATH
. ${R}etc/init.d/rc.autostart
fi
unset AUTOSTART_PATH
#
# Override parameters from user configuration file.
@@ -252,7 +250,7 @@ else
then
# Start UAVCAN firmware update server and dynamic node ID allocation server.
uavcan start fw
tune_control play -t 1
if param greater UAVCAN_ENABLE 2
then
set OUTPUT_MODE uavcan_esc
@@ -317,7 +315,7 @@ else
if [ $USE_IO = yes -a $IO_PRESENT = no ]
then
echo "PX4IO not found"
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
tune_control play error
fi
#
@@ -371,17 +369,6 @@ else
commander start
fi
#
# Play the startup tune (if not disabled or there is an error)
#
param compare CBRK_BUZZER 782090
if [ $? != 0 -o $STARTUP_TUNE != 1 ]
then
tune_control play -t $STARTUP_TUNE
fi
# Pre-takeoff continuous magnetometer calibration
if param compare -s MBE_ENABLE 1
then
@@ -552,8 +539,6 @@ unset PWM_OUT
unset PWM_EXTRA_OUT
unset PWM_EXTRA_RATE
unset RC_INPUT_ARGS
unset SDCARD_AVAILABLE
unset SDCARD_EXT_PATH
unset SDCARD_MIXERS_PATH
unset STARTUP_TUNE
unset USE_IO
@@ -44,4 +44,5 @@ px4_add_romfs_files(
tiltrotor_sitl.main.mix
uuv_x_sitl.main.mix
vectored6dof_sitl.main.mix
tiltrotor_sitl_direct.main.mix
)
@@ -0,0 +1,14 @@
Mixer for quad tiltrotor (x motor configuration)
================================================
A: 0
A: 1
A: 2
A: 3
A: 4
A: 5
A: 6
A: 7
A: 8
A: 9
A: 10
@@ -46,6 +46,7 @@ px4_add_romfs_files(
coax.main.mix
delta.main.mix
deltaquad.main.mix
direct.main.mix
dodeca_bottom_cox.aux.mix
dodeca_top_cox.main.mix
firefly6.aux.mix
@@ -0,0 +1,11 @@
# Direct mixer
# @board px4_fmu-v2 exclude
A: 0
A: 1
A: 2
A: 3
A: 4
A: 5
A: 6
A: 7
+5 -3
View File
@@ -8,16 +8,18 @@ if [ -f "$FILE" ]; then
if [ -n "$CHECK_FAILED" ]; then
${DIR}/fix_code_style.sh --quiet < $FILE > $FILE.pretty
echo -e 'Formatting issue found in' $FILE
echo
git --no-pager diff --no-index --minimal --histogram --color=always $FILE $FILE.pretty | grep -vE -e "^.{,4}diff.*\.pretty.{,3}$" -e "^.{,4}--- a/.*$" -e "^.{,4}\+\+\+ b/.*$" -e "^.{,5}@@ .* @@.*$" -e "^.{,4}index .{10}\.\."
git --no-pager diff --no-index --minimal --histogram --color=always $FILE $FILE.pretty
rm -f $FILE.pretty
echo
if [[ $PX4_ASTYLE_FIX -eq 1 ]]; then
${DIR}/fix_code_style.sh $FILE
else
echo 'to fix automatically run "make format" or "./Tools/astyle/fix_code_style.sh' $FILE'"'
# Make sure this file is not staged for comitting
git reset $FILE
# Provide instructions
echo $FILE 'bad formatting, please run "make format" or "./Tools/astyle/fix_code_style.sh' $FILE'"'
exit 1
fi
fi
+7 -1
View File
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
set -eu
PATTERN="-e ."
if [ $# -gt 0 ]; then
PATTERN="$1"
fi
exec find boards msg src platforms test \
-path msg/templates/urtps -prune -o \
-path platforms/nuttx/NuttX -prune -o \
@@ -21,4 +27,4 @@ exec find boards msg src platforms test \
-path src/lib/crypto/monocypher -prune -o \
-path src/lib/crypto/libtomcrypt -prune -o \
-path src/lib/crypto/libtommath -prune -o \
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \)
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN
+9 -6
View File
@@ -54,9 +54,12 @@ if [ $? -ne 0 ]; then
fi
# Check for code style, only in changed files
bash -c "comm -12 <(./Tools/astyle/files_to_check_code_style.sh | sort) <(git diff --cached --name-only --diff-filter=ACM) | xargs -P 8 -I % ./Tools/astyle/check_code_style.sh %"
if [ $? -ne 0 ]
then
echo "Pre-commit style error: Bad formatting according to astyle rules"
exit 1
fi
for i in `git diff --cached --name-only --diff-filter=ACM`
do
./Tools/astyle/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/astyle/check_code_style.sh %
if [ $? -ne 0 ]
then
echo "Pre-commit style error: Bad formatting according to astyle rules"
exit 1
fi
done
+1
View File
@@ -17,3 +17,4 @@ def save_compressed(filename):
f.write(content_file.read())
save_compressed(filename)
-344
View File
@@ -1,344 +0,0 @@
#!/usr/bin/env python3
""" Script to params from module.yaml config file(s)
Note: serial params are handled in Tools/serial/generate_config.py
"""
import argparse
import os
import sys
from output_groups_from_timer_config import get_timer_groups, get_output_groups
try:
import yaml
except ImportError as e:
print("Failed to import yaml: " + str(e))
print("")
print("You may need to install it using:")
print(" pip3 install --user pyyaml")
print("")
sys.exit(1)
parser = argparse.ArgumentParser(description='Generate params from module.yaml file(s)')
parser.add_argument('--config-files', type=str, nargs='*', default=[],
help='YAML module config file(s)')
parser.add_argument('--params-file', type=str, action='store',
help='Parameter output file')
parser.add_argument('--timer-config', type=str, action='store',
help='board-specific timer_config.cpp file')
parser.add_argument('--ethernet', action='store_true',
help='Ethernet support')
parser.add_argument('--board', type=str, action='store',
help='board name, e.g. ')
parser.add_argument('--board-with-io', dest='board_with_io', action='store_true',
help='Indicate that the board as an IO for extra PWM',
default=False)
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
help='Verbose Output')
args = parser.parse_args()
verbose = args.verbose
params_output_file = args.params_file
timer_config_file = args.timer_config
ethernet_supported = args.ethernet
board_with_io = args.board_with_io
board = args.board
root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../..")
output_functions_file = os.path.join(root_dir,"src/lib/mixer_module/output_functions.yaml")
def process_param_prefix(param_prefix):
if param_prefix == '${PWM_MAIN_OR_HIL}':
if board == 'px4_sitl': return 'PWM_MAIN'
return 'HIL_ACT'
if param_prefix == '${PWM_MAIN_OR_AUX}':
if board_with_io: return 'PWM_AUX'
return 'PWM_MAIN'
if '${' in param_prefix:
raise Exception('unhandled variable in {:}'.format(param_prefix))
return param_prefix
def process_channel_label(channel_label):
if channel_label == '${PWM_MAIN_OR_HIL}':
if board == 'px4_sitl': return 'PWM Sim'
return 'HIL actuator'
if channel_label == '${PWM_MAIN_OR_AUX}':
if board_with_io: return 'PWM Aux'
return 'PWM Main'
if '${' in channel_label:
raise Exception('unhandled variable in {:}'.format(channel_label))
return channel_label
def parse_yaml_parameters_config(yaml_config, ethernet_supported):
""" parse the parameters section from the yaml config file """
if 'parameters' not in yaml_config:
return ''
parameters_section_list = yaml_config['parameters']
ret = ''
for parameters_section in parameters_section_list:
if 'definitions' not in parameters_section:
continue
definitions = parameters_section['definitions']
param_group = parameters_section.get('group', None)
for param_name in definitions:
# 'definitions' either contains the param definition directly (dict),
# or a list of definitions with that name (multiple entries for a
# multi-instance param with different instance_start)
param_list = definitions[param_name]
if not isinstance(param_list, list):
param_list = [param_list]
for param in param_list:
if param.get('requires_ethernet', False) and not ethernet_supported:
continue
num_instances = param.get('num_instances', 1)
instance_start = param.get('instance_start', 0) # offset
instance_start_label = param.get('instance_start_label', instance_start)
# get the type and extract all tags
tags = '@group {:}'.format(param_group)
if param['type'] == 'enum':
param_type = 'INT32'
for key in param['values']:
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
elif param['type'] == 'boolean':
param_type = 'INT32'
tags += '\n * @boolean'
elif param['type'] == 'int32':
param_type = 'INT32'
elif param['type'] == 'float':
param_type = 'FLOAT'
else:
raise Exception("unknown param type {:}".format(param['type']))
for tag in ['decimal', 'increment', 'category', 'volatile', 'bit',
'min', 'max', 'unit', 'reboot_required']:
if tag in param:
tags += '\n * @{:} {:}'.format(tag, param[tag])
for i in range(num_instances):
# default value
default_value = 0
if 'default' in param:
# default can be a list of num_instances or a single value
if type(param['default']) == list:
assert len(param['default']) == num_instances
default_value = param['default'][i]
else:
default_value = param['default']
if type(default_value) == bool:
default_value = int(default_value)
# output the existing C-style format
ret += '''
/**
* {short_descr}
*
* {long_descr}
*
* {tags}
*/
PARAM_DEFINE_{param_type}({name}, {default_value});
'''.format(short_descr=param['description']['short'].replace("\n", "\n * "),
long_descr=param['description']['long'].replace("\n", "\n * "),
tags=tags,
param_type=param_type,
name=param_name.replace('${i}', str(i+instance_start)),
default_value=default_value,
).replace('${i}', str(i+instance_start_label))
return ret
def get_actuator_output_params(yaml_config, output_functions,
timer_config_file, verbose):
""" parse the actuator_output section from the yaml config file
:return: dict of param definitions
"""
if not 'actuator_output' in yaml_config:
return {}
output_groups = yaml_config['actuator_output']['output_groups']
all_params = {}
group_idx = 0
def add_local_param(param_name, param_def):
nonlocal all_params
# add as a list, as there can be multiple entries with the same param_name
if not param_name in all_params:
all_params[param_name] = []
all_params[param_name].append(param_def)
while group_idx < len(output_groups):
group = output_groups[group_idx]
group_idx += 1
if verbose: print("processing group: {:}".format(group))
# Check for generator and generate additional data.
# We do this by extending the output_groups list and parse in a later iteration
if 'generator' in group:
if group['generator'] == 'pwm':
param_prefix = process_param_prefix(group['param_prefix'])
channel_labels = [process_channel_label(label) for label in group['channel_labels']]
standard_params = group.get('standard_params', [])
extra_function_groups = group.get('extra_function_groups', [])
pwm_timer_param = group.get('pwm_timer_param', None)
if 'timer_config_file' in group:
timer_config_file = os.path.join(root_dir, group['timer_config_file'])
if timer_config_file is None:
raise Exception('trying to generate pwm outputs, but --timer-config not set')
timer_groups = get_timer_groups(timer_config_file, verbose)
timer_output_groups, timer_params = get_output_groups(timer_groups,
param_prefix, channel_labels,
standard_params, extra_function_groups, pwm_timer_param,
verbose=verbose)
all_params.update(timer_params)
output_groups.extend(timer_output_groups)
else:
raise Exception('unknown generator {:}'.format(group['generator']))
continue
num_channels = group['num_channels']
param_prefix = process_param_prefix(group['param_prefix'])
channel_label = process_channel_label(group['channel_label'])
standard_params = group.get('standard_params', {})
instance_start = group.get('instance_start', 1)
instance_start_label = group.get('instance_start_label', instance_start)
if len(param_prefix) > 9: # 16 - len('_FAIL') - 2 (2 digits for index)
raise Exception("param prefix {:} too long (max length=10)".format(param_prefix))
# collect the functions
function_groups = ['common']
function_groups.extend(group.get('extra_function_groups', []))
output_function_values = {}
for function_group in function_groups:
group = output_functions[function_group]
for function_name in group:
function_name_label = function_name.replace('_', ' ')
if isinstance(group[function_name], int):
output_function_values[group[function_name]] = function_name_label
else:
start = group[function_name]['start']
count = group[function_name]['count']
for i in range(count):
output_function_values[start+i] = function_name_label+' '+str(i+1)
# function param
param = {
'description': {
'short': channel_label+' ${i} Output Function',
'long':
'''Select what should be output on {:} ${{i}}.
The default failsafe value is set according to the selected function:
- 'Min' for ConstantMin
- 'Max' for ConstantMax
- 'Max' for Parachute
- ('Max'+'Min')/2 for Servos
- 'Disarmed' for the rest
'''.format(channel_label),
},
'type': 'enum',
'instance_start': instance_start,
'instance_start_label': instance_start_label,
'num_instances': num_channels,
'default': 0,
'values': output_function_values
}
add_local_param(param_prefix+'_FUNC${i}', param)
# handle standard_params
disarmed_description = \
'''This is the output value that is set when not armed.
Note that non-motor outputs might already be active in prearm state if COM_PREARM_MODE is set.
'''
minimum_description = \
'''Minimum output value (when not disarmed).
The output range can be reversed by setting Min > Max.
'''
maximum_description = \
'''Maxmimum output value (when not disarmed).
The output range can be reversed by setting Min > Max.
'''
failsafe_description = \
'''This is the output value that is set when in failsafe mode.
When set to -1 (default), the value depends on the function (see {:}).
'''.format(param_prefix+'_FUNC${i}')
standard_params_array = [
( 'disarmed', 'Disarmed', 'DIS', disarmed_description ),
( 'min', 'Minimum', 'MIN', minimum_description ),
( 'max', 'Maximum', 'MAX', maximum_description ),
( 'failsafe', 'Failsafe', 'FAIL', failsafe_description ),
]
for key, label, param_suffix, description in standard_params_array:
if key in standard_params:
# values must be in range of an uint16_t
if standard_params[key]['min'] < 0:
raise Exception('minimum value for {:} expected >= 0 (got {:})'.format(key, standard_params[key]['min']))
if standard_params[key]['max'] >= 1<<16:
raise Exception('maximum value for {:} expected <= {:} (got {:})'.format(key, 1<<16, standard_params[key]['max']))
if key == 'failsafe':
standard_params[key]['default'] = -1
standard_params[key]['min'] = -1
param = {
'description': {
'short': channel_label+' ${i} '+label+' Value',
'long': description
},
'type': 'int32',
'instance_start': instance_start,
'instance_start_label': instance_start_label,
'num_instances': num_channels,
'min': standard_params[key]['min'],
'max': standard_params[key]['max'],
'default': standard_params[key]['default'],
}
add_local_param(param_prefix+'_'+param_suffix+'${i}', param)
if verbose: print('adding actuator params: {:}'.format(all_params))
return all_params
def load_yaml_file(file_name):
with open(file_name, 'r') as stream:
try:
return yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)
raise
output_functions_yaml = load_yaml_file(output_functions_file)
output_functions = output_functions_yaml['functions']
all_params = ""
for yaml_file in args.config_files:
yaml_config = load_yaml_file(yaml_file)
# convert 'output_groups' section into additional params
try:
actuator_output_params = get_actuator_output_params(yaml_config,
output_functions, timer_config_file, verbose)
except Exception as e:
print('Exception while parsing {:}:'.format(yaml_file))
raise e
# now add them to the yaml config
if not 'parameters' in yaml_config:
yaml_config['parameters'] = []
group_name = 'Actuator Outputs'
yaml_config['parameters'].append({'group': group_name, 'definitions': actuator_output_params})
all_params += parse_yaml_parameters_config(yaml_config, ethernet_supported)
if verbose: print("Generating {:}".format(params_output_file))
with open(params_output_file, 'w') as fid:
fid.write(all_params)
@@ -1,201 +0,0 @@
#!/usr/bin/env python3
""" Script to parse board-specific timer_config.cpp and print the output groups
and timer config params to stdout
"""
import argparse
import os
import sys
import re
from itertools import groupby
from copy import deepcopy
def find_matching_brackets(brackets, s, verbose):
idx = 0
opening = 0
first_open = -1
while idx < len(s):
if s[idx] == brackets[0]:
opening += 1
if first_open == -1:
first_open = idx
if s[idx] == brackets[1]:
opening -= 1
if opening == 0:
if verbose: print(first_open, idx, s[first_open:idx+1])
return first_open+1, idx
idx += 1
raise Exception('Failed to find opening/closing brackets in {:}'.format(s))
def extract_timer(line):
# Try format: initIOTimer(Timer::Timer5, DMA{DMA::Index1, DMA::Stream0, DMA::Channel6}),
search = re.search('Timer::([0-9a-zA-Z_]+)[,\)]', line, re.IGNORECASE)
if search:
return search.group(1)
# nxp rt1062 format: initIOPWM(PWM::FlexPWM2),
search = re.search('PWM::Flex([0-9a-zA-Z_]+)[,\)]', line, re.IGNORECASE)
if search:
return search.group(1)
return None
def extract_timer_from_channel(line):
# Try format: initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortA, GPIO::Pin0}),
search = re.search('Timer::([0-9a-zA-Z_]+), ', line, re.IGNORECASE)
if search:
return search.group(1)
# nxp rt1062 format: initIOTimerChannel(io_timers, {PWM::PWM2_PWM_A, PWM::Submodule0}, IOMUX::Pad::GPIO_B0_06),
search = re.search('PWM::(PWM[0-9]+)[_,\)]', line, re.IGNORECASE)
if search:
return search.group(1)
return None
def get_timer_groups(timer_config_file, verbose=False):
with open(timer_config_file, 'r') as f:
timer_config = f.read()
# timers
dshot_support = {} # key: timer
timers_start_marker = 'io_timers_t io_timers'
timers_start = timer_config.find(timers_start_marker)
if timers_start == -1:
raise Exception('"{:}" not found in {:}'.format(timers_start_marker, timer_config_file))
timer_config = timer_config[timers_start:]
open_idx, close_idx = find_matching_brackets(('{', '}'), timer_config, verbose)
timers_str = timer_config[open_idx:close_idx]
timers = []
for line in timers_str.splitlines():
line = line.strip()
if len(line) == 0 or line.startswith('//'):
continue
timer = extract_timer(line)
if timer:
if verbose: print('found timer def: {:}'.format(timer))
dshot_support[timer] = 'DMA' in line
timers.append(timer)
else:
# Make sure we don't miss anything (e.g. for different syntax) or misparse (e.g. multi-line comments)
raise Exception('Unparsed timer in line: {:}'.format(line))
# channels
channels_start_marker = 'timer_io_channels_t timer_io_channels'
channels_start = timer_config.find(channels_start_marker)
if channels_start == -1:
raise Exception('"{:}" not found in {:}'.format(channels_start_marker, timer_config_file))
timer_config = timer_config[channels_start:]
open_idx, close_idx = find_matching_brackets(('{', '}'), timer_config, verbose)
channels = timer_config[open_idx:close_idx]
channel_timers = []
channel_types = []
for line in channels.splitlines():
line = line.strip()
if len(line) == 0 or line.startswith('//'):
continue
if verbose: print('--'+line+'--')
timer = extract_timer_from_channel(line)
if timer:
if verbose: print('Found timer: {:} in channel line {:}'.format(timer, line))
channel_types.append('cap' if 'capture' in line.lower() else 'pwm')
channel_timers.append(timer)
else:
# Make sure we don't miss anything (e.g. for different syntax) or misparse (e.g. multi-line comments)
raise Exception('Unparsed channel in line: {:}'.format(line))
if len(channel_timers) == 0:
raise Exception('No channels found in "{:}"'.format(channels))
groups = [(timers.index(k), len(list(g)), dshot_support[k]) for k, g in groupby(channel_timers)]
outputs = {
'types': channel_types,
'groups': groups
}
return outputs
def get_output_groups(timer_groups, param_prefix="PWM_MAIN",
channel_labels=["PWM Main", "PWM Capture"],
standard_params=[],
extra_function_groups=[], pwm_timer_param=None,
verbose=False):
""" convert the timer groups into an output_groups section of module.yaml
and extra timer params
"""
instance_start = 1
output_groups = []
timer_params = {}
instance_start_label = [ 1, 1 ]
for timer_index, group_count, dshot_support in timer_groups['groups']:
# check for capture vs normal pins for the label
types = timer_groups['types'][instance_start-1:instance_start+group_count-1]
if not all(types[0] == t for t in types):
# Should this ever be needed, we can extend this script to handle that
raise Exception('Implementation requires all channel types for a timer to be equal (types: {:})'.format(types))
if types[0] == 'pwm':
channel_type_idx = 0
elif types[0] == 'cap':
channel_type_idx = 1
else:
raise Exception('unsupported channel type: {:}'.format(types[0]))
channel_label = channel_labels[channel_type_idx]
channel_type_instance = instance_start_label[channel_type_idx]
group = {
'param_prefix': param_prefix,
'channel_label': channel_label,
'instance_start': instance_start,
'instance_start_label': channel_type_instance,
'extra_function_groups': deepcopy(extra_function_groups),
'num_channels': group_count,
'standard_params': deepcopy(standard_params),
}
output_groups.append(group)
if pwm_timer_param is not None:
timer_channels_label = channel_label + ' ' + str(channel_type_instance)
if group_count > 1:
timer_channels_label += '-' + str(channel_type_instance+group_count-1)
pwm_timer_param_cp = deepcopy(pwm_timer_param)
if not dshot_support:
# remove dshot entries if no dshot support
values = pwm_timer_param_cp['values']
for key in list(values.keys()):
if 'dshot' in values[key].lower():
del values[key]
for descr_type in ['short', 'long']:
descr = pwm_timer_param_cp['description'][descr_type]
pwm_timer_param_cp['description'][descr_type] = \
descr.replace('${label}', timer_channels_label)
timer_params[param_prefix+'_TIM'+str(timer_index)] = pwm_timer_param_cp
instance_start += group_count
instance_start_label[channel_type_idx] += group_count
return (output_groups, timer_params)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Extract output groups from timer_config.cpp')
parser.add_argument('--timer-config', type=str, action='store',
help='timer_config.cpp file', required=True)
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
help='Verbose Output')
args = parser.parse_args()
verbose = args.verbose
timer_groups = get_timer_groups(args.timer_config, verbose)
print('timer groups: {:}'.format(timer_groups))
output_groups, timer_params = get_output_groups(timer_groups, verbose=verbose)
print('output groups: {:}'.format(output_groups))
print('timer params: {:}'.format(timer_params))
+1 -1
View File
@@ -25,7 +25,7 @@ div.frame_common table, div.frame_common table {
}
div.frame_common table {
float: right;
float: right;
width: 70%;
}
+1
View File
@@ -55,3 +55,4 @@ class JsonOutput():
if need_to_write:
with codecs.open(filename, 'w', 'utf-8') as f:
f.write(json.dumps(self.json,indent=2))
+81 -1
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
""" Script to generate Serial (UART) parameters and the ROMFS startup script """
from __future__ import print_function
import argparse
import os
import sys
@@ -193,6 +195,7 @@ if rc_serial_output_dir is None and serial_params_output_file is None:
# parse the YAML files
serial_commands = []
ethernet_configuration = []
additional_params = ""
if ethernet_supported:
ethernet_configuration.append({
@@ -213,12 +216,88 @@ def parse_yaml_serial_config(yaml_config):
ret.append(serial_config)
return ret
def parse_yaml_parameters_config(yaml_config, ethernet_supported):
""" parse the parameters section from the yaml config file """
if 'parameters' not in yaml_config:
return ''
parameters_section_list = yaml_config['parameters']
for parameters_section in parameters_section_list:
if 'definitions' not in parameters_section:
return ''
definitions = parameters_section['definitions']
ret = ''
param_group = parameters_section.get('group', None)
for param_name in definitions:
param = definitions[param_name]
if param.get('requires_ethernet', False) and not ethernet_supported:
continue
num_instances = param.get('num_instances', 1)
instance_start = param.get('instance_start', 0) # offset
# get the type and extract all tags
tags = '@group {:}'.format(param_group)
if param['type'] == 'enum':
param_type = 'INT32'
for key in param['values']:
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
elif param['type'] == 'boolean':
param_type = 'INT32'
tags += '\n * @boolean'
elif param['type'] == 'int32':
param_type = 'INT32'
elif param['type'] == 'float':
param_type = 'FLOAT'
else:
raise Exception("unknown param type {:}".format(param['type']))
for tag in ['decimal', 'increment', 'category', 'volatile', 'bit',
'min', 'max', 'unit', 'reboot_required']:
if tag in param:
tags += '\n * @{:} {:}'.format(tag, param[tag])
for i in range(num_instances):
# default value
default_value = 0
if 'default' in param:
# default can be a list of num_instances or a single value
if type(param['default']) == list:
assert len(param['default']) == num_instances
default_value = param['default'][i]
else:
default_value = param['default']
if type(default_value) == bool:
default_value = int(default_value)
# output the existing C-style format
ret += '''
/**
* {short_descr}
*
* {long_descr}
*
* {tags}
*/
PARAM_DEFINE_{param_type}({name}, {default_value});
'''.format(short_descr=param['description']['short'].replace("\n", "\n * "),
long_descr=param['description']['long'].replace("\n", "\n * "),
tags=tags,
param_type=param_type,
name=param_name,
default_value=default_value,
).replace('${i}', str(i+instance_start))
return ret
for yaml_file in args.config_files:
with open(yaml_file, 'r') as stream:
try:
yaml_config = yaml.load(stream, Loader=yaml.Loader)
serial_commands.extend(parse_yaml_serial_config(yaml_config))
# TODO: additional params should be parsed in a separate script
additional_params += parse_yaml_parameters_config(
yaml_config, ethernet_supported)
except yaml.YAMLError as exc:
print(exc)
raise
@@ -325,5 +404,6 @@ if serial_params_output_file is not None:
with open(serial_params_output_file, 'w') as fid:
fid.write(template.render(serial_devices=serial_devices,
ethernet_configuration=ethernet_configuration,
commands=commands, serial_ports=serial_ports))
commands=commands, serial_ports=serial_ports,
additional_definitions=additional_params))

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