Commit b5d56523 authored by Anton Babushkin's avatar Anton Babushkin
Browse files

Init scripts cleanup, WIP

parent 891cb3f8
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] Team Blacksheep Discovery Quad"
#
# Load default params for this platform
#
if param compare SYS_AUTOCONFIG 1
if [ $DO_AUTOCONFIG == yes ]
then
# Set all params here, then disable autoconfig
param set SYS_AUTOCONFIG 0
param set MC_ATTRATE_D 0.006
param set MC_ATTRATE_I 0.0
param set MC_ATTRATE_P 0.17
param set MC_ATT_D 0.0
param set MC_ATT_I 0.0
#
# Default parameters for this platform
#
param set MC_ATT_P 5.0
param set MC_YAWPOS_D 0.0
param set MC_YAWPOS_I 0.15
param set MC_ATT_I 0.0
param set MC_ATT_D 0.0
param set MC_ATTRATE_P 0.17
param set MC_ATTRATE_I 0.0
param set MC_ATTRATE_D 0.006
param set MC_YAWPOS_P 0.5
param set MC_YAWRATE_D 0.0
param set MC_YAWRATE_I 0.0
param set MC_YAWPOS_I 0.15
param set MC_YAWPOS_D 0.0
param set MC_YAWRATE_P 0.2
param save
fi
#
# Force some key parameters to sane values
# MAV_TYPE 2 = quadrotor
#
param set MAV_TYPE 2
#
# Start and configure PX4IO or FMU interface
#
if px4io detect
then
# Start MAVLink (depends on orb)
mavlink start
usleep 5000
sh /etc/init.d/rc.io
else
# Start MAVLink (on UART1 / ttyS0)
mavlink start -d /dev/ttyS0
usleep 5000
fmu mode_pwm
param set BAT_V_SCALING 0.004593
set EXIT_ON_END yes
param set MC_YAWRATE_I 0.0
param set MC_YAWRATE_D 0.0
fi
#
# Load the mixer for a quad with wide arms
#
mixer load /dev/pwm_output /etc/mixers/FMU_quad_w.mix
#
# Set PWM output frequency
#
pwm rate -c 1234 -r 400
#
# Set disarmed, min and max PWM signals
#
pwm disarmed -c 1234 -p 900
pwm min -c 1234 -p 1100
pwm max -c 1234 -p 1900
#
# Start common for all multirotors apps
#
sh /etc/init.d/rc.multirotor
set FRAME_TYPE mc
set FRAME_GEOMETRY quad_w
set PWM_RATE 400
set PWM_DISARMED 900
set PWM_MIN 1100
set PWM_MAX 1900
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] 3DR Iris Quad"
#
# 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
# Use generic wide arm quad X PWM as base
sh /etc/init.d/10001_quad_w
param set MC_ATTRATE_D 0.004
param set MC_ATTRATE_I 0.0
param set MC_ATTRATE_P 0.13
param set MC_ATT_D 0.0
param set MC_ATT_I 0.0
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
param set MC_ATT_P 9.0
param set MC_YAWPOS_D 0.0
param set MC_YAWPOS_I 0.15
param set MC_ATT_I 0.0
param set MC_ATT_D 0.0
param set MC_ATTRATE_P 0.13
param set MC_ATTRATE_I 0.0
param set MC_ATTRATE_D 0.004
param set MC_YAWPOS_P 0.5
param set MC_YAWRATE_D 0.0
param set MC_YAWRATE_I 0.0
param set MC_YAWPOS_I 0.15
param set MC_YAWPOS_D 0.0
param set MC_YAWRATE_P 0.2
param save
fi
#
# Force some key parameters to sane values
# MAV_TYPE 2 = quadrotor
#
param set MAV_TYPE 2
#
# Start and configure PX4IO or FMU interface
#
if px4io detect
then
# Start MAVLink (depends on orb)
mavlink start
usleep 5000
sh /etc/init.d/rc.io
else
# Start MAVLink (on UART1 / ttyS0)
mavlink start -d /dev/ttyS0
usleep 5000
fmu mode_pwm
param set BAT_V_SCALING 0.0098
set EXIT_ON_END yes
param set MC_YAWRATE_I 0.0
param set MC_YAWRATE_D 0.0
param set MPC_TILT_MAX 0.5
param set MPC_THR_MAX 0.8
param set MPC_THR_MIN 0.2
param set MPC_XY_D 0
param set MPC_XY_P 0.5
param set MPC_XY_VEL_D 0
param set MPC_XY_VEL_I 0
param set MPC_XY_VEL_MAX 3
param set MPC_XY_VEL_P 0.2
param set MPC_Z_D 0
param set MPC_Z_P 1
param set MPC_Z_VEL_D 0
param set MPC_Z_VEL_I 0.1
param set MPC_Z_VEL_MAX 2
param set MPC_Z_VEL_P 0.20
fi
#
# Load the mixer for a quad with wide arms
#
mixer load /dev/pwm_output /etc/mixers/FMU_quad_w.mix
#
# Set PWM output frequency
#
pwm rate -c 1234 -r 400
#
# Set disarmed, min and max PWM signals
#
pwm disarmed -c 1234 -p 900
pwm min -c 1234 -p 1050
#
# Start common for all multirotors apps
#
sh /etc/init.d/rc.multirotor
......@@ -37,6 +37,7 @@ then
param set MPC_Z_VEL_P 0.20
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY x
set FRAME_COUNT 4
set HIL yes
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
#!nsh
echo "[init] PX4FMU v1, v2 with or without IO on EasyStar"
echo "[init] EasyStar"
#
# Load default params for this platform
#
if param compare SYS_AUTOCONFIG 1
if [ $DO_AUTOCONFIG == yes ]
then
# Set all params here, then disable autoconfig
#
# Default parameters for this platform
#
param set FW_P_D 0
param set FW_P_I 0
param set FW_P_IMAX 15
......@@ -31,50 +30,7 @@ then
param set FW_L1_PERIOD 16
param set RC_SCALE_ROLL 1.0
param set RC_SCALE_PITCH 1.0
param set SYS_AUTOCONFIG 0
param save
fi
#
# Force some key parameters to sane values
# MAV_TYPE 1 = fixed wing
#
param set MAV_TYPE 1
#
# Start and configure PX4IO or FMU interface
#
if px4io detect
then
# Start MAVLink (depends on orb)
mavlink start
sh /etc/init.d/rc.io
# Limit to 100 Hz updates and (implicit) 50 Hz PWM
px4io limit 100
else
# Start MAVLink (on UART1 / ttyS0)
mavlink start -d /dev/ttyS0
fmu mode_pwm
param set BAT_V_SCALING 0.004593
set EXIT_ON_END yes
fi
#
# Load mixer and start controllers (depends on px4io)
#
if [ -f /fs/microsd/etc/mixers/FMU_RET.mix ]
then
echo "Using /fs/microsd/etc/mixers/FMU_RET.mix"
mixer load /dev/pwm_output /fs/microsd/etc/mixers/FMU_RET.mix
else
echo "Using /etc/mixers/FMU_RET.mix"
mixer load /dev/pwm_output /etc/mixers/FMU_RET.mix
fi
#
# Start common fixedwing apps
#
sh /etc/init.d/rc.fixedwing
set FRAME_TYPE fw
set FRAME_GEOMETRY RET
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic quadcopter X with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY x
set FRAME_COUNT 4
set PWM_RATE 400
......@@ -2,10 +2,7 @@
# Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] PX4FMU v1, v2 with or without IO on DJI F330"
# Use generic quad X PWM as base
sh /etc/init.d/4001_quad_x_pwm
echo "[init] DJI F330"
if [ $DO_AUTOCONFIG == yes ]
then
......@@ -42,6 +39,11 @@ then
param set MPC_Z_VEL_P 0.20
fi
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
set PWM_RATE 400
# DJI ESC range
set PWM_DISARMED 900
set PWM_MIN 1200
......
......@@ -2,10 +2,7 @@
# Maintainers: Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on DJI F450"
# Use generic quad X PWM as base
sh /etc/init.d/4001_quad_x_pwm
echo "[init] DJI F450"
if [ $DO_AUTOCONFIG == yes ]
then
......@@ -27,7 +24,12 @@ then
# TODO add default MPC parameters
fi
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
set PWM_RATE 400
# DJI ESC range
set PWM_DISARMED 900
set PWM_MIN 1200
......
......@@ -4,9 +4,6 @@
echo "[init] PX4FMU v1, v2 with or without IO on HobbyKing X550"
# Use generic quad X PWM as base
sh /etc/init.d/4001_quad_x_pwm
if [ $DO_AUTOCONFIG == yes ]
then
#
......@@ -25,3 +22,8 @@ then
param set MC_YAWRATE_I 0
param set MC_YAWRATE_D 0
fi
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
set PWM_RATE 400
#!nsh
#
# Load default params for this platform
#
if param compare SYS_AUTOCONFIG 1
then
# Set all params here, then disable autoconfig
# TODO
param set SYS_AUTOCONFIG 0
param save
fi
#
# Force some key parameters to sane values
# MAV_TYPE 10 = ground rover
#
param set MAV_TYPE 10
#
# Start MAVLink (depends on orb)
#
mavlink start -d /dev/ttyS1 -b 57600
usleep 5000
#
# Start and configure PX4IO interface
#
sh /etc/init.d/rc.io
#
# 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)
#
roboclaw start /dev/ttyS2 128 1200
segway start
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic quadcopter + with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY +
set FRAME_COUNT 4
set PWM_RATE 400
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic hexacopter X with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY x
set FRAME_COUNT 6
set PWM_RATE 400
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic hexacopter + with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY +
set FRAME_COUNT 4
set PWM_RATE 400
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic octocopter X with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY x
set FRAME_COUNT 8
set PWM_RATE 400
#!nsh
echo "[init] PX4FMU v1, v2 init to log only
#
# 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
fi
#
# Start and configure PX4IO or FMU interface
#
if px4io detect
then
# Start MAVLink (depends on orb)
mavlink start
usleep 5000
sh /etc/init.d/rc.io
# Set PWM values for DJI ESCs
else
# Start MAVLink (on UART1 / ttyS0)
mavlink start -d /dev/ttyS0
usleep 5000
param set BAT_V_SCALING 0.004593
set EXIT_ON_END yes
fi
sh /etc/init.d/rc.sensors
gps start
attitude_estimator_ekf start
position_estimator_inav start
if [ -d /fs/microsd ]
then
if hw_ver compare PX4FMU_V1
then
echo "Start sdlog2 at 50Hz"
sdlog2 start -r 50 -e -b 16
else
echo "Start sdlog2 at 200Hz"
sdlog2 start -r 200 -e -b 16
fi
fi
#!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>, Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on generic octocopter + with PWM ESCs"
if [ $DO_AUTOCONFIG == yes ]
then
#
# Default parameters for this platform
#
fi
set FRAME_TYPE mc
set FRAME_GEOMETRY +
set FRAME_COUNT 8
set PWM_RATE 400
......@@ -17,114 +17,62 @@
# 11000 .. 11999 Hexa Cox
# 12000 .. 12999 Octo Cox
if param compare SYS_AUTOSTART 4001
then
sh /etc/init.d/4001_quad_x_pwm
fi
if param compare SYS_AUTOSTART 4008
then
#sh /etc/init.d/4008_ardrone
fi
if param compare SYS_AUTOSTART 4009
then
#sh /etc/init.d/4009_ardrone_flow
fi
if param compare SYS_AUTOSTART 4010
then
sh /etc/init.d/4010_dji_f330
fi
if param compare SYS_AUTOSTART 4011
then
sh /etc/init.d/4011_dji_f450
fi
if param compare SYS_AUTOSTART 4012
then
sh /etc/init.d/4012_hk_x550
fi
if param compare SYS_AUTOSTART 6001
then
sh /etc/init.d/6001_hexa_x_pwm
fi
if param compare SYS_AUTOSTART 7001
then
sh /etc/init.d/7001_hexa_+_pwm
fi
if param compare SYS_AUTOSTART 8001
then
sh /etc/init.d/8001_octo_x_pwm
fi
#
# Simulation setups
#
if param compare SYS_AUTOSTART 9001
if param compare SYS_AUTOSTART 1000
then
sh /etc/init.d/9001_octo_+_pwm
#sh /etc/init.d/1000_rc_fw_easystar.hil
fi
if param compare SYS_AUTOSTART 12001
if param compare SYS_AUTOSTART 1001
then