TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker and becoming a Supporting Member. For more info: Support TMC
  1. TMC is currently READ ONLY.
    Click here for more info.

Tesla Autopilot maps

Discussion in 'Autopilot & Autonomous/FSD' started by verygreen, Nov 10, 2017.

  1. verygreen

    verygreen Curious member

    Joined:
    Jan 16, 2017
    Messages:
    2,897
    Location:
    TN
    So while we are waiting for HW2+ maps to actually materialize, here's something to ponder.

    Many of you have noticed already that the car seems to slow down in TACC and autosteer mode before curves. So I was researching how is speed limit determined (some people I asked were sure it was from Navigon maps, but I think evidence does not support it).

    Anyway lo and behold I found that there are "adas map tiles" thing the car pulls calculated on current coordinates. I am not really sure what is the format, but it at the very least contains various curvatures of the roads (used to calculate safe speeds for curves), but also is consisting of "branches". Branches have various properties like what road class is it, whenever the next branch exit is an offramp (to the left and right too), if the branch is itself a ramp, should autosteer be enabled, should autopark be restricted, is it a two way traffic branch, should "pedal misapplication mitigation" (?) be enabled, should radar braking be enabled, side collision assist enabled, length of this branch in meters, speed limit, speed limit units and some more cryptic stuff.

    It looks like there's also some code to feed some curve and other data back to mothership, but it's not clear if it needs to be separately enabled. Additionally there are multiple levels of this tile data - development, live, staging and staging2, Korea gets its own tiles for some reason.

    Anyway, if you want to experiment with format, grab your copy fast before Tesla closed this down (some random tile from around here): https://daws.tesla.services/iiNG2d6xFR1USl/dev/dnkk9.tile
     
    • Informative x 16
    • Helpful x 5
    • Like x 2
    • Love x 1
  2. mitchellh3

    mitchellh3 Member

    Joined:
    Nov 18, 2016
    Messages:
    162
    Location:
    Los Angeles, CA
    This very likely explains the behavior change that people says they experience with AS not taking highway exits and so on when it previously would. Also likely explains how Tesla has been addressing the phantom breaking issue...

    So the maps stuff you're seeing on the HW2+ APE is unrelated to this file format? Its something totally new?

    Interesting.
     
  3. Joel

    Joel Active Member

    Joined:
    Mar 24, 2011
    Messages:
    1,266
    Location:
    Michigan
    How do you view the tile?

    Also, Tesla implemented the tiles way back with AP1.0 on v7.1

    Firmware 7.1

     
    • Helpful x 1
    • Like x 1
  4. J1mbo

    J1mbo Active Member

    Joined:
    Aug 20, 2013
    Messages:
    1,565
    Location:
    UK
    Are these the same Tiles shown in the Autopilot Database tab (in debug)? Linking to your post from May with screenshots.
     
    • Helpful x 1
  5. verygreen

    verygreen Curious member

    Joined:
    Jan 16, 2017
    Messages:
    2,897
    Location:
    TN
    yes, same tiles. But now I actually know what's in there ;)

    Yes, adas tiles are by no means new. I know of no way of viewing the tile easily, I guess format is somewhat proprietary too, still with more people looking at them somebody might have some smart ideas.
     
  6. Joel

    Joel Active Member

    Joined:
    Mar 24, 2011
    Messages:
    1,266
    Location:
    Michigan
    Okay. I thought you just found it. How tough would it be to view it? Are my tiles downloaded to the car?


     
  7. lunitiks

    lunitiks Cool James & Black Teacher

    Joined:
    Nov 19, 2016
    Messages:
    2,698
    Location:
    Prawn Island, VC
    #7 lunitiks, Nov 10, 2017
    Last edited: Nov 10, 2017
  8. BigD0g

    BigD0g Active Member

    Joined:
    Jan 12, 2017
    Messages:
    2,019
    Location:
    Somewhere
    #8 BigD0g, Nov 11, 2017
    Last edited: Nov 11, 2017
    • Like x 4
  9. verygreen

    verygreen Curious member

    Joined:
    Jan 16, 2017
    Messages:
    2,897
    Location:
    TN
    There are just too many things called tiles ;) The google maps tiles, openstreetmap tiles, ....

    I have no idea what the adas tiles are based on, but it's not a tmx text format for sure. It looks like it could also list "features" called "furniture".

    The code that loads this whole thing is kind of twisted OOP stuff where it's not super easy to trace everything. The verification part has some text output so it's possible to get some rough high level idea about general data in the tile like how many branches and such there are
     
    • Helpful x 2
    • Informative x 1
  10. lunitiks

    lunitiks Cool James & Black Teacher

    Joined:
    Nov 19, 2016
    Messages:
    2,698
    Location:
    Prawn Island, VC
    So how does this tiles-thing work, are they downloaded to your car based on which country/city you're in? How often do they refresh? Are our cars uploading tiles? What's crackalackin?
     
  11. verygreen

    verygreen Curious member

    Joined:
    Jan 16, 2017
    Messages:
    2,897
    Location:
    TN
    the tiles are downloaded based on your location and also surroundign tiles too so you don't end up outside of the covered area accidentally.
    It hashes gps coordinates to arrive at the tile url.

    I don't think the car uploads tiles, but there's a curves log and upload that could be activated, I guess that's how they make new tiles then (or at least one of the ways)
     
    • Informative x 4
  12. BigD0g

    BigD0g Active Member

    Joined:
    Jan 12, 2017
    Messages:
    2,019
    Location:
    Somewhere
    I suspect it's OpenStreetMap based as that's what Vahalla appears to be based on. But, it looks like you can run your own server, with your own DB etc. so will take some work to reverse it. I think it's a vector based image with the information embedded perhaps.
     
    • Informative x 1
  13. scottf200

    scottf200 Active Member

    Joined:
    Feb 3, 2013
    Messages:
    3,759
    Location:
    Chicagoland ModelX S603
    #13 scottf200, Nov 11, 2017
    Last edited: Nov 11, 2017
    I have modest skills but played a little. Never heard of geohash before. :) File name dnkk9 geohash mapped to an area at the bottom of my post.

    Within the file there were 6 char geohashs. Used 'strings' util to pull 6 character stings from the 'tile' file. Found 56. Put a few of these in a geohash tool geohash.co (Geohash Converter) I found via a google search to get lat/long (col B in my sheet).

    56 geohash may end up being 42.448 miles by 21.224 miles if I did the math right from the 6 char geohash coverage via www.movable-type.co.uk/scripts/geohash.html (show/mentioned below)
    Also see GeoHash grid Aggregation | Elasticsearch Reference [5.6] | Elastic for coverage of a 6 char geohash.

    [​IMG]

    Used this tool to get 3x3 grid with 'dnkkdp' in the middle (see col D,E,F in my sheet).
    Color coded above to show some other surrounding ones that were in the output list from 'strings'.
    www.movable-type.co.uk/scripts/geohash.html
    (Geohash encoding/decoding)
    [​IMG]
    From site above: A geohash actually identifies a rectangular cell, each extra character identifies one of 32 sub-cells.

    The cell sizes of geohashes of different lengths are as follows; note that the cell width reduces moving away from the equator (to 0 at the poles):

    Length Cell width Cell height
    1 ≤ 5,000km × 5,000km
    2 ≤ 1,250km × 625km
    3 ≤ 156km × 156km
    4 ≤ 39.1km × 19.5km
    5 ≤ 4.89km × 4.89km
    6 ≤ 1.22km × 0.61km or 0.758 mi x 0.379 mi
    7 ≤ 153m × 153m
    8 ≤ 38.2m × 19.1m
    9 ≤ 4.77m × 4.77m
    10 ≤ 1.19m × 0.596m
    11 ≤ 149mm × 149mm
    12 ≤ 37.2mm × 18.6mm




    Put the coordinates for the ones I converted in www.darrinward.com/lat-long (Map Tool: Map Latitude Longitude Coordinates/Points - Google Maps) and saw the same map (see (H)ospital/(H)ealth location) and 5 coordinates.

    [​IMG]

    Other interesting site on tools/maps and geohash: Tips & Tricks - geohash.org


    The whole file name was dnkk9 and that translated to this 5 character geohash area:

    [​IMG]
     
    • Informative x 15
    • Love x 3
    • Like x 2
  14. DamianXVI

    DamianXVI Member

    Joined:
    May 16, 2017
    Messages:
    57
    Location:
    Poland
    This is what more-less the content of that tile file looks like (at least partially):

    dnkk9.png

    Please DO NOT take this visualization too seriously, as I pretty much don't know what I'm doing, things are figured out just by looking at it, visualization is not very precise, and the method of smoothing the curves that I used is most likely wrong.

    Here is the same image as an overlay over the Google maps:

    dnkk9_overlay.jpg

    So, briefly about how the file looks like:

    A single tile file contains two main parts: a list of smaller tiles, and a list of paths.

    List of tiles contains a set of smaller tiles (one character more precise in geohash). Included are tiles from the inside of the main tile, as well as bordering tiles from outside, to cover the structures passing over the border of the main tile (this can be seen on the first image - blue box defines the main tile).

    Each small tile contains only a list of IDs of paths, that are intersecting with it. This most likely is used as a sort of area indexing, to speed up the lookup of paths in the given area.


    Each path is a separate structure, identified by a 32bit ID (which is probably global, not bound to the file). Single path contains some flags (that I don't know the meaning of), some parameters (e.g. length in meters, I think), and a bunch of lists.

    First list is of course a list of points along the path. Each point have Latitude and Longitude (global, not relative to the tile), and a relative vector of spline smoothing.

    Next are at least two lists of IDs referencing other paths, probably pointing to connecting paths, forming a big graph of routes.

    Next are more lists (at least five) with some features, that I didn't figured out the meaning of, so there are more things in this map.

    Latitude and Longitude are stored as 32bit unsigned integers, mapped to the whole range of a given value (fixed point notation).
     
    • Informative x 17
    • Love x 3
    • Like x 1
  15. Blup85

    Blup85 Member

    Joined:
    Oct 26, 2016
    Messages:
    779
    Location:
    Chico
    In my day job, I use this to set curve advisory speed.. tesla must have they a backup device "(gyro?) As a backup, in case curvature changes?
     

    Attached Files:

  16. DamianXVI

    DamianXVI Member

    Joined:
    May 16, 2017
    Messages:
    57
    Location:
    Poland
    One more tile fragment visualization, from Tesla HQ neighborhood (forgive my poor alignment with Google maps):

    tesla_hq.png

    This one seems to be mapped to some smaller details, including their parking lot (again, forgive my obviously wrong curve smoothing):

    tesla_hq_parking.jpg
     
    • Informative x 17
    • Like x 4
    • Love x 1
  17. J1mbo

    J1mbo Active Member

    Joined:
    Aug 20, 2013
    Messages:
    1,565
    Location:
    UK
    Just want to say that I am in awe of how quickly @DamianXVI has unlocked the tile file format.

    No doubt the Tesla parking lot was mapped to that extent for the FSD demo. Maybe they left some geotags in there (i.e. drop off point and the final parking space) if you look closer?
     
    • Like x 4
    • Love x 2
    • Helpful x 1
    • Funny x 1
  18. BigD0g

    BigD0g Active Member

    Joined:
    Jan 12, 2017
    Messages:
    2,019
    Location:
    Somewhere
    +1 go @DamianXVI go !! And not to mention verygreen for digging up all these lovely tidbits!!
     
    • Like x 1
    • Love x 1
  19. lunitiks

    lunitiks Cool James & Black Teacher

    Joined:
    Nov 19, 2016
    Messages:
    2,698
    Location:
    Prawn Island, VC
    This stuff is why I bother being around. Totally awesome
     
    • Love x 6
  20. buttershrimp

    buttershrimp Click my signature to Go Mad Max Mode

    Joined:
    Jun 17, 2017
    Messages:
    2,656
    Location:
    ATX
    Do you think it's possible to map out the exact drive for FSD and see if we find any juicy nuggets?
     
    • Like x 1

Share This Page

  • About Us

    Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.
  • Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


    SUPPORT TMC