inverted-ai / invertedai

Python interface to Inverted AI API
MIT License
4 stars 0 forks source link

tile initialize and re-initialize needs to dynamically respond to the amount of drivable area in the underlying FOV #166

Open fwood opened 10 months ago

fwood commented 10 months ago

when running tile initialize naively, initialize will fail or potentially take a very long time initializing in areas with little drivable area. the density should be scaled proportionally to driveable area

KieranRatcliffeInvertedAI commented 10 months ago

This is something Berend and I discussed before and came to the same conclusion as the fix. The constraints will be that this will be on the client side with all of the design implications therein. That being said, @ruinixu were discussing it a moment ago and came to 2 solutions:

  1. Quick and dirty: From the birdview image in location_info endpoint, per map tile, we can average the colour of every pixel to get a rough idea of how much road surface is present to determine the number of agents requested from the API (or to just not call INITIALIZE at all if 0).
  2. More accurate but longer development: From the osm map acquired from locaction_info endpoint, calculate the percentage "spawnable area" per agent type per tile for similar number of vehicles request scaling. The reason this will take a bit longer to pull off is due to the need to familiarize with the OSM data format.