px4开机加载文件.doc
文本预览下载声明
modules/PX4Firmware/Build/px4fmu-v2_APM.build/romfs_scratch/init.d/rc.APM
此文件里边指出了启动顺序,在系统启动的时候会被调用,用来初始化整个系统,包括软硬件。
ArduCopter 作为nsh的一个内建命令被开机自动启动。
set deviceA /dev/ttyACM0
if [ -f /fs/microsd/APM ]
then
echo APM file found - renaming
mv /fs/microsd/APM /fs/microsd/APM.old
fi
if [ -f /fs/microsd/APM/nostart ]
then
echo APM/nostart found - skipping APM startup
sh /etc/init.d/rc.error
fi
if [ -f /bin/reboot ]
then
echo binfs already mounted
else
echo Mounting binfs
if mount -t binfs /dev/null /bin
then
echo binfs mounted OK
else
sh /etc/init.d/rc.error
fi
fi
set sketch NONE
if rm /fs/microsd/APM/boot.log
then
echo removed old boot.log
fi
set logfile /fs/microsd/APM/BOOT.LOG
if [ ! -f /bin/ArduPilot ]
then
echo /bin/ardupilot not found
sh /etc/init.d/rc.error
fi
if mkdir /fs/microsd/APM /dev/null
then
echo Created APM directory
fi
if [ -f /bin/px4io ]
then
if [ -f /bin/lsm303d ]
then
echo Detected FMUv2 board
set BOARD FMUv2
else
echo Detected FMUv1 board
set BOARD FMUv1
fi
else
echo Detected FMUv4 board
set BOARD FMUv4
fi
if [ $BOARD == FMUv1 ]
then
set deviceC /dev/ttyS2
if [ -f /fs/microsd/APM/AUXPWM.en ]
then
set deviceD /dev/null
else
set deviceD /dev/ttyS1
fi
else
set deviceC /dev/ttyS1
set deviceD /dev/ttyS2
fi
if uorb start
then
echo uorb started OK
else
sh /etc/init.d/rc.error
fi
if [ -f /fs/microsd/APM/mkblctrl ]
then
echo Setting up mkblctrl driver
echo Setting up mkblctrl driver $logfile
mkblctrl -d /dev/pwm_output
fi
if [ -f /fs/microsd/APM/mkblctrl_+ ]
then
echo Setting up mkblctrl driver +
echo Setting up mkblctrl driver + $logfile
mkblctrl -mkmode + -d /dev/pwm_output
fi
if [ -f /fs/microsd/APM/mkblctrl_x ]
then
echo Setting up mkblctrl driver x
echo Setting up mkblctrl driver x $logfile
mkblctrl -mkmode x -d /dev/pwm_output
fi
if [ -f /bin/px4io ]
显示全部