2012-08-04 15:12:36 -07:00
|
|
|
#!nsh
|
2017-04-06 03:42:16 -10:00
|
|
|
# Un comment and use set +e to ignore and set -e to enable 'exit on error control'
|
2017-06-09 09:17:07 +02:00
|
|
|
set +e
|
2017-04-06 03:42:16 -10:00
|
|
|
# Un comment the line below to help debug scripts by printing a trace of the script commands
|
|
|
|
|
#set -x
|
2012-08-04 15:12:36 -07:00
|
|
|
# PX4FMU startup script.
|
2014-12-13 15:57:38 +01:00
|
|
|
#
|
2016-12-23 09:06:49 +01:00
|
|
|
# NOTE: environment variable references:
|
|
|
|
|
# If the dollar sign ('$') is followed by a left bracket ('{') then the
|
|
|
|
|
# variable name is terminated with the right bracket character ('}').
|
|
|
|
|
# Otherwise, the variable name goes to the end of the argument.
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# NOTE: COMMENT LINES ARE REMOVED BEFORE STORED IN ROMFS.
|
2014-12-13 15:57:38 +01:00
|
|
|
#
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
# UART mapping on OMNIBUSF4SD:
|
|
|
|
|
#
|
|
|
|
|
# USART1 /dev/ttyS0 SerialRX
|
|
|
|
|
# USART4 /dev/ttyS1 TELEM1
|
|
|
|
|
# USART6 /dev/ttyS2 GPS
|
|
|
|
|
#
|
2017-08-10 08:31:54 -10:00
|
|
|
# UART mapping on FMUv2/3/4:
|
2016-12-18 01:46:59 +01:00
|
|
|
#
|
2018-01-18 17:32:33 +01:00
|
|
|
# UART1 /dev/ttyS0 IO debug (except v4, there ttyS0 is the wifi)
|
2016-12-18 01:46:59 +01:00
|
|
|
# USART2 /dev/ttyS1 TELEM1 (flow control)
|
|
|
|
|
# USART3 /dev/ttyS2 TELEM2 (flow control)
|
|
|
|
|
# UART4
|
2016-12-18 22:29:14 +01:00
|
|
|
# UART7 CONSOLE
|
|
|
|
|
# UART8 SERIAL4
|
2016-12-18 01:46:59 +01:00
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# UART mapping on FMUv5:
|
|
|
|
|
#
|
|
|
|
|
# UART1 /dev/ttyS0 GPS
|
|
|
|
|
# USART2 /dev/ttyS1 TELEM1 (flow control)
|
|
|
|
|
# USART3 /dev/ttyS2 TELEM2 (flow control)
|
2018-01-09 15:30:05 +01:00
|
|
|
# UART4 /dev/ttyS3 TELEM4
|
2016-12-18 01:46:59 +01:00
|
|
|
# USART6 /dev/ttyS4 TELEM3 (flow control)
|
|
|
|
|
# UART7 /dev/ttyS5 ?
|
|
|
|
|
# UART8 /dev/ttyS6 CONSOLE
|
2012-08-04 15:12:36 -07:00
|
|
|
|
2016-12-12 12:53:12 -10:00
|
|
|
#
|
|
|
|
|
# Mount the procfs.
|
|
|
|
|
#
|
|
|
|
|
mount -t procfs /proc
|
|
|
|
|
|
2015-01-26 08:59:19 +01:00
|
|
|
#
|
|
|
|
|
# Start CDC/ACM serial driver
|
|
|
|
|
#
|
2017-09-20 00:04:23 -04:00
|
|
|
sercon
|
2015-01-26 08:59:19 +01:00
|
|
|
|
2017-09-24 13:36:13 -04:00
|
|
|
# print full system version
|
|
|
|
|
ver all
|
|
|
|
|
|
2012-08-04 15:12:36 -07:00
|
|
|
#
|
2014-02-01 15:46:04 +01:00
|
|
|
# Default to auto-start mode.
|
2012-08-04 15:12:36 -07:00
|
|
|
#
|
2015-01-17 04:04:48 +03:00
|
|
|
set MODE autostart
|
2012-08-04 15:12:36 -07:00
|
|
|
|
2017-06-20 15:23:20 +02:00
|
|
|
set TUNE_ERR "ML<<CP4CP4CP4CP4CP4"
|
2015-04-11 01:02:21 +02:00
|
|
|
set LOG_FILE /fs/microsd/bootlog.txt
|
2013-12-14 15:08:56 +01:00
|
|
|
|
2012-08-04 15:12:36 -07:00
|
|
|
#
|
|
|
|
|
# Try to mount the microSD card.
|
|
|
|
|
#
|
2015-02-14 20:33:20 +01:00
|
|
|
# REBOOTWORK this needs to start after the flight control loop
|
2012-08-04 15:12:36 -07:00
|
|
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
|
|
|
|
then
|
2016-12-12 12:53:12 -10:00
|
|
|
if hardfault_log check
|
|
|
|
|
then
|
|
|
|
|
tone_alarm error
|
|
|
|
|
if hardfault_log commit
|
|
|
|
|
then
|
|
|
|
|
hardfault_log reset
|
|
|
|
|
tone_alarm stop
|
|
|
|
|
fi
|
2017-09-20 00:04:23 -04:00
|
|
|
fi
|
2012-08-04 15:12:36 -07:00
|
|
|
else
|
2015-04-11 01:02:21 +02:00
|
|
|
tone_alarm MBAGP
|
|
|
|
|
if mkfatfs /dev/mmcsd0
|
|
|
|
|
then
|
|
|
|
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
|
|
|
|
then
|
2018-01-05 22:45:12 +01:00
|
|
|
echo "INFO [init] card formatted"
|
2015-04-11 01:02:21 +02:00
|
|
|
else
|
2018-01-05 22:45:12 +01:00
|
|
|
echo "ERROR [init] format failed"
|
2015-04-11 01:02:21 +02:00
|
|
|
tone_alarm MNBG
|
|
|
|
|
set LOG_FILE /dev/null
|
|
|
|
|
fi
|
2015-04-13 18:45:18 +02:00
|
|
|
else
|
|
|
|
|
set LOG_FILE /dev/null
|
2015-04-11 01:02:21 +02:00
|
|
|
fi
|
2012-08-04 15:12:36 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Look for an init script on the microSD card.
|
2014-01-10 23:14:29 +01:00
|
|
|
# Disable autostart if the script found.
|
2012-08-04 15:12:36 -07:00
|
|
|
#
|
2016-03-28 14:48:14 +02:00
|
|
|
set FRC /fs/microsd/etc/rc.txt
|
2014-11-17 14:58:29 +01:00
|
|
|
if [ -f $FRC ]
|
2012-12-27 13:17:43 +01:00
|
|
|
then
|
2014-11-17 14:58:29 +01:00
|
|
|
sh $FRC
|
2014-01-10 23:14:29 +01:00
|
|
|
set MODE custom
|
2012-08-04 15:12:36 -07:00
|
|
|
fi
|
2015-01-08 15:42:25 +01:00
|
|
|
unset FRC
|
2012-08-04 15:12:36 -07:00
|
|
|
|
2013-07-18 10:01:03 +02:00
|
|
|
if [ $MODE == autostart ]
|
|
|
|
|
then
|
2014-08-26 10:13:52 +02:00
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
|
|
|
|
# Start the ORB (first app to start)
|
|
|
|
|
#
|
|
|
|
|
uorb start
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2017-06-20 15:23:20 +02:00
|
|
|
# Start tone driver
|
|
|
|
|
tone_alarm start
|
|
|
|
|
|
|
|
|
|
# play startup tone
|
|
|
|
|
tune_control play -t 1
|
|
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-14 15:52:46 +01:00
|
|
|
# Load parameters
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-15 00:02:57 +01:00
|
|
|
set PARAM_FILE /fs/microsd/params
|
2014-01-12 16:33:23 +01:00
|
|
|
if mtd start
|
|
|
|
|
then
|
2014-01-17 23:14:24 +01:00
|
|
|
set PARAM_FILE /fs/mtd_params
|
2014-01-15 00:02:57 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-15 00:02:57 +01:00
|
|
|
param select $PARAM_FILE
|
|
|
|
|
if param load
|
|
|
|
|
then
|
2014-01-12 16:33:23 +01:00
|
|
|
else
|
2014-08-11 14:56:13 +02:00
|
|
|
if param reset
|
|
|
|
|
then
|
|
|
|
|
fi
|
2014-01-12 17:43:33 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
|
|
|
|
# Start system state indicator
|
|
|
|
|
#
|
|
|
|
|
if rgbled start
|
2013-08-17 15:48:13 +02:00
|
|
|
then
|
2013-08-25 19:27:11 +02:00
|
|
|
else
|
|
|
|
|
if blinkm start
|
|
|
|
|
then
|
|
|
|
|
blinkm systemstate
|
|
|
|
|
fi
|
2013-08-17 15:48:13 +02:00
|
|
|
fi
|
2014-05-29 13:52:29 +02:00
|
|
|
|
2017-08-24 10:27:38 -10:00
|
|
|
# FMUv5 may have both PWM I2C RGB LED support
|
|
|
|
|
rgbled_pwm start
|
|
|
|
|
|
2016-03-28 14:48:14 +02:00
|
|
|
#
|
|
|
|
|
# Set AUTOCNF flag to use it in AUTOSTART scripts
|
|
|
|
|
#
|
|
|
|
|
if param compare SYS_AUTOCONFIG 1
|
|
|
|
|
then
|
2018-04-17 12:40:54 +02:00
|
|
|
# Wipe out params except RC*, flight modes and total flight time
|
|
|
|
|
param reset_nostart RC* COM_FLTMODE* LND_FLIGHT_T_*
|
2016-03-28 14:48:14 +02:00
|
|
|
set AUTOCNF yes
|
|
|
|
|
else
|
|
|
|
|
set AUTOCNF no
|
2016-07-02 12:08:57 +02:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Release 1.4.0 transitional support:
|
|
|
|
|
# set to old default if unconfigured.
|
|
|
|
|
# this preserves the previous behaviour
|
|
|
|
|
#
|
|
|
|
|
if param compare BAT_N_CELLS 0
|
|
|
|
|
then
|
|
|
|
|
param set BAT_N_CELLS 3
|
|
|
|
|
fi
|
2016-03-28 14:48:14 +02:00
|
|
|
fi
|
|
|
|
|
|
2013-11-05 19:56:33 +01:00
|
|
|
#
|
2014-01-10 23:14:29 +01:00
|
|
|
# Set default values
|
2013-11-05 19:56:33 +01:00
|
|
|
#
|
2014-01-10 23:14:29 +01:00
|
|
|
set VEHICLE_TYPE none
|
2014-01-15 00:02:57 +01:00
|
|
|
set MIXER none
|
2015-01-07 00:25:06 +02:00
|
|
|
set MIXER_AUX none
|
2014-01-11 17:52:29 +01:00
|
|
|
set OUTPUT_MODE none
|
2014-11-17 14:58:29 +01:00
|
|
|
set PWM_OUT none
|
2016-12-07 09:14:17 +01:00
|
|
|
set PWM_RATE p:PWM_RATE
|
|
|
|
|
set PWM_DISARMED p:PWM_DISARMED
|
|
|
|
|
set PWM_MIN p:PWM_MIN
|
|
|
|
|
set PWM_MAX p:PWM_MAX
|
2015-03-03 23:53:48 -08:00
|
|
|
set PWM_AUX_OUT none
|
|
|
|
|
set PWM_AUX_RATE none
|
2016-02-14 19:51:43 +01:00
|
|
|
set PWM_ACHDIS none
|
2016-12-07 09:14:17 +01:00
|
|
|
set PWM_AUX_DISARMED p:PWM_AUX_DISARMED
|
|
|
|
|
set PWM_AUX_MIN p:PWM_AUX_MIN
|
|
|
|
|
set PWM_AUX_MAX p:PWM_AUX_MAX
|
2015-04-26 23:27:23 +02:00
|
|
|
set FAILSAFE_AUX none
|
2014-11-17 14:58:29 +01:00
|
|
|
set MK_MODE none
|
2014-01-11 17:52:29 +01:00
|
|
|
set FMU_MODE pwm
|
2015-08-13 09:45:33 +02:00
|
|
|
set AUX_MODE pwm
|
2017-07-18 16:52:26 +02:00
|
|
|
set FMU_ARGS ""
|
2014-11-17 14:58:29 +01:00
|
|
|
set MAVLINK_F default
|
2016-11-10 21:35:17 -02:00
|
|
|
set MAVLINK_COMPANION_DEVICE /dev/ttyS2
|
2014-01-15 00:02:57 +01:00
|
|
|
set MAV_TYPE none
|
2014-08-26 10:13:52 +02:00
|
|
|
set FAILSAFE none
|
2017-09-20 00:04:23 -04:00
|
|
|
set USE_IO no
|
2017-12-28 15:29:10 +01:00
|
|
|
set LOGGER_BUF 14
|
2016-03-12 12:50:14 +08:00
|
|
|
|
2017-09-20 00:04:23 -04:00
|
|
|
if ver hwcmp PX4FMU_V5
|
2016-03-12 12:50:14 +08:00
|
|
|
then
|
2017-09-20 00:04:23 -04:00
|
|
|
set LOGGER_BUF 64
|
|
|
|
|
fi
|
2017-01-08 17:54:41 -08:00
|
|
|
|
2017-09-20 00:04:23 -04:00
|
|
|
if ver hwcmp CRAZYFLIE
|
|
|
|
|
then
|
|
|
|
|
if param compare SYS_AUTOSTART 0
|
2017-01-08 17:54:41 -08:00
|
|
|
then
|
2017-09-20 00:04:23 -04:00
|
|
|
param set SYS_AUTOSTART 4900
|
|
|
|
|
set AUTOCNF yes
|
2017-01-08 17:54:41 -08:00
|
|
|
fi
|
2016-03-12 12:50:14 +08:00
|
|
|
fi
|
|
|
|
|
|
2016-12-05 09:18:00 -08:00
|
|
|
if ver hwcmp AEROFC_V1
|
|
|
|
|
then
|
|
|
|
|
if param compare SYS_AUTOSTART 0
|
|
|
|
|
then
|
|
|
|
|
set AUTOCNF yes
|
|
|
|
|
fi
|
2016-12-05 09:23:55 -08:00
|
|
|
|
|
|
|
|
# We don't allow changing AUTOSTART as it doesn't work in
|
|
|
|
|
# other configurations
|
2016-12-05 09:18:00 -08:00
|
|
|
param set SYS_AUTOSTART 4070
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-28 14:39:05 -10:00
|
|
|
if ver hwcmp NXPHLITE_V3
|
|
|
|
|
then
|
|
|
|
|
param set SYS_FMU_TASK 1
|
|
|
|
|
set MAVLINK_COMPANION_DEVICE /dev/ttyS4
|
|
|
|
|
fi
|
|
|
|
|
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
if ver hwcmp OMNIBUS_F4SD
|
|
|
|
|
then
|
|
|
|
|
set MAVLINK_COMPANION_DEVICE /dev/ttyS1
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-20 00:04:23 -04:00
|
|
|
#
|
|
|
|
|
# Set USE_IO flag
|
|
|
|
|
#
|
|
|
|
|
if param compare SYS_USE_IO 1
|
|
|
|
|
then
|
|
|
|
|
set USE_IO yes
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if param compare SYS_FMU_TASK 1
|
|
|
|
|
then
|
|
|
|
|
set FMU_ARGS "-t"
|
|
|
|
|
fi
|
|
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-08 20:55:12 +01:00
|
|
|
# Set parameters and env variables for selected AUTOSTART
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-10 23:41:03 +01:00
|
|
|
if param compare SYS_AUTOSTART 0
|
2013-10-15 17:54:57 +02:00
|
|
|
then
|
2014-01-10 23:41:03 +01:00
|
|
|
else
|
|
|
|
|
sh /etc/init.d/rc.autostart
|
2013-10-15 17:54:57 +02:00
|
|
|
fi
|
2015-01-09 07:56:20 +01:00
|
|
|
unset MODE
|
2013-10-15 17:54:57 +02:00
|
|
|
|
2017-04-24 14:44:36 +02:00
|
|
|
#
|
|
|
|
|
# If mount (gimbal) control is enabled and output mode is AUX, set the aux
|
|
|
|
|
# mixer to mount (override the airframe-specific MIXER_AUX setting)
|
|
|
|
|
#
|
|
|
|
|
if param compare MNT_MODE_IN -1
|
|
|
|
|
then
|
|
|
|
|
else
|
|
|
|
|
if param compare MNT_MODE_OUT 0
|
|
|
|
|
then
|
|
|
|
|
set MIXER_AUX mount
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-10 23:14:29 +01:00
|
|
|
# Override parameters from user configuration file
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2016-03-28 14:48:14 +02:00
|
|
|
set FCONFIG /fs/microsd/etc/config.txt
|
2014-11-17 14:58:29 +01:00
|
|
|
if [ -f $FCONFIG ]
|
2013-12-14 15:08:56 +01:00
|
|
|
then
|
2016-12-23 09:06:49 +01:00
|
|
|
echo "Custom: ${FCONFIG}"
|
2014-11-17 14:58:29 +01:00
|
|
|
sh $FCONFIG
|
2013-12-14 15:08:56 +01:00
|
|
|
fi
|
2014-11-17 14:58:29 +01:00
|
|
|
unset FCONFIG
|
2013-12-14 15:08:56 +01:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
#
|
|
|
|
|
# If autoconfig parameter was set, reset it and save parameters
|
|
|
|
|
#
|
2014-11-17 14:58:29 +01:00
|
|
|
if [ $AUTOCNF == yes ]
|
2013-08-02 15:47:04 +02:00
|
|
|
then
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
# Disable safety switch by default on Pixracer and OmnibusF4SD
|
|
|
|
|
if ver hwcmp PX4FMU_V4 OMNIBUS_F4SD
|
2016-12-26 19:30:14 +01:00
|
|
|
then
|
|
|
|
|
param set CBRK_IO_SAFETY 22027
|
|
|
|
|
fi
|
2018-01-09 15:30:05 +01:00
|
|
|
|
|
|
|
|
# Run FMU as task on Pixracer and on boards with enough RAM
|
|
|
|
|
if ver hwcmp PX4FMU_V4 PX4FMU_V4PRO PX4FMU_V5
|
|
|
|
|
then
|
|
|
|
|
param set SYS_FMU_TASK 1
|
|
|
|
|
fi
|
|
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
param set SYS_AUTOCONFIG 0
|
2013-12-14 15:08:56 +01:00
|
|
|
fi
|
2015-01-09 07:56:20 +01:00
|
|
|
unset AUTOCNF
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-11 17:52:29 +01:00
|
|
|
set IO_PRESENT no
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-11 17:52:29 +01:00
|
|
|
if [ $USE_IO == yes ]
|
2013-12-14 15:08:56 +01:00
|
|
|
then
|
2014-01-11 17:52:29 +01:00
|
|
|
#
|
|
|
|
|
# Check if PX4IO present and update firmware if needed
|
|
|
|
|
#
|
2015-10-20 13:36:25 -04:00
|
|
|
if [ -f /etc/extras/px4io-v2.bin ]
|
2013-08-02 15:47:04 +02:00
|
|
|
then
|
2015-10-20 13:36:25 -04:00
|
|
|
set IO_FILE /etc/extras/px4io-v2.bin
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2017-08-10 09:02:42 -10:00
|
|
|
if px4io checkcrc ${IO_FILE}
|
|
|
|
|
then
|
|
|
|
|
set IO_PRESENT yes
|
|
|
|
|
else
|
|
|
|
|
tone_alarm MLL32CP8MB
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2017-08-10 09:02:42 -10:00
|
|
|
if px4io start
|
2015-02-28 11:15:13 +01:00
|
|
|
then
|
2017-08-10 09:02:42 -10:00
|
|
|
# try to safe px4 io so motor outputs dont go crazy
|
|
|
|
|
if px4io safety_on
|
|
|
|
|
then
|
|
|
|
|
# success! no-op
|
|
|
|
|
else
|
|
|
|
|
# px4io did not respond to the safety command
|
|
|
|
|
px4io stop
|
|
|
|
|
fi
|
2015-02-28 11:15:13 +01:00
|
|
|
fi
|
2015-02-14 20:33:20 +01:00
|
|
|
|
2017-08-10 09:02:42 -10:00
|
|
|
if px4io forceupdate 14662 ${IO_FILE}
|
2014-01-11 17:52:29 +01:00
|
|
|
then
|
2017-08-10 09:02:42 -10:00
|
|
|
usleep 10000
|
|
|
|
|
if px4io checkcrc ${IO_FILE}
|
|
|
|
|
then
|
|
|
|
|
echo "PX4IO CRC OK after updating" >> $LOG_FILE
|
|
|
|
|
tone_alarm MLL8CDE
|
|
|
|
|
|
|
|
|
|
set IO_PRESENT yes
|
|
|
|
|
else
|
|
|
|
|
echo "PX4IO update failed" >> $LOG_FILE
|
|
|
|
|
tone_alarm ${TUNE_ERR}
|
|
|
|
|
fi
|
2014-01-11 17:52:29 +01:00
|
|
|
else
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "PX4IO update failed" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-11 17:52:29 +01:00
|
|
|
fi
|
2013-08-31 11:56:39 +02:00
|
|
|
fi
|
2014-01-11 17:52:29 +01:00
|
|
|
fi
|
2015-01-09 09:08:51 +01:00
|
|
|
unset IO_FILE
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-11 17:52:29 +01:00
|
|
|
if [ $IO_PRESENT == no ]
|
|
|
|
|
then
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "PX4IO not found" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2013-08-31 11:56:39 +02:00
|
|
|
fi
|
2013-08-02 15:47:04 +02:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2013-08-25 19:27:11 +02:00
|
|
|
#
|
2014-01-11 17:52:29 +01:00
|
|
|
# Set default output if not set
|
|
|
|
|
#
|
|
|
|
|
if [ $OUTPUT_MODE == none ]
|
2013-12-28 22:52:23 +01:00
|
|
|
then
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $USE_IO == yes ]
|
2014-01-11 17:52:29 +01:00
|
|
|
then
|
|
|
|
|
set OUTPUT_MODE io
|
|
|
|
|
else
|
|
|
|
|
set OUTPUT_MODE fmu
|
|
|
|
|
fi
|
2013-12-28 22:52:23 +01:00
|
|
|
fi
|
|
|
|
|
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $OUTPUT_MODE == io -a $IO_PRESENT != yes ]
|
2013-12-28 22:52:23 +01:00
|
|
|
then
|
2014-01-15 00:02:57 +01:00
|
|
|
# Need IO for output but it not present, disable output
|
|
|
|
|
set OUTPUT_MODE none
|
2014-03-06 12:45:10 +01:00
|
|
|
fi
|
|
|
|
|
|
2016-11-16 15:45:33 -02:00
|
|
|
if [ $OUTPUT_MODE == tap_esc ]
|
|
|
|
|
then
|
|
|
|
|
set FMU_MODE rcin
|
|
|
|
|
fi
|
|
|
|
|
|
2017-02-14 10:42:30 -08:00
|
|
|
set DATAMAN_OPT ""
|
|
|
|
|
if ver hwcmp AEROFC_V1
|
|
|
|
|
then
|
2017-03-08 15:39:40 -08:00
|
|
|
set DATAMAN_OPT -i
|
2017-02-14 10:42:30 -08:00
|
|
|
fi
|
2017-01-08 17:54:41 -08:00
|
|
|
if ver hwcmp AEROCORE2
|
|
|
|
|
then
|
|
|
|
|
set DATAMAN_OPT "-f /fs/mtd_dataman"
|
|
|
|
|
fi
|
2014-11-15 16:19:51 +01:00
|
|
|
# waypoint storage
|
2015-02-14 20:33:20 +01:00
|
|
|
# REBOOTWORK this needs to start in parallel
|
2017-02-14 10:42:30 -08:00
|
|
|
if dataman start $DATAMAN_OPT
|
2014-08-11 14:54:18 +02:00
|
|
|
then
|
|
|
|
|
fi
|
2017-02-14 10:42:30 -08:00
|
|
|
unset DATAMAN_OPT
|
2014-06-30 12:42:26 +02:00
|
|
|
|
2015-03-08 14:55:51 +01:00
|
|
|
#
|
|
|
|
|
# Sensors System (start before Commander so Preflight checks are properly run)
|
2017-09-20 00:04:23 -04:00
|
|
|
# commander Needs to be this early for in-air-restarts
|
|
|
|
|
if param compare SYS_HITL 1
|
2017-03-03 17:40:02 +01:00
|
|
|
then
|
2017-09-20 00:04:23 -04:00
|
|
|
set OUTPUT_MODE hil
|
2017-05-05 15:20:49 +02:00
|
|
|
sensors start -h
|
2017-09-20 00:04:23 -04:00
|
|
|
commander start --hil
|
2017-03-03 17:40:02 +01:00
|
|
|
else
|
2017-06-14 13:30:20 -10:00
|
|
|
if ver hwcmp PX4_SAME70XPLAINED_V1
|
|
|
|
|
then
|
|
|
|
|
gps start -d /dev/ttyS2
|
|
|
|
|
else
|
|
|
|
|
gps start
|
|
|
|
|
fi
|
2017-03-03 17:40:02 +01:00
|
|
|
sh /etc/init.d/rc.sensors
|
2017-09-20 00:04:23 -04:00
|
|
|
commander start
|
2017-03-03 17:40:02 +01:00
|
|
|
fi
|
2017-09-20 00:04:23 -04:00
|
|
|
send_event start
|
2016-04-29 14:27:16 +02:00
|
|
|
load_mon start
|
|
|
|
|
|
2015-10-28 22:55:37 +01:00
|
|
|
#
|
|
|
|
|
# Check if UAVCAN is enabled, default to it for ESCs
|
|
|
|
|
#
|
|
|
|
|
if param greater UAVCAN_ENABLE 2
|
|
|
|
|
then
|
|
|
|
|
set OUTPUT_MODE uavcan_esc
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-17 08:53:04 -10:00
|
|
|
# Sensors on the PWM interface bank
|
|
|
|
|
if param compare SENS_EN_LL40LS 1
|
2017-04-23 22:53:33 +03:00
|
|
|
then
|
2017-09-17 08:53:04 -10:00
|
|
|
# clear pins 5 and 6
|
|
|
|
|
set FMU_MODE pwm4
|
|
|
|
|
set AUX_MODE pwm4
|
|
|
|
|
fi
|
|
|
|
|
if param greater TRIG_MODE 0
|
|
|
|
|
then
|
|
|
|
|
# We ONLY support trigger on pins 5 and 6 when simultanously using AUX for actuator output
|
|
|
|
|
if param compare TRIG_PINS 56
|
2017-04-03 18:06:46 +02:00
|
|
|
then
|
|
|
|
|
# clear pins 5 and 6
|
|
|
|
|
set FMU_MODE pwm4
|
|
|
|
|
set AUX_MODE pwm4
|
2017-09-17 08:53:04 -10:00
|
|
|
else
|
|
|
|
|
set FMU_MODE none
|
|
|
|
|
set AUX_MODE none
|
2017-04-03 18:06:46 +02:00
|
|
|
fi
|
2017-09-17 08:53:04 -10:00
|
|
|
camera_trigger start
|
2017-05-08 12:08:53 +02:00
|
|
|
|
2017-09-17 08:53:04 -10:00
|
|
|
param set CAM_FBACK_MODE 1
|
|
|
|
|
camera_feedback start
|
2016-10-28 17:19:42 +02:00
|
|
|
fi
|
|
|
|
|
|
2014-01-18 16:47:23 +01:00
|
|
|
# If OUTPUT_MODE == none then something is wrong with setup and we shouldn't try to enable output
|
|
|
|
|
if [ $OUTPUT_MODE != none ]
|
2013-08-28 15:50:06 +02:00
|
|
|
then
|
2014-07-07 02:31:05 +04:00
|
|
|
if [ $OUTPUT_MODE == uavcan_esc ]
|
2014-05-08 14:23:33 +02:00
|
|
|
then
|
2014-08-23 17:23:59 +04:00
|
|
|
if param compare UAVCAN_ENABLE 0
|
2014-05-08 14:23:33 +02:00
|
|
|
then
|
2016-11-15 16:36:36 +01:00
|
|
|
param set UAVCAN_ENABLE 3
|
2014-05-08 14:23:33 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2014-07-07 02:31:05 +04:00
|
|
|
if [ $OUTPUT_MODE == io -o $OUTPUT_MODE == uavcan_esc ]
|
2014-01-10 13:18:34 +01:00
|
|
|
then
|
2014-01-11 17:52:29 +01:00
|
|
|
if px4io start
|
|
|
|
|
then
|
|
|
|
|
sh /etc/init.d/rc.io
|
|
|
|
|
else
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "PX4IO start failed" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-11 17:52:29 +01:00
|
|
|
fi
|
|
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2017-09-20 00:04:23 -04:00
|
|
|
if [ $OUTPUT_MODE == fmu ]
|
2014-01-11 17:52:29 +01:00
|
|
|
then
|
2017-07-18 16:52:26 +02:00
|
|
|
if fmu mode_$FMU_MODE $FMU_ARGS
|
2014-01-11 17:52:29 +01:00
|
|
|
then
|
|
|
|
|
else
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "FMU start failed" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-11 17:52:29 +01:00
|
|
|
fi
|
2014-01-08 20:55:12 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-18 16:47:23 +01:00
|
|
|
if [ $OUTPUT_MODE == mkblctrl ]
|
|
|
|
|
then
|
|
|
|
|
set MKBLCTRL_ARG ""
|
2015-02-16 22:06:17 +01:00
|
|
|
if [ $MKBLCTRL_MODE == x ]
|
2014-01-18 16:47:23 +01:00
|
|
|
then
|
|
|
|
|
set MKBLCTRL_ARG "-mkmode x"
|
|
|
|
|
fi
|
2015-02-16 22:06:17 +01:00
|
|
|
if [ $MKBLCTRL_MODE == + ]
|
2014-01-18 16:47:23 +01:00
|
|
|
then
|
|
|
|
|
set MKBLCTRL_ARG "-mkmode +"
|
|
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-18 16:47:23 +01:00
|
|
|
if mkblctrl $MKBLCTRL_ARG
|
|
|
|
|
then
|
|
|
|
|
else
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-18 16:47:23 +01:00
|
|
|
fi
|
2015-01-08 15:42:25 +01:00
|
|
|
unset MKBLCTRL_ARG
|
2014-03-31 10:10:50 +04:00
|
|
|
fi
|
2015-01-08 15:42:25 +01:00
|
|
|
unset MK_MODE
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-18 16:47:23 +01:00
|
|
|
if [ $OUTPUT_MODE == hil ]
|
|
|
|
|
then
|
2018-03-04 11:00:40 -05:00
|
|
|
if pwm_out_sim start
|
2014-01-18 16:47:23 +01:00
|
|
|
then
|
|
|
|
|
else
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-18 16:47:23 +01:00
|
|
|
fi
|
|
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-18 16:47:23 +01:00
|
|
|
#
|
|
|
|
|
# Start IO or FMU for RC PPM input if needed
|
|
|
|
|
#
|
|
|
|
|
if [ $IO_PRESENT == yes ]
|
|
|
|
|
then
|
|
|
|
|
if [ $OUTPUT_MODE != io ]
|
|
|
|
|
then
|
|
|
|
|
if px4io start
|
|
|
|
|
then
|
|
|
|
|
sh /etc/init.d/rc.io
|
|
|
|
|
else
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "PX4IO start failed" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-18 16:47:23 +01:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
else
|
2017-09-20 00:04:23 -04:00
|
|
|
if [ $OUTPUT_MODE != fmu ]
|
2014-01-18 16:47:23 +01:00
|
|
|
then
|
2017-07-18 16:52:26 +02:00
|
|
|
if fmu mode_${FMU_MODE} $FMU_ARGS
|
2014-01-18 16:47:23 +01:00
|
|
|
then
|
|
|
|
|
else
|
2016-12-23 09:06:49 +01:00
|
|
|
echo "FMU mode_${FMU_MODE} start failed" >> $LOG_FILE
|
2017-06-20 15:23:20 +02:00
|
|
|
tune_control play -m ${TUNE_ERR}
|
2014-01-18 16:47:23 +01:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2013-09-25 02:17:06 +09:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-11-17 14:58:29 +01:00
|
|
|
if [ $MAVLINK_F == default ]
|
2013-08-25 19:27:11 +02:00
|
|
|
then
|
2014-04-22 01:23:55 +02:00
|
|
|
# Normal mode, use baudrate 57600 (default) and data rate 1000 bytes/s
|
2017-09-20 00:04:23 -04:00
|
|
|
set MAVLINK_F "-r 1200 -f"
|
2014-04-22 01:23:55 +02:00
|
|
|
|
2018-01-18 08:46:34 +01:00
|
|
|
# Use ttyS1 for MAVLink on FMUv4 in addition to ttyS0 (debug)
|
2017-09-20 00:04:23 -04:00
|
|
|
if ver hwcmp PX4FMU_V4
|
|
|
|
|
then
|
|
|
|
|
set MAVLINK_F "-r 1200 -d /dev/ttyS1"
|
|
|
|
|
# Start MAVLink on Wifi (ESP8266 port)
|
2017-10-11 08:46:29 +02:00
|
|
|
mavlink start -r 20000 -b 921600 -d /dev/ttyS0
|
2017-09-20 00:04:23 -04:00
|
|
|
fi
|
2016-11-10 21:38:41 -02:00
|
|
|
|
2018-03-05 17:29:52 +01:00
|
|
|
# Use ttyS3 (TELEM4) for MAVLink on FMUv5 in addition to ttyS1 (TELEM1) and ttyS2 (TELEM2)
|
|
|
|
|
if ver hwcmp PX4FMU_V5
|
|
|
|
|
then
|
|
|
|
|
mavlink start -r 2000 -b 57600 -d /dev/ttyS3
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-20 00:04:23 -04:00
|
|
|
if ver hwcmp AEROFC_V1
|
|
|
|
|
then
|
2018-02-06 17:55:03 -08:00
|
|
|
set MAVLINK_F "-r 1200 -d /dev/ttyS3"
|
|
|
|
|
|
|
|
|
|
# Only start mavlink if the Benewake TFMini or LeddarOne isn't being used
|
2018-01-31 09:14:34 +01:00
|
|
|
if param greater SENS_EN_TFMINI 0
|
|
|
|
|
then
|
|
|
|
|
set MAVLINK_F none
|
2018-02-06 17:55:03 -08:00
|
|
|
fi
|
|
|
|
|
if param greater SENS_EN_LEDDAR1 0
|
|
|
|
|
then
|
|
|
|
|
set MAVLINK_F none
|
2018-01-31 09:14:34 +01:00
|
|
|
fi
|
2014-01-10 13:18:34 +01:00
|
|
|
fi
|
2016-09-11 21:41:51 -04:00
|
|
|
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
if ver hwcmp CRAZYFLIE OMNIBUS_F4SD
|
2016-09-11 21:41:51 -04:00
|
|
|
then
|
|
|
|
|
# Avoid using either of the two available serials
|
|
|
|
|
set MAVLINK_F none
|
|
|
|
|
fi
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
fi
|
2014-03-01 16:43:04 +04:00
|
|
|
|
2016-10-19 14:21:14 +02:00
|
|
|
if [ "x$MAVLINK_F" == xnone ]
|
2016-09-11 21:41:51 -04:00
|
|
|
then
|
|
|
|
|
else
|
2016-12-23 09:06:49 +01:00
|
|
|
mavlink start ${MAVLINK_F}
|
2016-09-11 21:41:51 -04:00
|
|
|
fi
|
2014-11-17 14:58:29 +01:00
|
|
|
unset MAVLINK_F
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-08-13 18:47:07 +02:00
|
|
|
#
|
|
|
|
|
# MAVLink onboard / TELEM2
|
|
|
|
|
#
|
2017-08-10 08:31:54 -10:00
|
|
|
# XXX We need a better way for runtime eval of shell variables,
|
|
|
|
|
# but this works for now
|
|
|
|
|
if param compare SYS_COMPANION 10
|
2014-08-21 14:30:17 +02:00
|
|
|
then
|
2017-08-10 08:31:54 -10:00
|
|
|
frsky_telemetry start -d ${MAVLINK_COMPANION_DEVICE}
|
2018-02-05 13:05:42 +01:00
|
|
|
else
|
|
|
|
|
if ver hwcmp PX4FMU_V4 PX4FMU_V4PRO MINDPX_V2
|
|
|
|
|
then
|
2018-02-08 14:48:49 +01:00
|
|
|
# This is TELEM4 on Pixhawk 3 Pro
|
2018-02-05 13:05:42 +01:00
|
|
|
frsky_telemetry start -d /dev/ttyS6
|
|
|
|
|
fi
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
2018-02-05 13:05:42 +01:00
|
|
|
|
2017-08-10 08:31:54 -10:00
|
|
|
if param compare SYS_COMPANION 20
|
|
|
|
|
then
|
|
|
|
|
syslink start
|
|
|
|
|
mavlink start -d /dev/bridge0 -b 57600 -m osd -r 40000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 921600
|
|
|
|
|
then
|
2017-11-21 14:14:13 +05:30
|
|
|
if ver hwcmp AEROFC_V1
|
|
|
|
|
then
|
|
|
|
|
if protocol_splitter start ${MAVLINK_COMPANION_DEVICE}
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d /dev/mavlink -b 921600 -m onboard -r 5000 -x
|
2017-12-01 16:43:11 +05:30
|
|
|
micrortps_client start -d /dev/rtps -b 921600 -l -1 -s 2000
|
2017-11-21 14:14:13 +05:30
|
|
|
else
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 921600 -m onboard -r 80000 -x -f
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 921600 -m onboard -r 80000 -x -f
|
|
|
|
|
fi
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 57600
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -m onboard -r 5000 -x -f
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 460800
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 460800 -m onboard -r 5000 -x -f
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 157600
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -m osd -r 1000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 257600
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -m magic -r 5000 -x -f
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 319200
|
|
|
|
|
then
|
2017-12-10 01:45:47 +01:00
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 19200 -r 1000 -f
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 338400
|
|
|
|
|
then
|
2017-12-10 01:45:47 +01:00
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 38400 -r 1000 -f
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 357600
|
|
|
|
|
then
|
2017-12-10 01:45:47 +01:00
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -r 1000 -f
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 3115200
|
|
|
|
|
then
|
2017-12-10 01:45:47 +01:00
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 115200 -r 1000 -f
|
2017-08-10 08:31:54 -10:00
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 419200
|
|
|
|
|
then
|
2018-03-04 17:50:28 -05:00
|
|
|
iridiumsbd start -d ${MAVLINK_COMPANION_DEVICE}
|
2017-08-10 08:31:54 -10:00
|
|
|
mavlink start -d /dev/iridium -b 19200 -m iridium -r 10
|
|
|
|
|
fi
|
2018-03-04 17:50:28 -05:00
|
|
|
if param compare SYS_COMPANION 519200
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 19200 -m minimal -r 1000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 538400
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 38400 -m minimal -r 1000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 557600
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -m minimal -r 1000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 5115200
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 115200 -m minimal -r 1000
|
|
|
|
|
fi
|
2017-08-10 08:31:54 -10:00
|
|
|
if param compare SYS_COMPANION 1921600
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 921600 -r 20000
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_COMPANION 1500000
|
|
|
|
|
then
|
|
|
|
|
mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 1500000 -m onboard -r 10000 -x -f
|
2016-03-12 12:50:14 +08:00
|
|
|
fi
|
|
|
|
|
|
2016-11-10 21:35:17 -02:00
|
|
|
unset MAVLINK_COMPANION_DEVICE
|
2016-10-28 17:19:42 +02:00
|
|
|
|
2015-10-03 13:50:07 +03:00
|
|
|
#
|
2016-03-28 14:48:14 +02:00
|
|
|
# Starting stuff according to UAVCAN_ENABLE value
|
2015-10-03 13:50:07 +03:00
|
|
|
#
|
2016-03-28 14:48:14 +02:00
|
|
|
if param greater UAVCAN_ENABLE 0
|
|
|
|
|
then
|
2018-02-21 01:23:20 -05:00
|
|
|
# Start core UAVCAN module
|
2016-12-18 11:24:11 +01:00
|
|
|
if uavcan start
|
2016-03-28 14:48:14 +02:00
|
|
|
then
|
2018-02-21 01:23:20 -05:00
|
|
|
if param greater UAVCAN_ENABLE 1
|
|
|
|
|
then
|
|
|
|
|
# Reduce logger buffer to free up some RAM for UAVCAN servers
|
|
|
|
|
set LOGGER_BUF 6
|
|
|
|
|
# Start UAVCAN firmware update server and dynamic node ID allocation server
|
|
|
|
|
uavcan start fw
|
|
|
|
|
fi
|
2016-03-28 14:48:14 +02:00
|
|
|
else
|
2016-12-23 09:06:49 +01:00
|
|
|
tone_alarm ${TUNE_ERR}
|
2016-03-28 14:48:14 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
2015-10-03 13:50:07 +03:00
|
|
|
|
Initial omnibusf4sd target support
Flight tested: ekf2 w/ mag and compass by @nathantsoi: https://logs.px4.io/plot_app?log=79b81031-cf1e-41f0-890b-d6cd7d559766
NOTE: external I2C devices need a pullup. I have tested with a 3.3v 2.2k pullup.
Working:
- mpu6000, bench tested and verified via nsh
- fmu
- all 6 ch output bench tested w/ pwm and oneshot via nsh
- ppm input bench tested
- dsm input bench tested
- bmp280, bench tested and verified via nsh
- hmc5883, bench tested and verified via nsh, but requires an external i2c pullup
- gps on uart6
- startuplog, nsh, mavlink on uart4, but params are not sent for some reason. RSSI pin is TX, MOTOR 5 is RX (normal mode, 57600 baud)
- rgbled over i2c, bench tested and workingp
- sbus via the shared sbus/ppm pin (which includes an inverter to the mcu SBUS in pin), remove the solder bridge or jumper to the ppm pin before use
Not yet implemented:
- ADC
- OSD: passthrough video is untested, use at your own risk until a basic driver is implemented.
2018-03-27 19:01:20 -07:00
|
|
|
if ver hwcmp PX4FMU_V2 PX4FMU_V4 PX4FMU_V4PRO MINDPX_V2 PX4FMU_V5 OMNIBUS_F4SD
|
2016-04-14 18:14:22 -04:00
|
|
|
then
|
|
|
|
|
# Check for flow sensor - as it is a background task, launch it last
|
|
|
|
|
px4flow start &
|
|
|
|
|
fi
|
|
|
|
|
|
2017-02-22 16:13:51 -08:00
|
|
|
if ver hwcmp AEROFC_V1
|
|
|
|
|
then
|
2017-09-20 00:04:23 -04:00
|
|
|
# don't start mavlink ttyACM0 on aerofc_v1
|
2017-02-22 16:13:51 -08:00
|
|
|
else
|
|
|
|
|
# Start MAVLink
|
|
|
|
|
mavlink start -r 800000 -d /dev/ttyACM0 -m config -x
|
|
|
|
|
fi
|
2016-04-14 18:14:22 -04:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
#
|
|
|
|
|
# Fixed wing setup
|
|
|
|
|
#
|
|
|
|
|
if [ $VEHICLE_TYPE == fw ]
|
2013-09-29 19:00:12 +02:00
|
|
|
then
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $MIXER == none ]
|
2014-01-08 20:55:12 +01:00
|
|
|
then
|
2014-01-15 00:02:57 +01:00
|
|
|
# Set default mixer for fixed wing if not defined
|
2015-01-07 00:25:06 +02:00
|
|
|
set MIXER AERT
|
2014-01-08 20:55:12 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
|
|
|
|
# Use MAV_TYPE = 1 (fixed wing) if not defined
|
|
|
|
|
set MAV_TYPE 1
|
|
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2016-12-23 09:06:49 +01:00
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
# Load mixer and configure outputs
|
2014-01-15 00:02:57 +01:00
|
|
|
sh /etc/init.d/rc.interface
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
# Start standard fixedwing apps
|
2016-03-28 14:48:14 +02:00
|
|
|
sh /etc/init.d/rc.fw_apps
|
2013-09-29 19:00:12 +02:00
|
|
|
fi
|
2013-09-07 12:17:27 +02:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
#
|
|
|
|
|
# Multicopters setup
|
|
|
|
|
#
|
|
|
|
|
if [ $VEHICLE_TYPE == mc ]
|
2013-12-28 08:56:58 +01:00
|
|
|
then
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $MIXER == none ]
|
2014-01-10 13:18:34 +01:00
|
|
|
then
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "Mixer undefined"
|
2014-01-15 00:02:57 +01:00
|
|
|
fi
|
2013-12-28 14:45:29 +01:00
|
|
|
|
2014-01-15 00:02:57 +01:00
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
|
|
|
|
# Use mixer to detect vehicle type
|
2015-01-07 00:25:06 +02:00
|
|
|
if [ $MIXER == quad_x -o $MIXER == quad_+ ]
|
2014-02-10 15:12:32 +01:00
|
|
|
then
|
|
|
|
|
set MAV_TYPE 2
|
|
|
|
|
fi
|
2016-12-18 01:46:59 +01:00
|
|
|
if [ $MIXER == quad_w -o $MIXER == quad_dc ]
|
2014-02-10 15:12:32 +01:00
|
|
|
then
|
|
|
|
|
set MAV_TYPE 2
|
|
|
|
|
fi
|
2016-02-15 15:58:01 +01:00
|
|
|
if [ $MIXER == quad_h ]
|
|
|
|
|
then
|
|
|
|
|
set MAV_TYPE 2
|
|
|
|
|
fi
|
2015-02-05 23:23:41 -08:00
|
|
|
if [ $MIXER == tri_y_yaw- -o $MIXER == tri_y_yaw+ ]
|
|
|
|
|
then
|
2015-08-01 09:49:53 +02:00
|
|
|
set MAV_TYPE 15
|
2015-02-05 23:23:41 -08:00
|
|
|
fi
|
2015-01-07 00:25:06 +02:00
|
|
|
if [ $MIXER == hexa_x -o $MIXER == hexa_+ ]
|
2014-02-11 15:35:26 +01:00
|
|
|
then
|
2014-02-11 08:09:51 +01:00
|
|
|
set MAV_TYPE 13
|
|
|
|
|
fi
|
2015-01-07 00:25:06 +02:00
|
|
|
if [ $MIXER == hexa_cox ]
|
2014-01-15 00:02:57 +01:00
|
|
|
then
|
2014-01-19 10:45:38 +01:00
|
|
|
set MAV_TYPE 13
|
2014-01-15 00:02:57 +01:00
|
|
|
fi
|
2015-01-07 00:25:06 +02:00
|
|
|
if [ $MIXER == octo_x -o $MIXER == octo_+ ]
|
2014-01-15 00:02:57 +01:00
|
|
|
then
|
2014-01-19 10:45:38 +01:00
|
|
|
set MAV_TYPE 14
|
2014-01-15 00:02:57 +01:00
|
|
|
fi
|
2016-01-03 22:05:56 +01:00
|
|
|
if [ $MIXER == octo_cox -o $MIXER == octo_cox_w ]
|
2014-01-15 00:02:57 +01:00
|
|
|
then
|
2014-01-19 10:45:38 +01:00
|
|
|
set MAV_TYPE 14
|
2014-01-15 00:02:57 +01:00
|
|
|
fi
|
2016-05-20 10:06:04 +02:00
|
|
|
if [ $MIXER == coax ]
|
|
|
|
|
then
|
|
|
|
|
set MAV_TYPE 3
|
|
|
|
|
fi
|
2014-01-10 13:18:34 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-02-10 15:12:32 +01:00
|
|
|
# Still no MAV_TYPE found
|
|
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
2015-08-01 09:49:53 +02:00
|
|
|
param set MAV_TYPE 2
|
2014-02-10 15:12:32 +01:00
|
|
|
else
|
2016-12-23 09:06:49 +01:00
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2014-02-10 15:12:32 +01:00
|
|
|
fi
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
# Load mixer and configure outputs
|
2014-01-15 00:02:57 +01:00
|
|
|
sh /etc/init.d/rc.interface
|
2014-06-01 10:59:11 +02:00
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
# Start standard multicopter apps
|
2016-03-28 14:48:14 +02:00
|
|
|
sh /etc/init.d/rc.mc_apps
|
2013-09-07 12:17:27 +02:00
|
|
|
fi
|
2013-12-01 07:57:22 +11:00
|
|
|
|
2014-12-02 10:30:26 +01:00
|
|
|
#
|
|
|
|
|
# VTOL setup
|
|
|
|
|
#
|
|
|
|
|
if [ $VEHICLE_TYPE == vtol ]
|
|
|
|
|
then
|
|
|
|
|
if [ $MIXER == none ]
|
|
|
|
|
then
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "VTOL mixer undefined"
|
2014-12-02 10:30:26 +01:00
|
|
|
fi
|
2013-12-01 07:57:22 +11:00
|
|
|
|
2014-12-02 10:30:26 +01:00
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
|
|
|
|
# Use mixer to detect vehicle type
|
2015-01-07 00:25:06 +02:00
|
|
|
if [ $MIXER == caipirinha_vtol ]
|
2014-12-02 10:30:26 +01:00
|
|
|
then
|
2014-12-02 11:02:23 +01:00
|
|
|
set MAV_TYPE 19
|
2014-12-02 10:30:26 +01:00
|
|
|
fi
|
2015-04-20 17:09:09 +02:00
|
|
|
if [ $MIXER == firefly6 ]
|
2015-01-05 20:52:18 +01:00
|
|
|
then
|
|
|
|
|
set MAV_TYPE 21
|
|
|
|
|
fi
|
2015-08-05 18:03:44 +02:00
|
|
|
if [ $MIXER == quad_x_pusher_vtol ]
|
|
|
|
|
then
|
|
|
|
|
set MAV_TYPE 22
|
|
|
|
|
fi
|
2014-12-02 10:30:26 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Still no MAV_TYPE found
|
|
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "Unknown MAV_TYPE"
|
2015-08-01 09:49:53 +02:00
|
|
|
param set MAV_TYPE 19
|
2014-12-02 10:30:26 +01:00
|
|
|
else
|
2016-12-23 09:06:49 +01:00
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2014-12-02 10:30:26 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Load mixer and configure outputs
|
|
|
|
|
sh /etc/init.d/rc.interface
|
|
|
|
|
|
|
|
|
|
# Start standard vtol apps
|
2016-03-28 14:48:14 +02:00
|
|
|
sh /etc/init.d/rc.vtol_apps
|
2014-12-02 10:30:26 +01:00
|
|
|
fi
|
2015-02-19 21:50:54 +01:00
|
|
|
|
|
|
|
|
#
|
2017-06-06 19:26:51 +02:00
|
|
|
# UGV setup
|
2015-02-19 21:50:54 +01:00
|
|
|
#
|
2017-06-06 19:26:51 +02:00
|
|
|
if [ $VEHICLE_TYPE == ugv ]
|
2015-02-20 14:43:28 +01:00
|
|
|
then
|
2017-06-06 19:26:51 +02:00
|
|
|
if [ $MIXER == none ]
|
|
|
|
|
then
|
|
|
|
|
# Set default mixer for UGV if not defined
|
2017-09-25 11:17:50 -04:00
|
|
|
set MIXER ugv_generic
|
2017-06-06 19:26:51 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ $MAV_TYPE == none ]
|
|
|
|
|
then
|
|
|
|
|
# Use MAV_TYPE = 10 (UGV) if not defined
|
|
|
|
|
set MAV_TYPE 10
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
param set MAV_TYPE ${MAV_TYPE}
|
2015-02-19 21:50:54 +01:00
|
|
|
|
|
|
|
|
# Load mixer and configure outputs
|
|
|
|
|
sh /etc/init.d/rc.interface
|
|
|
|
|
|
2017-06-06 19:26:51 +02:00
|
|
|
# Start standard UGV apps
|
2017-09-25 11:17:50 -04:00
|
|
|
sh /etc/init.d/rc.ugv_apps
|
2015-02-19 21:50:54 +01:00
|
|
|
fi
|
|
|
|
|
|
2015-01-08 15:42:25 +01:00
|
|
|
unset MIXER
|
|
|
|
|
unset MAV_TYPE
|
|
|
|
|
unset OUTPUT_MODE
|
2014-12-15 22:47:10 +01:00
|
|
|
|
2014-05-13 08:03:01 +02:00
|
|
|
#
|
|
|
|
|
# Start the navigator
|
|
|
|
|
#
|
|
|
|
|
navigator start
|
|
|
|
|
|
2014-01-10 23:14:29 +01:00
|
|
|
#
|
|
|
|
|
# Generic setup (autostart ID not found)
|
|
|
|
|
#
|
|
|
|
|
if [ $VEHICLE_TYPE == none ]
|
2013-08-25 19:33:36 +02:00
|
|
|
then
|
2016-09-04 20:55:03 +02:00
|
|
|
echo "No autostart ID found"
|
2017-09-20 00:04:23 -04:00
|
|
|
ekf2 start
|
2013-08-25 19:33:36 +02:00
|
|
|
fi
|
2014-01-10 23:14:29 +01:00
|
|
|
|
|
|
|
|
# Start any custom addons
|
2015-01-08 15:42:25 +01:00
|
|
|
set FEXTRAS /fs/microsd/etc/extras.txt
|
2014-11-17 14:58:29 +01:00
|
|
|
if [ -f $FEXTRAS ]
|
2013-08-25 19:27:11 +02:00
|
|
|
then
|
2016-12-23 09:06:49 +01:00
|
|
|
echo "Addons script: ${FEXTRAS}"
|
2014-11-17 14:58:29 +01:00
|
|
|
sh $FEXTRAS
|
2013-08-22 09:25:13 +02:00
|
|
|
fi
|
2014-11-17 14:58:29 +01:00
|
|
|
unset FEXTRAS
|
2013-09-03 08:17:22 +02:00
|
|
|
|
2016-09-11 22:06:10 -04:00
|
|
|
if ver hwcmp CRAZYFLIE
|
2014-12-15 15:34:19 +01:00
|
|
|
then
|
2016-09-11 22:06:10 -04:00
|
|
|
# CF2 shouldn't have an sd card
|
|
|
|
|
else
|
|
|
|
|
|
2017-01-08 17:54:41 -08:00
|
|
|
if ver hwcmp AEROCORE2
|
2016-09-11 22:06:10 -04:00
|
|
|
then
|
2017-01-08 17:54:41 -08:00
|
|
|
# AEROCORE2 shouldn't have an sd card
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
# Run no SD alarm
|
|
|
|
|
if [ $LOG_FILE == /dev/null ]
|
|
|
|
|
then
|
|
|
|
|
# Play SOS
|
|
|
|
|
tone_alarm error
|
|
|
|
|
fi
|
|
|
|
|
|
2016-09-11 22:06:10 -04:00
|
|
|
fi
|
|
|
|
|
|
2016-09-17 12:10:14 -04:00
|
|
|
fi
|
2013-12-28 22:18:07 +01:00
|
|
|
|
2017-02-02 20:34:15 +11:00
|
|
|
#
|
|
|
|
|
# Check if we should start a thermal calibration
|
|
|
|
|
# TODO move further up and don't start unnecessary services if we are calibrating
|
|
|
|
|
#
|
2017-02-02 15:42:09 +01:00
|
|
|
set TEMP_CALIB_ARGS ""
|
2017-02-02 20:34:15 +11:00
|
|
|
if param compare SYS_CAL_GYRO 1
|
|
|
|
|
then
|
2017-02-02 15:42:09 +01:00
|
|
|
set TEMP_CALIB_ARGS "${TEMP_CALIB_ARGS} -g"
|
2017-02-02 20:34:15 +11:00
|
|
|
param set SYS_CAL_GYRO 0
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_CAL_ACCEL 1
|
|
|
|
|
then
|
2017-02-02 15:42:09 +01:00
|
|
|
set TEMP_CALIB_ARGS "${TEMP_CALIB_ARGS} -a"
|
2017-02-02 20:34:15 +11:00
|
|
|
param set SYS_CAL_ACCEL 0
|
|
|
|
|
fi
|
|
|
|
|
if param compare SYS_CAL_BARO 1
|
|
|
|
|
then
|
2017-02-02 15:42:09 +01:00
|
|
|
set TEMP_CALIB_ARGS "${TEMP_CALIB_ARGS} -b"
|
2017-02-02 20:34:15 +11:00
|
|
|
param set SYS_CAL_BARO 0
|
|
|
|
|
fi
|
2017-02-02 15:42:09 +01:00
|
|
|
if [ "x$TEMP_CALIB_ARGS" != "x" ]
|
|
|
|
|
then
|
|
|
|
|
send_event temperature_calibration ${TEMP_CALIB_ARGS}
|
|
|
|
|
fi
|
|
|
|
|
unset TEMP_CALIB_ARGS
|
2017-02-02 20:34:15 +11:00
|
|
|
|
2017-04-12 10:26:41 +02:00
|
|
|
# vmount to control mounts such as gimbals, disabled by default.
|
|
|
|
|
if param compare MNT_MODE_IN -1
|
|
|
|
|
then
|
|
|
|
|
else
|
2017-04-20 07:33:24 +02:00
|
|
|
if vmount start
|
|
|
|
|
then
|
|
|
|
|
fi
|
2017-04-12 10:26:41 +02:00
|
|
|
fi
|
|
|
|
|
|
2018-02-17 11:14:46 -05:00
|
|
|
sh /etc/init.d/rc.logging
|
|
|
|
|
|
2015-08-08 00:10:01 +02:00
|
|
|
# End of autostart
|
|
|
|
|
fi
|
2015-07-22 10:04:13 +02:00
|
|
|
|
2015-08-10 22:26:09 +02:00
|
|
|
# There is no further script processing, so we can free some RAM
|
|
|
|
|
# XXX potentially unset all script variables.
|
|
|
|
|
unset TUNE_ERR
|
|
|
|
|
|
2015-08-08 00:10:01 +02:00
|
|
|
# Boot is complete, inform MAVLink app(s) that the system is now fully up and running
|
|
|
|
|
mavlink boot_complete
|