From 5d356ec3d841602cbe7668028d01e670c3411d4e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 2 Aug 2013 13:51:46 +0200 Subject: [PATCH 1/4] Fixed USB startup --- ROMFS/px4fmu_common/init.d/rc.usb | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.usb b/ROMFS/px4fmu_common/init.d/rc.usb index c89932bb5d..7e28f3d81d 100644 --- a/ROMFS/px4fmu_common/init.d/rc.usb +++ b/ROMFS/px4fmu_common/init.d/rc.usb @@ -13,35 +13,35 @@ if mavlink stop then echo "stopped other MAVLink instance" fi +sleep 2 mavlink start -b 230400 -d /dev/ttyACM0 -if [ $MODE == autostart ] +# Start the commander +if commander start then + echo "Commander started" +fi - # Start the commander - commander start +# Start sensors +sh /etc/init.d/rc.sensors - # Start sensors - sh /etc/init.d/rc.sensors - - # Start one of the estimators - if attitude_estimator_ekf status +# Start one of the estimators +if attitude_estimator_ekf status +then + echo "multicopter att filter running" +else + if att_pos_estimator_ekf status then - echo "multicopter att filter running" + echo "fixedwing att filter running" else - if att_pos_estimator_ekf status - then - echo "fixedwing att filter running" - else - attitude_estimator_ekf start - fi + attitude_estimator_ekf start fi +fi - # Start GPS - if gps start - then - echo "GPS started" - fi +# Start GPS +if gps start +then + echo "GPS started" fi echo "MAVLink started, exiting shell.." From 9220f33ce06920e81a93c841e1d5fc4acffe3fed Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 2 Aug 2013 15:37:11 +0200 Subject: [PATCH 2/4] More USB startup fixing --- ROMFS/px4fmu_common/init.d/rc.usb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ROMFS/px4fmu_common/init.d/rc.usb b/ROMFS/px4fmu_common/init.d/rc.usb index 7e28f3d81d..2807c2bee7 100644 --- a/ROMFS/px4fmu_common/init.d/rc.usb +++ b/ROMFS/px4fmu_common/init.d/rc.usb @@ -22,6 +22,12 @@ then echo "Commander started" fi +# Start px4io if present +if px4io start +then + echo "PX4IO driver started" +fi + # Start sensors sh /etc/init.d/rc.sensors From 241244ab960e62f32e01b92f86450586b26ee386 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 2 Aug 2013 15:38:17 +0200 Subject: [PATCH 3/4] Hotfix: Added missing drivers to USB startup --- ROMFS/px4fmu_common/init.d/rc.usb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ROMFS/px4fmu_common/init.d/rc.usb b/ROMFS/px4fmu_common/init.d/rc.usb index 2807c2bee7..5b1bd272e9 100644 --- a/ROMFS/px4fmu_common/init.d/rc.usb +++ b/ROMFS/px4fmu_common/init.d/rc.usb @@ -26,6 +26,11 @@ fi if px4io start then echo "PX4IO driver started" +else + if fmu mode_serial + then + echo "FMU driver started" + fi fi # Start sensors From 24c43ad62d03fdfc0a13b5e6fae22c29bbc827c3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 2 Aug 2013 15:47:04 +0200 Subject: [PATCH 4/4] Hotfix: ROMFS autostart includes now IO upgrade --- ROMFS/px4fmu_common/init.d/02_io_quad_x | 22 --------------- ROMFS/px4fmu_common/init.d/10_io_f330 | 37 +++++-------------------- ROMFS/px4fmu_common/init.d/rc.sensors | 4 +-- ROMFS/px4fmu_common/init.d/rcS | 23 +++++++++++++++ 4 files changed, 32 insertions(+), 54 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/02_io_quad_x b/ROMFS/px4fmu_common/init.d/02_io_quad_x index 131abf8c4e..c63e92f6d3 100644 --- a/ROMFS/px4fmu_common/init.d/02_io_quad_x +++ b/ROMFS/px4fmu_common/init.d/02_io_quad_x @@ -39,28 +39,6 @@ fi # param set MAV_TYPE 2 -# -# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell) -# -if [ -f /fs/microsd/px4io.bin ] -then - echo "PX4IO Firmware found. Checking Upgrade.." - if cmp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current - then - echo "No newer version, skipping upgrade." - else - echo "Loading /fs/microsd/px4io.bin" - if px4io update /fs/microsd/px4io.bin > /fs/microsd/px4io_update.log - then - cp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current - echo "Flashed /fs/microsd/px4io.bin OK" >> /fs/microsd/px4io_update.log - else - echo "Failed flashing /fs/microsd/px4io.bin" >> /fs/microsd/px4io_update.log - echo "Failed to upgrade PX4IO firmware - check if PX4IO is in bootloader mode" - fi - fi -fi - # # Start MAVLink (depends on orb) # diff --git a/ROMFS/px4fmu_common/init.d/10_io_f330 b/ROMFS/px4fmu_common/init.d/10_io_f330 index 4107fab4fa..4450eb50db 100644 --- a/ROMFS/px4fmu_common/init.d/10_io_f330 +++ b/ROMFS/px4fmu_common/init.d/10_io_f330 @@ -15,20 +15,19 @@ then # Set all params here, then disable autoconfig param set SYS_AUTOCONFIG 0 - param set MC_ATTRATE_D 0.007 + param set MC_ATTRATE_D 0.005 param set MC_ATTRATE_I 0.0 - param set MC_ATTRATE_P 0.13 + param set MC_ATTRATE_P 0.1 param set MC_ATT_D 0.0 param set MC_ATT_I 0.0 - param set MC_ATT_P 7.0 - param set MC_POS_P 0.1 + param set MC_ATT_P 4.5 param set MC_RCLOSS_THR 0.0 param set MC_YAWPOS_D 0.0 - param set MC_YAWPOS_I 0.5 - param set MC_YAWPOS_P 1.0 + param set MC_YAWPOS_I 0.3 + param set MC_YAWPOS_P 0.6 param set MC_YAWRATE_D 0.0 param set MC_YAWRATE_I 0.0 - param set MC_YAWRATE_P 0.2 + param set MC_YAWRATE_P 0.1 param save /fs/microsd/params fi @@ -40,28 +39,6 @@ fi # param set MAV_TYPE 2 -# -# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell) -# -if [ -f /fs/microsd/px4io2.bin ] -then - echo "PX4IO Firmware found. Checking Upgrade.." - if cmp /fs/microsd/px4io2.bin /fs/microsd/px4io2.cur - then - echo "No newer version, skipping upgrade." - else - echo "Loading /fs/microsd/px4io2.bin" - if px4io update /fs/microsd/px4io2.bin > /fs/microsd/px4io2.log - then - cp /fs/microsd/px4io2.bin /fs/microsd/px4io2.cur - echo "Flashed /fs/microsd/px4io2.bin OK" >> /fs/microsd/px4io2.log - else - echo "Failed flashing /fs/microsd/px4io2.bin" >> /fs/microsd/px4io2.log - echo "Failed to upgrade PX4IO2 firmware - check if PX4IO2 is in bootloader mode" - fi - fi -fi - # # Start MAVLink (depends on orb) # @@ -128,7 +105,7 @@ multirotor_att_control start # # Start logging # -sdlog2 start -r 20 -a -b 14 +sdlog2 start -r 20 -a -b 16 # # Start system state diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 73f40c5039..5e80ddc2f4 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -25,7 +25,7 @@ then else echo "using L3GD20 and LSM303D" l3gd20 start - lsm303 start + lsm303d start fi # @@ -40,4 +40,4 @@ then # Check sensors - run AFTER 'sensors start' # preflight_check & -fi \ No newline at end of file +fi diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index b22591f3c3..f0ee1a0c6e 100755 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -81,6 +81,26 @@ else fi fi +# +# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell) +# +if [ -f /fs/microsd/px4io.bin ] +then + echo "PX4IO Firmware found. Checking Upgrade.." + if cmp /fs/microsd/px4io.bin /fs/microsd/px4io.cur + then + echo "No newer version, skipping upgrade." + else + echo "Loading /fs/microsd/px4io.bin" + if px4io update /fs/microsd/px4io.bin > /fs/microsd/px4io.log + then + cp /fs/microsd/px4io.bin /fs/microsd/px4io.cur + echo "Flashed /fs/microsd/px4io.bin OK" >> /fs/microsd/px4io.log + else + echo "Failed flashing /fs/microsd/px4io.bin" >> /fs/microsd/px4io.log + echo "Failed to upgrade px4io firmware - check if px4io is in bootloader mode" + fi + fi fi # @@ -121,3 +141,6 @@ if param compare SYS_AUTOSTART 31 then sh /etc/init.d/31_io_phantom fi + +# End of autostart +fi