Determining Steered Angle from Telemetry

Discussion in 'Automobilista 2 - General Discussion' started by GeekyDeaks, Apr 4, 2023.

  1. mrjiffy6

    mrjiffy6 Active Member AMS2 Club Member

    Joined:
    Oct 4, 2019
    Messages:
    117
    Likes Received:
    47
    Obviously i'm late to the party. Just stumbled on this post after a slight sim racing pause (I wish there was more than 24 hours in a day). I heard the conch and Le Mans was calling me.

    Kudos to @GeekyDeaks for this awesome work: all channels seems to be available (still to check), sector beacons and lap times & successive laps all working. Thank you for taking the time to do all this (time which obviously I could not find) ;)

    GPS map with car heading still not working but this is my worksheet that needs to be adjusted for AMS2 channels (my current worksheet was designed for richard burns rally).

    Finally AMS2 got MoTeC!!!

    EDIT: @BrunoB looks like you got your man :p Greetings from Quebec City
     
    Last edited: Nov 26, 2023
    • Like Like x 2
  2. Racinglegend1234

    Racinglegend1234 AMS2 wiki founder AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    5,493
    Likes Received:
    1,881
    I’ve tried this with my workbook, but I haven’t gotten it to work. Do you know what to do?
     
  3. BrunoB

    BrunoB TT mode tifosi BANNED

    Joined:
    Jun 13, 2020
    Messages:
    2,582
    Likes Received:
    651
    Yeah correct.
    Thank you.:D

    1.jpg
     
    • Friendly Friendly x 1
  4. mrjiffy6

    mrjiffy6 Active Member AMS2 Club Member

    Joined:
    Oct 4, 2019
    Messages:
    117
    Likes Received:
    47
    Sorry just recovered from a major power outage due to heavy snow, so couldn't access my files :( Fortunately outside weather is like inside a fridge so the CHEESE is okay :D

    First you have to make sure that the channels are correctly assigned in the GPS Track properties:

    upload_2023-11-27_18-24-41.png

    In this example the heading (Front Direction channel) is computed from RBR's yaw output from NGP Physics as follows (python code):
    Code:
    # Compute "Front Direction" aka "yaw"
    # Apply -pi to pi -> [0, 360] wrapping
    # Yaw seems offset by 90 degrees from the GPS heading
    ddf["Front Direction"] = ddf["yaw"].divide(3.1416 / 180).subtract(90).mod(360)
    I'll be checking in PCars2 format what can be used for the heading and i'll get back to you soon.

    For the GPS latitude / longitude, it is computed from NGP car cartesian position on map (X,Y) in meters relative to 0,0 (as far as I recall):

    Code:
    # Compute GPS lat/long
    ddf["GPS Latitude"] = ddf["position.y"].divide(111320)
    ddf["GPS Longitude"] = ddf["position.x"].divide(111320)
    I don't remember where the 111320 constants come from (bummer on me to not have included it in code comment), i'll check and get back as well.

    Here we don't really care about GPS absolute positions on the world map, we just want to be in GPS format, whatever relative position it is from.
     
    Last edited: Nov 27, 2023
    • Informative Informative x 1
  5. Racinglegend1234

    Racinglegend1234 AMS2 wiki founder AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    5,493
    Likes Received:
    1,881
    Thank you. If you can, can you PM me when you figure it out or need help?
     
  6. Matus Celko

    Matus Celko Active Member

    Joined:
    Jul 23, 2018
    Messages:
    110
    Likes Received:
    142
    In AMS 2, instead of position.y use position.z, y is the height. It should work. That's how I generate map in my app.
     
    • Informative Informative x 1
  7. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
  8. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
    mOrientation is in the shared memory. Docs suggest they are just angles around each axis. I'd need to have a play to see what order they are to determine which one is yaw and correctly map it. I might get some time over the weekend to do this.

    // Motion & Device Related
    float mOrientation[VEC_MAX]; // [ UNITS = Euler Angles ]
    float mLocalVelocity[VEC_MAX]; // [ UNITS = Metres per-second ]
     
  9. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    148
    Likes Received:
    55
    If you need the GPS coordinates for X and Z = 0 for every track (reference point):
    pcars-ds-liveview/RefPointDataAMS2.js at master · eckhchri/pcars-ds-liveview
    "refLat" and "refLong" are the coordinates for the 0 point there.
    I need it to show the cars on Google Maps for the project there.
    It is maybe not always perfect, but in most cases it works good enough.
    Some tracks also have a rotation offset to the real world, you can find it in the "rotation" variable.

    Here is a demo of the project:
    Project Cars - live view. (https://github.com/eckhchri/pcars-ds-liveview)
    Ignore the warnings, click on "Tracks" button, a table opens and then you can click on every track and it should jump to it in Google Maps.
     
    Last edited: Nov 28, 2023
    • Like Like x 1
    • Useful Useful x 1
  10. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
    Oh, nice!

    Out of curiosity, did you get this info from the game files? I tried looking for it in the track data but it was not immediately apparent. @Racinglegend1234 has provided me with an excel document with similar details, but the lat/longs are subtly different to your file and I also see you have a scaling tweak too.
     
  11. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    148
    Likes Received:
    55
    No, I recorded the position data of both track borders, created a trackmap, overlaid it to Google Maps and then fiddled with it until the trackmap was aligned with the satellite map.
    It would be interesting where @Racinglegend1234 gets the data from.
    The scaling tweaks are needed, because I use a simplyfied way to calculate the GPS coordinates.
     
    Last edited: Nov 29, 2023
    • Like Like x 1
  12. Racinglegend1234

    Racinglegend1234 AMS2 wiki founder AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    5,493
    Likes Received:
    1,881
  13. YOUNG IL YOON

    YOUNG IL YOON crossfieldz_ROK AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    667
    Likes Received:
    443
    simple, parse the track crd files.
     
  14. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
    hmm.... I'm not seeing any `.crd` files in the `.bff` archives for Brands Hatch that I unpacked. I'll have a look when I get back home tonight and see if there are any I missed.... but if you have any pointers to save me a bit of time that would be very much appreciated! :)
     
  15. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    148
    Likes Received:
    55
    The question is, if these coordinates are perfectly aligned with the reference point of each track where X and Z is zero. For my project I needed it as precisely as possible.
    Because I think the game needs the GPS coordinates only for the correct sun and night sky travel, weather data and maybe altitude. And 50m +/- to the reference point makes no difference in this case.

    @Racinglegend1234
    Is it possible to get access to your Excel sheet, then I could compare it with my data and maybe can say if the coordinates are aligned with the track reference point.
    If the data there is more precise as the coordinates I found then I could use it for my project. That would be great.
    Thanks in advance.
     
  16. YOUNG IL YOON

    YOUNG IL YOON crossfieldz_ROK AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    667
    Likes Received:
    443
    after apply contents manager, you can find them ;)
     
  17. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
    Yeah, I suspect you are correct and for MoTeC i2, it really needs to be pretty darn accurate as it uses the google maps API to overlay the vehicle position, I guess very similar to what you are doing. I was just playing around to see what was available from the game....
     
  18. Racinglegend1234

    Racinglegend1234 AMS2 wiki founder AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    5,493
    Likes Received:
    1,881
    @YOUNG IL YOON am I allowed?
     
    • Agree Agree x 1
  19. GeekyDeaks

    GeekyDeaks Member AMS2 Club Member

    Joined:
    Jan 17, 2022
    Messages:
    83
    Likes Received:
    47
    I think I am just being dumb here.... I already have CM installed but I still don't see any crd files:

    Code:
    C:\Steam\steamapps\common\Automobilista 2>dir /b/s *.crd
    File Not Found
    
    C:\Steam\steamapps\common\Automobilista 2>dir /b/s *.bff
    C:\Steam\steamapps\common\Automobilista 2\Pakfiles\BOOTFLOW.bff
    C:\Steam\steamapps\common\Automobilista 2\Pakfiles\BOOTPERSISTENT.bff
    When you say 'apply' do you mean I have to do something to the track files with CM? I'm remoting to my machine via ssh, so I'm a bit limited to what I can do right now, but I can check when I get back home
     
  20. YOUNG IL YOON

    YOUNG IL YOON crossfieldz_ROK AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    667
    Likes Received:
    443
    yes, apply some mods with CM.
     

Share This Page