Go Down

Topic: GPS : distance, speed, slope, orientation. (Read 333 times) previous topic - next topic

neutrinos

Hello,

Sorry, I'm very bad in English (thanks google translation) and it's worse for math.
I have several questions that are related, so I write them at the same topic.

At first I only had 2 questions:

  • 1)   How can I calculate the displacement direction of a displacement, like a compass (magnetic)?
  • 2)   How to calculate the slope in% or the degree of inclination of a displacement?


Reflecting to understand how to make these calculations, I got to have other questions:


When you are on a mountain road:

  • 3)   For the calculation of the distance to be covered, does the GPS do it for a flat terrain or does it take into account the relief?
  • 4)   For the calculation of the distance already traveled without a defined path, does the GPS do it for a flat terrain or does it take into account the relief?
  • 5)   The GPS gives a speed, is it for a flat ground or according to the relief?
  • 6)   I know that the GPS time is very precise (thank you Einstein and its relativity laws), but what is the influence of GPS's localization accuracy (lon, lat, alt) on calculations?



My questions can also be interesting for the flight

Thank you

pylon

The GPS gives you a position, nothing else. Usually you get spherical coordinates. So the calculation of all the values you mentioned is just a bit of vector math. What distances your GPS returns depends on the type/model you use. You didn't tell us yet. Often this information is not available from the manufacturer so you simply have to try and calculate yourself the correct values.

knut_ny

most GPSs also calculates speed (knots) and returns it in the $GPRMA-sentence
Ny

PaulS

Quote
4)   For the calculation of the distance already traveled without a defined path, does the GPS do it for a flat terrain or does it take into account the relief?
The GPS was there. Now it is here. The distance is a straight line value, because a straight line is the shortest distance between two points.
The art of getting good answers lies in asking good questions.

neutrinos

The GPS gives you a position, nothing else. Usually you get spherical coordinates. So the calculation of all the values you mentioned is just a bit of vector math. What distances your GPS returns depends on the type/model you use. You didn't tell us yet. Often this information is not available from the manufacturer so you simply have to try and calculate yourself the correct values.
I have a GPS Garmin Nuvi 200 and it give me a lot of informations.

I am playing with arduino UNO, tft screen 2,4 and NEO6MV2.
Except for the calculation of itineraries from one city to another and the management of POIs, I try to get the same informations that gives me my GPS Garmin Nuvi 200.

With NMEA sentence I have longitude, latitude, altitude, date and time.
I have a doubt about the speed, because even motionless it varies up to 15km/h without change in longitude, latitude, altitude.
Now, when I move, I want calculate, speed, direction (0° N,90° E,180° S, 270° W)  like a compass, slope in %, distance traveled...

As you said, the calculations of all the values I want are just a bit of vector math. But ... except 1 + 2 = 3, I am very bad with math !
This is why I ask for your help. When I was young I do not go long time to school.

neutrinos

    The GPS was there. Now it is here. The distance is a straight line value, because a straight line is the shortest distance between two points.
    The art of giving good answers also includes understanding the questions.

    • 4)   For the calculation of the distance already traveled without a defined path, does the GPS do it for a flat terrain or does it take into account the relief?

    [/list]

    mybrain_iq55

    Maybe this can help you ...
    http://www.edwilliams.org/avform.htm


    The GPS was there. Now it is here. The distance is a straight line value, because a straight line is the shortest distance between two points.
    Are you stupid to answer so ?

    PaulS

    #7
    Aug 10, 2017, 02:13 pm Last Edit: Aug 10, 2017, 02:13 pm by PaulS
    Quote
    The art of giving good answers also includes understanding the questions.
    The GPS gives you the distance between the current point and the previous point. How can that be anything other than a straight line?

    If the current point is at the bottom of a shear cliff, and the previous point was at the top, just before you fell off, you don't really expect the GPS to tell you how far apart the two points are, when projected onto the sphere that approximates the earth's shape, do you? It's going to tell you how far you fell before you broke your neck.
    The art of getting good answers lies in asking good questions.

    -dev

    Quote
    1)   How can I calculate the displacement direction of a displacement, like a compass (magnetic)?
      float bearing = fix.location.BearingToDegrees( previousFix.location );

    This is not a magnetic bearing; it is a true North bearing (degrees CW from North).

    Quote
    2)   How to calculate the slope in% or the degree of inclination of a displacement?
      float displacement = fix.location.DistanceKm( previousFix.location ) * 1000.0; // to meters
      float rise         = fix.altitude() - previousFix.altitude();                  // meters
      float inclination  = atan2( rise, displacement ) * RADIANS_TO_DEGREES;

    Quote
    3)   For the calculation of the distance to be covered, does the GPS do it for a flat terrain or does it take into account the relief?
    GPS devices do not know the "distance to be covered."  That is a function provided by application software.  If you are referring to smartphone apps or Trimble/Garmin GPS systems (with displays and input keys), that function is not part of the GPS receiver.  Those devices have their own MCU (e.g., like an Arduino) for controlling the display, processing inputs, storing waypoints, accessing installed map data and receiving NMEA data from the internal GPS receiver.  Those applications could use straight line calculations, spherical calculations, or they may have a database of streets used to calculate a car's travel distance.  They may or may not know terrain elevations.

    Quote
    4)   For the calculation of the distance already traveled without a defined path, does the GPS do it for a flat terrain or does it take into account the relief?
    Most GPS devices do not calculate distance traveled.  Some ublox GPS devices implement an odometer function.  They do not know "the relief" any better than the calculated navigation solution.  The calculated distance traveled will depend on the calculation rate, the various filter parameters in effect and the quality of reception.

    Quote
    5)   The GPS gives a speed, is it for a flat ground or according to the relief?
    As I said before, the GPS device does not know "relief".  It does know previous altitude and current altitude.  To calculate speed, a GPS device can use the previous position (location + altitude) and/or doppler shift of satellite signals.  The speed can also be affected by filter parameters.  For example, ublox allows specifying a "platform model" that helps limit the calculations to "reasonable" values for different platforms: stationary, pedestrian, automotive or aircraft.

    The calculated speed can be reported to the "host" (i.e., the Arduino) in several different NMEA sentences (RMC & VTG) or UBX messages (NAV-VELNED).

    Quote
    6)   I know that the GPS time is very precise (thank you Einstein and its relativity laws), but what is the influence of GPS's localization accuracy (lon, lat, alt) on calculations?
    The GST sentence provides lat, lon and altitude error estimates in cm.  This sentence is not available on all devices.

    Quote
    I am very bad with math !
    Then you won't enjoy writing geodetic calculations.  Find a library that does this for you and use it.  (I know one.)

    Quote
    The art of giving good answers also includes understanding the questions.
    There are many things that you obviously don't know:

    *  True North is different from Magnetic North;

    *  A Garmin GPS system is much more than a GPS receiver;

    *  Some GPS libraries provide distance and bearing calculation functions;

    *  PaulS' "getting good answers" is his signature, not a comment directed specifically at you.

    Sometimes your questions are The XY Problem, so our responses may be trying to get to the real question.  Your retorts will not help.  Just answer our questions and/or ask your next question.

    neutrinos

      float bearing = fix.location.BearingToDegrees( previousFix.location );


    This is not a magnetic bearing; it is a true North bearing (degrees CW from North).
      float displacement = fix.location.DistanceKm( previousFix.location ) * 1000.0; // to meters
      float rise         = fix.altitude() - previousFix.altitude();                  // meters
      float inclination  = atan2( rise, displacement ) * RADIANS_TO_DEGREES;


    Thank you again for your complete, clear and precise replies.
    For those who do not know you yet, it is from your bookstore (google translate, I said librairy). NeoGPS
    I know that my Garmin is a set of items, receiver, processor, program, database, maps, etc.
    If you know a bookstore (idem) for geodesic calculations I'm sure it's the best, given the wise advice you give.
    "The relief" is a google translate, to understand mountainous terrain.
    As lon, lat, in my request for direction or orientation, it was in this reference X Y and not for the magnetic field.
    I know there is a difference between several "North Pole" and they change, the Chandler Oscillation, the continental drift ...
    International Earth Rotation and Reference Systems Service (IERS) https://www.iers.org.



    Your retorts will not help.  Just answer our questions and/or ask your next question.
    I would not dwell on PaulS's signature for those who ask questions on the forum (including myself), and I share his point of view. However his response was not up to his demands.

    neutrinos

    Maybe this can help you ...
    http://www.edwilliams.org/avform.htm

    Are you stupid to answer so ?
    Thank you for your support.

    I understood that it would not be so simple (for me) to put it into my skecth.

    MarkT

    Hello,

    Sorry, I'm very bad in English (thanks google translation) and it's worse for math.
    I have several questions that are related, so I write them at the same topic.

    At first I only had 2 questions:

    • 1)   How can I calculate the displacement direction of a displacement, like a compass (magnetic)?

    atan2 (dy, dx), in maths, atan2 (de, dn) for eastings/northings
    Quote
    • 2)   How to calculate the slope in% or the degree of inclination of a displacement?

    100 * height_difference / distance.   Or alternatively  100 * dz / sqrt (dx^2 + dy^2)
    Quote
    Reflecting to understand how to make these calculations, I got to have other questions:


    When you are on a mountain road:

    • 3)   For the calculation of the distance to be covered, does the GPS do it for a flat terrain or does it take into account the relief?

    That probably depends on the GPS receiver in question.  Since altitude information typically has
    a much higher error I'd suggest only horizontal distance is used (that's how I'd do it).
    Quote
    • 4)   For the calculation of the distance already traveled without a defined path, does the GPS do it for a flat terrain or does it take into account the relief?

    same answer.
    Quote
    • 5)   The GPS gives a speed, is it for a flat ground or according to the relief?

    same answer.
    Quote
    • 6)   I know that the GPS time is very precise (thank you Einstein and its relativity laws), but what is the influence of GPS's localization accuracy (lon, lat, alt) on calculations?

    uncertainty in time = uncertainty in position / c, ie about one nanosecond per foot.
    Quote
    My questions can also be interesting for the flight

    Thank you
    [ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

    neutrinos

    atan2 (dy, dx), in maths, atan2 (de, dn) for eastings/northings
    What are dy and dx or de, dn ?
    I think I have previous(lon,lat) and next(lon,lat).

    By imagining a right-angled triangle whose hypothenus goes through previous(lon,lat) and next(lon,lat), should I calculate the angle of the previous(lon,lat) one so that the result is between 0 and 360, with 90 for East and 180 for South?


    Go Up