2018-12-18 04:26:22 -04:00
|
|
|
#!/bin/sh
|
2018-07-12 15:50:47 -03:00
|
|
|
#
|
|
|
|
# Vehicle configuration setup script.
|
|
|
|
#
|
|
|
|
# NOTE: Script variables are declared/initialized/unset in the rcS script.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2018-07-26 21:18:53 -03:00
|
|
|
# Fixed wing setup.
|
2018-07-12 15:50:47 -03:00
|
|
|
#
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $VEHICLE_TYPE = fw ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-26 21:18:53 -03:00
|
|
|
# Set default mixer for fixed wing if not defined.
|
2018-07-12 15:50:47 -03:00
|
|
|
set MIXER AERT
|
|
|
|
fi
|
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MAV_TYPE = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set a default MAV_TYPE = 1 if not defined.
|
2018-07-12 15:50:47 -03:00
|
|
|
set MAV_TYPE 1
|
|
|
|
fi
|
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set the mav type parameter.
|
2018-07-12 15:50:47 -03:00
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Start standard fixedwing apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.fw_apps
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
2018-07-26 21:18:53 -03:00
|
|
|
# Multicopter setup.
|
2018-07-12 15:50:47 -03:00
|
|
|
#
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $VEHICLE_TYPE = mc ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
echo "MC mixer undefined"
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MAV_TYPE = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set a default MAV_TYPE = 2 if not defined.
|
|
|
|
set MAV_TYPE 2
|
|
|
|
|
2018-07-12 15:50:47 -03:00
|
|
|
# Use mixer to detect vehicle type
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = coax ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
set MAV_TYPE 3
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = hexa_x -o $MIXER = hexa_+ ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 13
|
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = hexa_cox ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 13
|
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = octo_x -o $MIXER = octo_+ ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 14
|
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = octo_cox -o $MIXER = octo_cox_w ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 14
|
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = tri_y_yaw- -o $MIXER = tri_y_yaw+ ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
set MAV_TYPE 15
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set the mav type parameter.
|
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-26 21:18:53 -03:00
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-26 21:18:53 -03:00
|
|
|
# Start standard multicopter apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.mc_apps
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
2018-07-31 14:17:09 -03:00
|
|
|
# UGV setup.
|
2018-07-12 15:50:47 -03:00
|
|
|
#
|
2019-05-02 05:26:42 -03:00
|
|
|
if [ $VEHICLE_TYPE = rover ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set default mixer for UGV if not defined.
|
2019-05-02 05:26:42 -03:00
|
|
|
set MIXER rover_generic
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MAV_TYPE = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set a default MAV_TYPE = 10 if not defined.
|
|
|
|
set MAV_TYPE 10
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set the mav type parameter.
|
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-26 21:18:53 -03:00
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Start standard UGV apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.rover_apps
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
2018-07-31 14:17:09 -03:00
|
|
|
# VTOL setup.
|
2018-07-12 15:50:47 -03:00
|
|
|
#
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $VEHICLE_TYPE = vtol ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
echo "VTOL mixer undefined"
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MAV_TYPE = none ]
|
2018-07-12 15:50:47 -03:00
|
|
|
then
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set a default MAV_TYPE = 19 if not defined.
|
|
|
|
set MAV_TYPE 19
|
|
|
|
|
|
|
|
# Use mixer to detect vehicle type.
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = firefly6 ]
|
2018-07-31 14:17:09 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 21
|
|
|
|
fi
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $MIXER = quad_x_pusher_vtol ]
|
2018-07-31 14:17:09 -03:00
|
|
|
then
|
|
|
|
set MAV_TYPE 22
|
|
|
|
fi
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Set the mav type parameter.
|
2018-07-12 15:50:47 -03:00
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
|
|
|
|
2018-07-26 21:18:53 -03:00
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2018-07-12 15:50:47 -03:00
|
|
|
|
2018-07-31 14:17:09 -03:00
|
|
|
# Start standard vtol apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.vtol_apps
|
2018-07-12 15:50:47 -03:00
|
|
|
fi
|
2018-07-12 17:45:19 -03:00
|
|
|
|
2020-08-10 03:52:51 -03:00
|
|
|
#
|
|
|
|
# Airship setup.
|
|
|
|
#
|
|
|
|
if [ $VEHICLE_TYPE = airship ]
|
|
|
|
then
|
|
|
|
if [ $MIXER = none ]
|
|
|
|
then
|
|
|
|
echo "Airship mixer undefined"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $MAV_TYPE = none ]
|
|
|
|
then
|
|
|
|
# Set a default MAV_TYPE = 7 if not defined.
|
|
|
|
set MAV_TYPE 7
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set the mav type parameter.
|
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
|
|
|
|
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2020-08-10 03:52:51 -03:00
|
|
|
|
|
|
|
# Start airship apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.airship_apps
|
2020-08-10 03:52:51 -03:00
|
|
|
fi
|
|
|
|
|
2020-02-05 00:24:37 -04:00
|
|
|
#
|
|
|
|
# UUV setup
|
|
|
|
#
|
|
|
|
if [ $VEHICLE_TYPE = uuv ]
|
|
|
|
then
|
|
|
|
if [ $MIXER = none ]
|
|
|
|
then
|
|
|
|
echo "UUV mixer undefined"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load mixer and configure outputs.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.interface
|
2020-02-05 00:24:37 -04:00
|
|
|
|
|
|
|
# Start standard vtol apps.
|
2020-08-20 13:25:48 -03:00
|
|
|
source /etc/init.d/rc.uuv_apps
|
2020-02-05 00:24:37 -04:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-12 17:45:19 -03:00
|
|
|
#
|
|
|
|
# Generic setup (autostart ID not found).
|
|
|
|
#
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $VEHICLE_TYPE = none ]
|
2018-07-12 17:45:19 -03:00
|
|
|
then
|
|
|
|
echo "No autostart ID found"
|
|
|
|
ekf2 start
|
|
|
|
fi
|