12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/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"
- mv /ramfs/$DATE.jpg ~/_Pictures
- echo "Picz $DATE.jpg saved to SDCARD"
- echo "$DATE.jpg" > /ramfs/.canbeconvert
- echo "Sleeping... zzzZZZzzZZZzzz..."
- }
- raspistill -o /ramfs/$DATE.jpg
- #if [ $? -eq 0 ]; then
- acquire
- #else
- # echo "Command failed"
- #fi
- #
|