2018-12-18 04:26:22 -04:00
|
|
|
#!/bin/sh
|
2013-04-26 20:14:32 -03:00
|
|
|
#
|
2017-10-05 18:29:44 -03:00
|
|
|
# Standard startup script for sensor drivers.
|
2013-04-26 20:14:32 -03:00
|
|
|
#
|
2018-07-26 21:18:53 -03:00
|
|
|
# NOTE: Script variables are declared/initialized/unset in the rcS script.
|
|
|
|
#
|
2013-04-26 20:14:32 -03:00
|
|
|
|
2018-08-11 05:33:43 -03:00
|
|
|
if ! ver hwcmp AEROFC_V1 OMNIBUS_F4SD
|
2015-05-10 05:21:16 -03:00
|
|
|
then
|
2018-11-22 00:27:21 -04:00
|
|
|
if ! ver hwcmp BITCRAZE_CRAZYFLIE
|
2016-11-08 16:58:32 -04:00
|
|
|
then
|
2017-08-10 15:31:54 -03:00
|
|
|
# Configure all I2C buses to 100 KHz as they
|
|
|
|
# are all external or slow
|
2020-03-27 16:31:04 -03:00
|
|
|
# TODO: move this
|
|
|
|
pwm_out i2c 1 100000
|
|
|
|
pwm_out i2c 2 100000
|
2017-08-10 15:31:54 -03:00
|
|
|
fi
|
2015-05-10 05:21:16 -03:00
|
|
|
fi
|
2013-04-26 20:14:32 -03:00
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
###############################################################################
|
|
|
|
# Begin Optional drivers #
|
|
|
|
###############################################################################
|
2017-06-16 12:49:14 -03:00
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
|
2017-05-22 11:06:29 -03:00
|
|
|
then
|
2017-10-05 18:29:44 -03:00
|
|
|
if param compare CBRK_AIRSPD_CHK 0
|
|
|
|
then
|
2020-03-03 14:02:11 -04:00
|
|
|
sdp3x_airspeed start -X
|
|
|
|
sdp3x_airspeed start -X -a 0x22
|
2017-05-22 11:06:29 -03:00
|
|
|
|
2017-10-05 18:29:44 -03:00
|
|
|
# Pixhawk 2.1 has a MS5611 on I2C which gets wrongly
|
|
|
|
# detected as MS5525 because the chip manufacturer was so
|
|
|
|
# clever to assign the same I2C address and skip a WHO_AM_I
|
|
|
|
# register.
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $BOARD_FMUV3 = 21 ]
|
2017-10-05 18:29:44 -03:00
|
|
|
then
|
2020-03-03 14:02:11 -04:00
|
|
|
ms5525_airspeed start -X -b 2
|
2017-10-05 18:29:44 -03:00
|
|
|
else
|
2020-03-03 14:02:11 -04:00
|
|
|
ms5525_airspeed start -X
|
2017-10-05 18:29:44 -03:00
|
|
|
fi
|
2017-05-22 11:06:29 -03:00
|
|
|
|
2020-03-03 14:02:11 -04:00
|
|
|
ms4525_airspeed start -X
|
2018-06-17 16:04:10 -03:00
|
|
|
|
2020-03-03 14:02:11 -04:00
|
|
|
ets_airspeed start -X
|
2017-10-05 18:29:44 -03:00
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
2013-09-29 09:07:01 -03:00
|
|
|
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_BATT 1
|
2018-12-05 10:49:58 -04:00
|
|
|
then
|
|
|
|
batt_smbus start -X
|
|
|
|
fi
|
|
|
|
|
2017-06-16 12:49:14 -03:00
|
|
|
# Sensors on the PWM interface bank
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_LL40LS 1
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
|
|
|
if pwm_input start
|
|
|
|
then
|
2020-03-03 14:01:59 -04:00
|
|
|
ll40ls_pwm start
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-01-06 21:14:06 -04:00
|
|
|
# External automatic trigger system
|
|
|
|
if param compare FD_EXT_ATS_EN 1
|
|
|
|
then
|
|
|
|
pwm_input start
|
|
|
|
fi
|
|
|
|
|
2017-06-16 12:49:14 -03:00
|
|
|
# Lidar-Lite on I2C
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_LL40LS 2
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-03-02 06:50:25 -04:00
|
|
|
ll40ls start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2019-06-15 22:13:52 -03:00
|
|
|
# mappydot lidar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_MPDT 1
|
2019-06-15 22:13:52 -03:00
|
|
|
then
|
2020-03-02 07:03:10 -04:00
|
|
|
mappydot start -X
|
2019-06-15 22:13:52 -03:00
|
|
|
fi
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# mb12xx sonar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_MB12XX 0
|
2018-05-19 12:33:20 -03:00
|
|
|
then
|
2020-03-02 08:55:55 -04:00
|
|
|
mb12xx start -X
|
2018-05-19 12:33:20 -03:00
|
|
|
fi
|
|
|
|
|
2018-08-23 21:01:08 -03:00
|
|
|
# pga460 sonar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_PGA460 0
|
2018-08-23 21:01:08 -03:00
|
|
|
then
|
|
|
|
pga460 start
|
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
# Lightware i2c lidar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_SF1XX 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-03-02 09:43:09 -04:00
|
|
|
sf1xx start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# Heater driver for temperature regulated IMUs.
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_THERMAL 1
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2018-05-19 12:33:20 -03:00
|
|
|
heater start
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
# Teraranger one tof sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_TRANGER 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-03-02 10:03:57 -04:00
|
|
|
teraranger start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2020-02-26 09:35:14 -04:00
|
|
|
# Possible external pmw3901 optical flow sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_PMW3901 0
|
2019-09-02 12:08:51 -03:00
|
|
|
then
|
2020-02-26 09:35:14 -04:00
|
|
|
pmw3901 -S start
|
2019-09-02 12:08:51 -03:00
|
|
|
fi
|
|
|
|
|
2020-03-26 12:24:48 -03:00
|
|
|
# Possible external paw3902 optical flow sensor
|
|
|
|
if param greater -s SENS_EN_PAW3902 0
|
|
|
|
then
|
|
|
|
paw3902 -S start
|
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
###############################################################################
|
|
|
|
# End Optional drivers #
|
|
|
|
###############################################################################
|
|
|
|
|
2015-09-07 10:43:43 -03:00
|
|
|
# Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire)
|
|
|
|
usleep 20000
|
2017-10-05 18:29:44 -03:00
|
|
|
sensors start
|