123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
- CONVERTLL_PATH="/home/pi/BallonSonde/convert_ll_dec.py"
- READ_NMEA_PATH="/home/pi/BallonSonde/read_nmea.py"
- echo "=> Acquisition on !"
- DATE=$(date +%y%m%d_%H%M%S)
- $READ_NMEA_PATH > /ramfs/.out
- acquire() {
- DATA=$(cat /ramfs/.out)
- NS=$(echo $DATA| tr ' ' '\n' | grep NS | cut -d'=' -f2 | cut -d',' -f1)
- EW=$(echo $DATA| tr ' ' '\n' | grep EW | cut -d'=' -f2 | cut -d',' -f1)
- LAT=$(echo $DATA| tr ' ' '\n' | grep 'lat=' | cut -d'=' -f2 | cut -d',' -f1)
- echo "Latitude $LAT"
- LATD=$($CONVERTLL_PATH $LAT | grep "d:" | cut -d':' -f2)
- LATM=$($CONVERTLL_PATH $LAT | grep "m:" | cut -d':' -f2)
- LATS=$($CONVERTLL_PATH $LAT | grep "s:" | cut -d':' -f2 | sed 's/\.//' )
- echo "$LATD $LATM $LATS"
- LON=$(echo $DATA| tr ' ' '\n' | grep 'lon=' | cut -d'=' -f2 | cut -d',' -f1)
- echo "Longitude : $LON"
- LOND=$($CONVERTLL_PATH $LON| grep "d:" | cut -d':' -f2)
- LONM=$($CONVERTLL_PATH $LON | grep "m:" | cut -d':' -f2)
- LONS=$($CONVERTLL_PATH $LON | grep "s:" | cut -d':' -f2 | sed 's/\.//')
- echo "$LOND $LONM $LONS"
- ALTITUDE=$(echo $DATA| tr ' ' '\n' | grep 'alt=' | cut -d'=' -f2 | cut -d',' -f1)
- echo "$ALTITUDE meters ! Wooo so hiiigh !"
- # Creation du script pour ajout des données Exif dans le JPG
- cat <<EOF > /ramfs/.conf_exif
- # Ajouter aux metadatas les informations de geolocalisation
- # 'add' pour ajouter les informations
- # 'set' pour remplacer celles déjà exisante
- # 'del' pour les supprimer (sans préciser de valeur)
- add Exif.GPSInfo.GPSLatitudeRef ${NS}
- add Exif.GPSInfo.GPSLatitude ${LATD}/1 ${LATM}/1 ${LATS}/10000
- add Exif.GPSInfo.GPSLongitudeRef ${EW}
- add Exif.GPSInfo.GPSLongitude ${LOND}/1 ${LONM}/1 ${LONS}/10000
- EOF
- echo $LAT
- if [ "$LAT" == "NO_DATA" ]; then
- echo "Don't have GPS datas, continue without these datas"
- else
- exiv2 -m /ramfs/.conf_exif /ramfs/$DATE.jpg
- exiftool -GPSAltitude=$ALTITUDE /ramfs/$DATE.jpg -overwrite_original
- fi
- echo "Picz $DATE.jpg saved in RAM"
- cp /ramfs/$DATE.jpg ~/_Pictures
- mv /ramfs/$DATE.jpg /ramfs/$DATE.jp_
- rm -rf /ramfs/*.jpg
- mv /ramfs/$DATE.jp_ /ramfs/$DATE.jpg
- echo "Picz $DATE.jpg saved to SDCARD"
- echo "$DATE.jpg" > /ramfs/.canbeconvert
- echo "Sleeping... zzzZZZzzZZZzzz..."
- sleep 5
- }
- raspistill -o /ramfs/$DATE.jpg
- if [ $? -eq 0 ]; then
- acquire
- else
- echo "Command failed"
- /home/pi/BallonSonde/tx_process/4_tx_file /home/pi/BallonSonde/sound/error_camera.wav
- fi
|