Skip to content

Commit

Permalink
Merge pull request #705 from helenol/helen_ardrone
Browse files Browse the repository at this point in the history
Ardrone startup script
  • Loading branch information
LorenzMeier committed Mar 6, 2014
2 parents 36ba60d + 25faf1b commit 3207450
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 9 deletions.
35 changes: 35 additions & 0 deletions ROMFS/px4fmu_common/init.d/4008_ardrone
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!nsh
#
# ARDrone
#

echo "[init] 4008_ardrone: PX4FMU on PX4IOAR carrier board"

# Just use the default multicopter settings.
sh /etc/init.d/rc.mc_defaults

#
# Load default params for this platform
#
if [ $DO_AUTOCONFIG == yes ]
then
# Set all params here, then disable autoconfig
param set MC_ROLL_P 5.0
param set MC_ROLLRATE_P 0.13
param set MC_ROLLRATE_I 0.0
param set MC_ROLLRATE_D 0.0
param set MC_PITCH_P 5.0
param set MC_PITCHRATE_P 0.13
param set MC_PITCHRATE_I 0.0
param set MC_PITCHRATE_D 0.0
param set MC_YAW_P 1.0
param set MC_YAW_D 0.1
param set MC_YAWRATE_P 0.15
param set MC_YAWRATE_I 0.0
param set MC_YAWRATE_D 0.0
param set MC_YAW_FF 0.15
fi

set OUTPUT_MODE ardrone
set USE_IO no
set MIXER skip
9 changes: 9 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.autostart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ then
sh /etc/init.d/4001_quad_x
fi

#
# ARDrone
#

if param compare SYS_AUTOSTART 4008 8
then
sh /etc/init.d/4008_ardrone
fi

if param compare SYS_AUTOSTART 4010 10
then
sh /etc/init.d/4010_dji_f330
Expand Down
9 changes: 6 additions & 3 deletions ROMFS/px4fmu_common/init.d/rc.interface
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Script to configure control interface
#

if [ $MIXER != none ]
if [ $MIXER != none -a $MIXER != skip]
then
#
# Load mixer
Expand Down Expand Up @@ -33,8 +33,11 @@ then
tone_alarm $TUNE_OUT_ERROR
fi
else
echo "[init] Mixer not defined"
tone_alarm $TUNE_OUT_ERROR
if [ $MIXER != skip ]
then
echo "[init] Mixer not defined"
tone_alarm $TUNE_OUT_ERROR
fi
fi

if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ]
Expand Down
23 changes: 18 additions & 5 deletions ROMFS/px4fmu_common/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ then
fi
fi

if [ $OUTPUT_MODE == ardrone ]
then
set FMU_MODE gpio_serial
fi

if [ $HIL == yes ]
then
set OUTPUT_MODE hil
Expand Down Expand Up @@ -277,9 +282,9 @@ then
tone_alarm $TUNE_OUT_ERROR
fi
fi
if [ $OUTPUT_MODE == fmu ]
if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE = ardrone ]
then
echo "[init] Use FMU PWM as primary output"
echo "[init] Use FMU as primary output"
if fmu mode_$FMU_MODE
then
echo "[init] FMU mode_$FMU_MODE started"
Expand All @@ -294,7 +299,7 @@ then
then
set TTYS1_BUSY yes
fi
if [ $FMU_MODE == pwm_gpio ]
if [ $FMU_MODE == pwm_gpio -o $OUTPUT_MODE == ardrone ]
then
set TTYS1_BUSY yes
fi
Expand Down Expand Up @@ -351,7 +356,7 @@ then
fi
fi
else
if [ $OUTPUT_MODE != fmu ]
if [ $OUTPUT_MODE != fmu -a $OUTPUT_MODE != ardrone ]
then
if fmu mode_$FMU_MODE
then
Expand All @@ -367,7 +372,7 @@ then
then
set TTYS1_BUSY yes
fi
if [ $FMU_MODE == pwm_gpio ]
if [ $FMU_MODE == pwm_gpio -o $OUTPUT_MODE == ardrone ]
then
set TTYS1_BUSY yes
fi
Expand Down Expand Up @@ -427,6 +432,14 @@ then
gps start
fi

#
# Start up ARDrone Motor interface
#
if [ $OUTPUT_MODE == ardrone ]
then
ardrone_interface start -d /dev/ttyS1
fi

#
# Fixed wing setup
#
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/px4fmu/fmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ fmu_main(int argc, char *argv[])
}


fprintf(stderr, "FMU: unrecognised command, try:\n");
fprintf(stderr, "FMU: unrecognised command %s, try:\n", verb);
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
fprintf(stderr, " mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio, test\n");
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
Expand Down

0 comments on commit 3207450

Please sign in to comment.