Andrew Tridgell
6 years ago
2 changed files with 70 additions and 8 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh |
||||
# this is a script triggered from GPIO changes. It is setup to take photos |
||||
# start/stop recording and start/stop streaming on a disco |
||||
|
||||
PIN="$1" |
||||
VALUE="$2" |
||||
echo "got pin=$PIN value=$VALUE" |
||||
|
||||
PATH=$PATH:/bin:/usr/bin:/data/ftp/internal_000/ardupilot |
||||
export PATH |
||||
|
||||
cd /data/ftp/internal_000/ardupilot |
||||
|
||||
if [ $PIN = 100 ]; then |
||||
# take photo when high |
||||
if [ $VALUE = 1 ]; then |
||||
echo "$(date) Taking picture" >> gpio.log |
||||
/usr/bin/pimpctl take-picture front |
||||
fi |
||||
fi |
||||
|
||||
if [ $PIN = 101 ]; then |
||||
# recording start/stop |
||||
if [ $VALUE = 1 ]; then |
||||
echo "$(date) Starting recording" >> gpio.log |
||||
/usr/bin/pimpctl recording-start front |
||||
else |
||||
echo "$(date) Stopping recording" >> gpio.log |
||||
/usr/bin/pimpctl recording-stop front |
||||
fi |
||||
fi |
||||
|
||||
if [ $PIN = 102 ]; then |
||||
GCS_IP=$(netstat -n|grep 14550 | head -1 | awk '{print $5}'| cut -d: -f1) |
||||
# streaming start/stop |
||||
if [ $VALUE = 1 ]; then |
||||
echo "$(date) Starting streaming to $GCS_IP 8888" >> gpio.log |
||||
/usr/bin/pimpctl stream-start front $GCS_IP 8888 |
||||
else |
||||
echo "$(date) Stopping streaming to $GCS_IP 8888" >> gpio.log |
||||
/usr/bin/pimpctl stream-stop front $GCS_IP 8888 |
||||
fi |
||||
fi |
@ -1,20 +1,39 @@
@@ -1,20 +1,39 @@
|
||||
#!/bin/sh |
||||
|
||||
cd /data/ftp/internal_000/APM |
||||
cd /data/ftp/internal_000/ardupilot |
||||
( |
||||
date |
||||
/bin/date |
||||
/bin/ls |
||||
|
||||
/bin/dragon_ipc.sh dragon_shutdown |
||||
/bin/sleep 2 |
||||
/usr/bin/killall -KILL dragon-prog |
||||
/bin/sleep 1 |
||||
|
||||
echo "step2" |
||||
# stop stock led daemon |
||||
pstop ledd |
||||
/usr/bin/pstop ledd |
||||
|
||||
# setup for video |
||||
/usr/bin/media-ctl -l '"mt9f002 0-0010":0->"avicam.0":0[1]' |
||||
/usr/bin/media-ctl -l '"avicam_dummy_dev.0":0->"avicam.0":0[0]' |
||||
/usr/bin/prestart dxowrapperd |
||||
/usr/bin/prestart pimp |
||||
|
||||
echo "step3" |
||||
|
||||
# startup fan |
||||
echo 1 > /sys/devices/platform/user_gpio/FAN/value |
||||
|
||||
|
||||
# setup GPS |
||||
echo 1 > /sys/devices/platform/user_gpio/RESET_GNSS/value |
||||
/bin/sleep 1 |
||||
echo 0 > /sys/devices/platform/user_gpio/RESET_GNSS/value |
||||
|
||||
echo "step4" |
||||
|
||||
while :; do |
||||
echo "$(date) Starting arduplane" |
||||
./arduplane -A udp:192.168.42.255:14550:bcast -B /dev/ttyPA1 -C udp:192.168.43.255:14550:bcast --module-directory modules |
||||
done |
||||
) >> start_ardupilot.log 2>&1 & |
||||
|
||||
|
||||
|
||||
) >> start_ardupilot.log 2>&1 |
||||
|
Loading…
Reference in new issue