Shop OBEX P1 Docs P2 Docs Learn Events
Nav using GPS and the Prop: What to Expect? - Page 2 — Parallax Forums

Nav using GPS and the Prop: What to Expect?

2»

Comments

  • PerryPerry Posts: 253
    edited 2009-03-15 17:20
    Ken

    take a look of my old OSD project, it shows distance and heading to waypoints without floating arithmetic

    http://forums.parallax.com/showthread.php?p=721220

    there is a video on YoutTube www.youtube.com/watch?v=OG0eXO5hV6M

    Perry
  • Rob_WRob_W Posts: 32
    edited 2012-01-21 05:15
    I got the LCD, accelerometer, and compass working yesterday, but I can't get any serial data from the GPS in raw mode, and I can't seem to find an object on the object exchange for running the GPS in smart mode--?

    Dennis - This file has been returning good gps data from my old Parallax GPS the PMB 248 board for years, in both Smart Mode and Raw. I don't know if it works with the current Parallax GPS version or not, as I don't own one yet.

    Sorry I missed that you solved your problem with the tx/rx pins but the code has worked well with my gps unit.
  • Rob_WRob_W Posts: 32
    edited 2012-01-21 06:52
    After reviewing the above links to videos, I see the code came from Perry Mole and Paul Hubner versions of OSD a number of years back. I couldn't recall who was the originators, so I modified the GPS_IO_mini to work with my GPS as I didn't have an Etrex GPS, Thank you Paul and Perry, now I can't wait to try your updated code :)
    I must add that I had driven back and forth to work many times, with the OSD code running my GPS unit. I compared my Iphone gps to your code by looking at my Iphone position versus where I was actually at and found the Parallax GPS was more accurate than my Iphone position. Plus the Iphone would loose a gps lock more often than the PMB-248 would, This I did in Jacksonville, Florida over a 3 year period using the latitude and longitude points of my home and those of published lat/lons of local airports.
    You guys are fantastic, I focused on this code for years, which has been my "Electron Therapy" since my first wife passed. It gave me something to do, which helped keep my sanity. You can't imagine how much this community helped me. :):)
  • HughHugh Posts: 362
    edited 2012-01-21 08:21
    I've found all the GPS (NMEA string handling) and navigation calculations I've ever needed within the GPS Float object in the Obex... :smile:
  • davidpzkdavidpzk Posts: 19
    edited 2013-05-27 19:52
    Can someone help point me in the correct direction? Im trying to get two know coordinates to spit out the correct result for a compass heading.

    Im using Chuck Rice's GPS utilities.

    For testing I am using Chuck Rice's example coordinates.

    test case: Distance between 29 42.8428'N 095 45.1912'W and 29 40.4946'N 095 30.8299'W is 14.6344 statute miles

    I confirm with google earth the distance is 14.6 miles. However the GPS utilities comes up with a result of 14.65 miles. Not a big concern. I think this is within a good margin of error.

    The concern arrises when the bearing between the two points comes back with a float bearing of 1071705555 which using a float to string conversion comes back with heading of 1.757258 which is very wrong. The actual heading according to google earth shold be somewhere around 100 degrees or 280 degrees if you are traveling in the opposite direction.

    Here is my code...
    con
      _clkmode = xtal1 + pll16x '
      _xinfreq = 5_000_000 '
     
    obj
      Serial : "pcFullDuplexSerial4FC128" '1 COG for 4 serial ports
      GPSu : "GPSutilities"
      fs : "FloatString"
    '  f32 : "Float32Full"
    
    PUB Boot
      waitcnt (10000000+cnt) 
      Serial.AddPort(1,31,30,Serial#PINNOTUSED,Serial#PINNOTUSED,Serial#PINNOTUSED,%000000,57600)
      Serial.Start 
      waitcnt (200000000+cnt)
      Serial.str(1, String(16))
      waitcnt (1000+cnt) 
      Serial.str(1, String(13, "Cog ID is: "))
      waitcnt (10000+cnt) 
      Serial.dec(1, cogid)
      Serial.str(1, String(13))
      Serial.str(1, String("Compass Calcs REV A",13))     
      waitcnt (10000000+cnt)
      calcTestDirAndBearing
     
    pub calcTestDirAndBearing | latRads1,lonrads1,latRads2,lonrads2,distance,bearing
            
      GPSu.init
      latRads1 := GPSu.convert2Radians(string("N"),string("2942.8428"))'(GPS.N_S,GPS.latitude)            'returns floating point radians
      lonRads1 := GPSu.convert2Radians(string("W"),string("09545.1912"))'(GPS.E_W,GPS.longitude)           'returns floating point radians
      latRads2 := GPSu.convert2Radians(string("N"),string("2940.4946")) 'returns floating point radians
      lonRads2 := GPSu.convert2Radians(string("W"),string("09530.8299")) 'returns floating point radians
      
        Serial.str(1, String("RAW FLOAT latRads1: "))
        Serial.dec(1, latRads1)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING latRads1: "))
        Serial.str (1, fs.FloatToString(latRads1))
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("RAW FLOAT lonRads1: "))
        Serial.dec(1, lonRads1)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING lonRads1: "))
        Serial.str (1, fs.FloatToString(lonRads1))
        Serial.str(1, String(" ", 13))
        
        Serial.str(1, String("RAW FLOAT latRads2: "))
        Serial.dec(1, latRads2)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING latRads2: "))
        Serial.str (1, fs.FloatToString(latRads2))
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("RAW FLOAT lonRads2: "))
        Serial.dec(1, lonRads2)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING lonRads2: "))
        Serial.str (1, fs.FloatToString(lonRads2))
        Serial.str(1, String(" ", 13))
      distance := GPSu.calcHaversineDistance(latRads1,lonRads1,latRads2,lonRads2)
        Serial.str(1, String("RAW FLOAT distance: "))
        Serial.dec(1, distance)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING distance: "))
        Serial.str (1, fs.FloatToString(distance))
        Serial.str(1, String(" ", 13))
      bearing  := GPSu.calculateBearing(latRads1,lonRads1,latRads2,lonRads2,distance)
        Serial.str(1, String("RAW FLOAT bearing: "))
        Serial.dec(1, bearing)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING bearing: "))
        Serial.str (1, fs.FloatToString(bearing))
        Serial.str(1, String(" ", 13))
    
        bearing := GPSu.calculateBearing2(latRads1,lonRads1, latRads2, lonRads2) 
        Serial.str(1, String("CALCULATE WITH NEW FORMULA  (BEARING2): ", 13))
        Serial.str(1, String("RAW FLOAT bearing: "))
        Serial.dec(1, bearing)
        Serial.str(1, String(" ", 13))
        Serial.str(1, String("STRING bearing: "))
        Serial.str (1, fs.FloatToString(bearing))
        Serial.str(1, String(" ", 13))
    
  • kuronekokuroneko Posts: 3,623
    edited 2013-05-27 19:58
    davidpzk wrote: »
    The concern arrises when the bearing between the two points comes back with a float bearing of 1071705555 which using a float to string conversion comes back with heading of 1.757258 which is very wrong. The actual heading according to google earth shold be somewhere around 100 degrees or 280 degrees if you are traveling in the opposite direction.
    100 degrees are about 1.745 radians. Does that ring a bell?
  • davidpzkdavidpzk Posts: 19
    edited 2013-05-27 20:34
    Of course... I should have known. I jumped to conclusion that the result was in degrees. I didnt think to check to see if the result was returning in radians.
Sign In or Register to comment.