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

Init scripts cleanup, WIP

parent 891cb3f8
#!nsh #!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] Team Blacksheep Discovery Quad" echo "[init] Team Blacksheep Discovery Quad"
# if [ $DO_AUTOCONFIG == yes ]
# Load default params for this platform
#
if param compare SYS_AUTOCONFIG 1
then then
# Set all params here, then disable autoconfig #
param set SYS_AUTOCONFIG 0 # Default parameters for this platform
#
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
param set MC_ATT_P 5.0 param set MC_ATT_P 5.0
param set MC_YAWPOS_D 0.0 param set MC_ATT_I 0.0
param set MC_YAWPOS_I 0.15 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_YAWPOS_P 0.5
param set MC_YAWRATE_D 0.0 param set MC_YAWPOS_I 0.15
param set MC_YAWRATE_I 0.0 param set MC_YAWPOS_D 0.0
param set MC_YAWRATE_P 0.2 param set MC_YAWRATE_P 0.2
param set MC_YAWRATE_I 0.0
param save param set MC_YAWRATE_D 0.0
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
fi fi
# set FRAME_TYPE mc
# Load the mixer for a quad with wide arms set FRAME_GEOMETRY quad_w
# set PWM_RATE 400
mixer load /dev/pwm_output /etc/mixers/FMU_quad_w.mix set PWM_DISARMED 900
set PWM_MIN 1100
# set PWM_MAX 1900
# 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
#!nsh #!nsh
# Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] 3DR Iris Quad" echo "[init] 3DR Iris Quad"
# # Use generic wide arm quad X PWM as base
# Load default params for this platform sh /etc/init.d/10001_quad_w
#
if param compare SYS_AUTOCONFIG 1
then
# Set all params here, then disable autoconfig
param set SYS_AUTOCONFIG 0
param set MC_ATTRATE_D 0.004 if [ $DO_AUTOCONFIG == yes ]
param set MC_ATTRATE_I 0.0 then
param set MC_ATTRATE_P 0.13 #
param set MC_ATT_D 0.0 # Default parameters for this platform
param set MC_ATT_I 0.0 #
param set MC_ATT_P 9.0 param set MC_ATT_P 9.0
param set MC_YAWPOS_D 0.0 param set MC_ATT_I 0.0
param set MC_YAWPOS_I 0.15 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_YAWPOS_P 0.5
param set MC_YAWRATE_D 0.0 param set MC_YAWPOS_I 0.15
param set MC_YAWRATE_I 0.0 param set MC_YAWPOS_D 0.0
param set MC_YAWRATE_P 0.2 param set MC_YAWRATE_P 0.2
param set MC_YAWRATE_I 0.0
param save param set MC_YAWRATE_D 0.0
fi
param set MPC_TILT_MAX 0.5
# param set MPC_THR_MAX 0.8
# Force some key parameters to sane values param set MPC_THR_MIN 0.2
# MAV_TYPE 2 = quadrotor param set MPC_XY_D 0
# param set MPC_XY_P 0.5
param set MAV_TYPE 2 param set MPC_XY_VEL_D 0
param set MPC_XY_VEL_I 0
# param set MPC_XY_VEL_MAX 3
# Start and configure PX4IO or FMU interface param set MPC_XY_VEL_P 0.2
# param set MPC_Z_D 0
if px4io detect param set MPC_Z_P 1
then param set MPC_Z_VEL_D 0
# Start MAVLink (depends on orb) param set MPC_Z_VEL_I 0.1
mavlink start param set MPC_Z_VEL_MAX 2
usleep 5000 param set MPC_Z_VEL_P 0.20
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
fi 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 ...@@ -37,6 +37,7 @@ then
param set MPC_Z_VEL_P 0.20 param set MPC_Z_VEL_P 0.20
fi fi
set FRAME_TYPE mc set HIL yes
set FRAME_GEOMETRY x
set FRAME_COUNT 4 set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
#!nsh #!nsh
echo "[init] PX4FMU v1, v2 with or without IO on EasyStar" echo "[init] EasyStar"
# if [ $DO_AUTOCONFIG == yes ]
# Load default params for this platform
#
if param compare SYS_AUTOCONFIG 1
then then
# Set all params here, then disable autoconfig #
# Default parameters for this platform
#
param set FW_P_D 0 param set FW_P_D 0
param set FW_P_I 0 param set FW_P_I 0
param set FW_P_IMAX 15 param set FW_P_IMAX 15
...@@ -31,50 +30,7 @@ then ...@@ -31,50 +30,7 @@ then
param set FW_L1_PERIOD 16 param set FW_L1_PERIOD 16
param set RC_SCALE_ROLL 1.0 param set RC_SCALE_ROLL 1.0
param set RC_SCALE_PITCH 1.0 param set RC_SCALE_PITCH 1.0
param set SYS_AUTOCONFIG 0
param save
fi fi
# set FRAME_TYPE fw
# Force some key parameters to sane values set FRAME_GEOMETRY RET
# 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
#!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 @@ ...@@ -2,10 +2,7 @@
# Maintainers: Anton Babushkin <anton.babushkin@me.com> # Maintainers: Anton Babushkin <anton.babushkin@me.com>
echo "[init] PX4FMU v1, v2 with or without IO on DJI F330" echo "[init] DJI F330"
# Use generic quad X PWM as base
sh /etc/init.d/4001_quad_x_pwm
if [ $DO_AUTOCONFIG == yes ] if [ $DO_AUTOCONFIG == yes ]
then then
...@@ -42,6 +39,11 @@ then ...@@ -42,6 +39,11 @@ then
param set MPC_Z_VEL_P 0.20 param set MPC_Z_VEL_P 0.20
fi fi
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
set PWM_RATE 400
# DJI ESC range # DJI ESC range
set PWM_DISARMED 900 set PWM_DISARMED 900
set PWM_MIN 1200 set PWM_MIN 1200
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
# Maintainers: Lorenz Meier <lm@inf.ethz.ch> # Maintainers: Lorenz Meier <lm@inf.ethz.ch>
echo "[init] PX4FMU v1, v2 with or without IO on DJI F450" echo "[init] DJI F450"
# Use generic quad X PWM as base
sh /etc/init.d/4001_quad_x_pwm
if [ $DO_AUTOCONFIG == yes ] if [ $DO_AUTOCONFIG == yes ]
then then
...@@ -27,7 +24,12 @@ then ...@@ -27,7 +24,12 @@ then
# TODO add default MPC parameters # TODO add default MPC parameters
fi fi
set VEHICLE_TYPE mc
set FRAME_GEOMETRY quad_x
set PWM_RATE 400
# DJI ESC range # DJI ESC range
set PWM_DISARMED 900 set PWM_DISARMED 900
set PWM_MIN 1200 set PWM_MIN 1200
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
echo "[init] PX4FMU v1, v2 with or without IO on HobbyKing X550" 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 ] if [ $DO_AUTOCONFIG == yes ]
then then
# #
...@@ -25,3 +22,8 @@ then ...@@ -25,3 +22,8 @@ then
param set MC_YAWRATE_I 0 param set MC_YAWRATE_I 0
param set MC_YAWRATE_D 0 param set MC_YAWRATE_D 0
fi 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 @@ ...@@ -17,114 +17,62 @@
# 11000 .. 11999 Hexa Cox # 11000 .. 11999 Hexa Cox
# 12000 .. 12999 Octo Cox # 12000 .. 12999 Octo Cox
if param compare SYS_AUTOSTART 4001 #
then # Simulation setups
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