Results 1 to 3 of 3

Thread: Getting GPS data in enhanced scripts

  1. #1
    Potential Tuner
    Join Date
    May 2017
    Posts
    8

    Getting GPS data in enhanced scripts

    Hi,

    I am trying to use GPS data (lat/long) in enhanced scripts. I seem to be able to get other other (Num Sats, Speed etc) but the latitude and longitude remain static. I am getting the data from a .vbo which I know is good and the track map displays fine but I don't seem to be able to pull the data to work on.

    Foreground code.
    Code:
    // Should be Latitude
    DrawNumber(GetDataValue(2), 1, 400, 0, NumberColor, FontSize, AlignH_Right);
    
    // Should be Longtitude
    DrawNumber(GetDataValue(3), 1, 400, 0, NumberColor, FontSize, AlignH_Right);
    (yes i know I have hardcoded the data value locations).

    This is the first line of the .vbo after the general header info
    Code:
    [column names]
    sats time lat long velocity heading height vert-vel dgps Freq Voltage_1 Brake Voltage_3 Voltage_4 ComboG RPM avifileindex avitime 
    
    [data]
    008 134441.10 003267.29451 000093.38338 016.010 170.88 +00110.14 -000.03 000 +6.30271E+01 +4.96226E-02 +4.60831E+00 +5.46214E-02 +4.88925E-02 +1.81420E-01 +1.78052E+03 0016 -00000001
    The display just remains at 54.5 and -1.6.

    I am using RR3.5.8b Ultimate.
    Last edited by benfjo; 07-06-2017 at 01:02 PM.

  2. #2
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    Looks like it's actually working, but the difference is that the latitude and longitude are converted into decimal degrees when the data file is loaded...

    003267.29451 / 60 = 54.45490 (rounds to 54.5 when displaying to 1 decimal place)
    000093.38338 / -60 = -1.556389 (rounds to -1.6 when displaying to 1 decimal place)

    To display the full coordinates, I'd normally use 6 or 7 decimal places, so something like this:

    Code:
    // Should be Latitude
    DrawNumber(GetDataValue(2), 7, 400, 0, NumberColor, FontSize, AlignH_Right);
    
    // Should be Longtitude
    DrawNumber(GetDataValue(3), 7, 400, 0, NumberColor, FontSize, AlignH_Right);
    Note that the second parameter for DrawNumber() is now 7 instead of 1.

  3. #3
    Potential Tuner
    Join Date
    May 2017
    Posts
    8
    Sorted. Thanks