aboutsummaryrefslogtreecommitdiff
path: root/ROMFS/px4fmu_common/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'ROMFS/px4fmu_common/init.d')
-rw-r--r--ROMFS/px4fmu_common/init.d/02_io_quad_x22
-rw-r--r--ROMFS/px4fmu_common/init.d/10_io_f33037
-rw-r--r--ROMFS/px4fmu_common/init.d/40_io_segway122
-rw-r--r--ROMFS/px4fmu_common/init.d/rc.sensors4
-rw-r--r--ROMFS/px4fmu_common/init.d/rc.usb49
-rwxr-xr-xROMFS/px4fmu_common/init.d/rcS23
6 files changed, 184 insertions, 73 deletions
diff --git a/ROMFS/px4fmu_common/init.d/02_io_quad_x b/ROMFS/px4fmu_common/init.d/02_io_quad_x
index 131abf8c4..c63e92f6d 100644
--- a/ROMFS/px4fmu_common/init.d/02_io_quad_x
+++ b/ROMFS/px4fmu_common/init.d/02_io_quad_x
@@ -40,28 +40,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)
#
mavlink start -d /dev/ttyS1 -b 57600
diff --git a/ROMFS/px4fmu_common/init.d/10_io_f330 b/ROMFS/px4fmu_common/init.d/10_io_f330
index 4107fab4f..4450eb50d 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
@@ -41,28 +40,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)
#
mavlink start
@@ -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/40_io_segway b/ROMFS/px4fmu_common/init.d/40_io_segway
new file mode 100644
index 000000000..5742d685a
--- /dev/null
+++ b/ROMFS/px4fmu_common/init.d/40_io_segway
@@ -0,0 +1,122 @@
+#!nsh
+#
+# Flight startup script for PX4FMU+PX4IO
+#
+
+# disable USB and autostart
+set USB no
+set MODE custom
+
+#
+# Start the ORB (first app to start)
+#
+uorb start
+
+#
+# Load microSD params
+#
+echo "[init] loading microSD params"
+param select /fs/microsd/params
+if [ -f /fs/microsd/params ]
+then
+ param load /fs/microsd/params
+fi
+
+#
+# Load default params for this platform
+#
+if param compare SYS_AUTOCONFIG 1
+then
+ # Set all params here, then disable autoconfig
+ param set SYS_AUTOCONFIG 0
+ param save /fs/microsd/params
+fi
+
+#
+# Force some key parameters to sane values
+# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor
+# see https://pixhawk.ethz.ch/mavlink/
+#
+param set MAV_TYPE 10
+
+#
+# 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)
+#
+mavlink start -d /dev/ttyS1 -b 57600
+usleep 5000
+
+#
+# Start the commander (depends on orb, mavlink)
+#
+commander start
+
+#
+# Start PX4IO interface (depends on orb, commander)
+#
+px4io start
+
+#
+# Allow PX4IO to recover from midair restarts.
+# this is very unlikely, but quite safe and robust.
+px4io recovery
+
+#
+# Disable px4io topic limiting
+#
+px4io limit 200
+
+#
+# Start the sensors (depends on orb, px4io)
+#
+sh /etc/init.d/rc.sensors
+
+#
+# Start GPS interface (depends on orb)
+#
+gps start
+
+#
+# Start the attitude estimator (depends on orb)
+#
+attitude_estimator_ekf start
+
+#
+# Load mixer and start controllers (depends on px4io)
+#
+md25 start 3 0x58
+segway start
+
+#
+# Start logging
+#
+sdlog2 start -r 50 -a -b 14
+
+#
+# Start system state
+#
+if blinkm start
+then
+ blinkm systemstate
+fi
diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors
index 73f40c503..5e80ddc2f 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/rc.usb b/ROMFS/px4fmu_common/init.d/rc.usb
index c89932bb5..5b1bd272e 100644
--- a/ROMFS/px4fmu_common/init.d/rc.usb
+++ b/ROMFS/px4fmu_common/init.d/rc.usb
@@ -13,35 +13,46 @@ 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 px4io if present
+if px4io start
+then
+ echo "PX4IO driver started"
+else
+ if fmu mode_serial
+ then
+ echo "FMU driver started"
+ fi
+fi
- # 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.."
diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS
index b22591f3c..f0ee1a0c6 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