Advertisement
Tempist

Satellite GPS Interface [Build]

Sep 25th, 2019
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.12 KB | None | 0 0
  1. # Uses N/D for double integration of accelerometer data
  2.  
  3. # The DNN system will be integrated into the aircraft
  4. # computer system along with the INS. It is constantly # updated based on outcomes of the trained model and it # also learns new trails and provide navigational
  5. # routes
  6.  
  7. # The DNN is a feed-forward connectionist model built
  8. # out of successive pairs of convolutional and
  9. # maxpooling layers, followed by several fully
  10. # connected layers. One of the advantages of DNNs over # common alternatives for supervised image
  11. # classification is generality
  12.  
  13. # Using KBNS Method for the estimator corrector
  14. # mechanism, leads to the optimal estimation of
  15. # linearized system and measurement system model.
  16.  
  17. # Conclusion: This focuses on Y-Axis change along with devaluing
  18.  
  19. # Twitter: @yawnalf
  20.  
  21. import time
  22. import serial
  23. import string
  24. import pynmea2
  25. import RPi GPIO as gpio
  26. #to add the LCD library
  27. import Adafruit_CharLCD as LCD
  28.  
  29. gpio.setmode(gpio.BCM)
  30.  
  31. #declaring LCD pins
  32. lcd_rs = 17
  33. lcd_en = 18
  34. lcd_d4 = 27
  35. lcd_d5 = 22
  36. lcd_d6 = 23
  37. lcd_d7 = 10
  38.  
  39. lcd_backlight = 2
  40.  
  41. lcd_columns = 16 #Lcd column
  42. lcd_rows = 2 #number of LCD rows
  43.  
  44. lcd = LCD.Adafruit_CharLCD(lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
  45.  
  46. port = "/dev/ttyAMA0" # the serial port to which the pi is connected.
  47.  
  48. #create a serial object
  49. ser = serial.Serial(port, baudrate = 9600, timeout = 0.5)
  50.  
  51. while 1:
  52.     try:
  53.         data = ser.readline()
  54.     except:
  55. print("loading")
  56. #wait for the serial port to churn out data
  57.  
  58.     if data[0:6] == '$GPGGA': # the long and lat data are always contained in the GPGGA string of the NMEA data
  59.  
  60.         msg = pynmea2.parse(data)
  61.  
  62. #parse the latitude and print
  63.         latval = msg.lat
  64. concatlat = "lat:" + str(latval)
  65.         print concatlat
  66. lcd.set_cursor(0,0)
  67. lcd.message(concatlat)
  68.  
  69. #parse the longitude and print
  70. longval = msg.lon
  71. concatlong = "long:"+ str(longval)
  72. print concatlong
  73. lcd.set_cursor(0,1)
  74. lcd.message(concatlong)
  75.            
  76.     time.sleep(0.5)#wait a little before picking the next data.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement