Results 1 to 7 of 7

Thread: gps like an odometer

  1. #1
    Low Bitrate
    Join Date
    May 2006
    Location
    Agueda
    Posts
    58

    gps like an odometer

    Hi

    I like make some like an odometer with GPS but I have some problems.

    on my GPS I have for example: time and speed and I know witch distance = speed*time.

    my problem stay on speed, because it don't is an constant, some one have an ideia to implement this?

    best regards

  2. #2
    What can I say? I like serial. Curiosity's Avatar
    Join Date
    Mar 2004
    Location
    Florence Yall, BFKY
    Posts
    2,684
    Try this:

    currentTime = GetCurrentTime()

    diff = currentTime - lastTime

    avgSpeed = (speed + lastSpeed) / 2

    dist = time * avgSpeed

    lastSpeed = speed
    lastTime = currentTime

  3. #3
    Maximum Bitrate
    Auto Apps:loading...
    _Dejan_'s Avatar
    Join Date
    Jul 2007
    Location
    Slovenia
    Posts
    569
    you can calculate distance from two point's for example each second you calculate distance from current point(longitude&latitude) and point which you use one second before...

  4. #4
    Raw Wave
    Join Date
    Nov 2009
    Posts
    2,116
    Yeah - I was gonna say (CurrentDistance - LastDistance) / (CurrentTime - LastTime) is the average speed (in that time period).

    And for average velocity (for the displacement minded) = (CurrentLatitudeLongitude - LastLatitudeLongitude) / (CurrentTime - LastTime); but you'll have to work out the distance between the Lat-Longs (straight line between the two) - probably easiest in Nautical the convert to miles or km (Wiki?).

    And I'm not using any GPSspeak; just descriptives. And - = minus; / = divide.

  5. #5
    What can I say? I like serial. Curiosity's Avatar
    Join Date
    Mar 2004
    Location
    Florence Yall, BFKY
    Posts
    2,684
    No need for time, but adding distances between points has it's advantages and disadvantages. The GPS will give positions every second, but you can always reject a new point and keep your reference point to increment your odometer later. Rejecting spurious values will be the fun part.

    The Earth is a big Pi LOL so it's not all that simple.

    Theta = (pointA.Long - pointB.Long)

    ToRad = 0.01745566

    DistRad = acos( ( sin( pointA.Lat * ToRad ) * sin( pointB.Lat * ToRad ) ) +
    ( cos(pointA.Lat * ToRad ) * cos( pointB.Lat * ToRad ) * cos(Theta * ToRad )) )

    NautMi = DistRad * 57.2881 * 60.0

    KM = NautMi * 1.852
    Mi = NautMi * 1.151

  6. #6
    Raw Wave
    Join Date
    Nov 2009
    Posts
    2,116
    Bingo! I see the "cumulative" addition of distances (or is that successive... arrghh!).
    I was thinking more of uPC etc programming where you might store initial, then store last whenever, and subtract. But that's from a speedo cable etc - not a GPS.

    And keep those calcs away from me! I remember those damned ionosphere or strato calcs with heights and deviations from spherical to provide accurate bounce angles so we could figure out if the target was on Burlington or Dixie. I mean like 3,000km was its official range and this was what - 6 times that?? Damned refractions and abnormalities.... (LOL!!)

  7. #7
    Low Bitrate
    Join Date
    May 2006
    Location
    Agueda
    Posts
    58
    Hi

    thanks for all opinions...

    I think some like Curiosity write on 1 reply, but with 4 seconds and 4 speed regist.

    I will try make this project with an PIC (18f252).

    I think witch don't need use Latitude and Longitude to calculate distance, this is much complex and I don't know if my MCU have memory to this

    best regards, and one more time thank.

Similar Threads

  1. How to setup iGuidance GPS for RoadRunner
    By MatrixPC in forum RR FAQ
    Replies: 31
    Last Post: 05-22-2009, 08:29 AM
  2. Anyone's Infill G4 GPS not resuming from hibernation? Pls help!
    By Carz in forum Mp3Car Infill G4 - Double Din Car Computer
    Replies: 19
    Last Post: 03-31-2009, 05:22 PM
  3. Replies: 3
    Last Post: 08-10-2007, 04:03 PM
  4. few gps questions
    By fuctup in forum GPS
    Replies: 2
    Last Post: 03-02-2005, 01:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •