Skip to content

Build the Map Products#

The map products are the data that the simulators read for each field. They are the ground classes, the loops around the fields, the checkpoints, the entries and the transit graph. A script builds them one time for each map version. Thus ACRES Core, the game and each Python client use the same geometry.

The loops of the tile fields over the ground classes

Map Products gives the files and their content. Map Data gives the map folders and the generator of the map variants.

When to Build#

Build the products again after a change of one of these inputs:

  • Acres/Content/Simulation/ACRE/site.json, fields.json, places.json or surface_polygons.json
  • a lane or a regional layer in Calibration/Map/Layers (lanes.geojson, regional_*.geojson)
  • the structures or the trees of the level (the obstacle file)
  • the map section of Learning/acres_learn/configs/scouting_v1.json
  • the route code of the map build

Caution

A new map has a new map hash. The planner then refuses the cost tables of the old map. Drive the cost tables again after a map change (Map Data).

Build the Products#

Before you start

  • Install the packages of Learning/requirements.txt (Install).
  • Commit each input of the map. The build stops when an input has uncommitted changes.
  1. Go to the folder Learning.

    cd Learning
    
  2. Make the obstacle file again. Do this step only when the structures or the trees of the level changed.

    python -m acres_learn.tasks.scouting.obstacles --saved <folder with structures_level.json>
    
  3. Build the products.

    python -m acres_learn.tasks.scouting.build_map
    

    Expected result

    The build writes scouting_map.json and ground_classes.u8 into Acres/Content/Simulation/ACRE/Scouting. It takes approximately 290 s and 7.3 GB of memory. The raster has 14 120 x 11 748 cells of 0.25 m.

  4. Run the tests of the products.

    cd .. && python -m pytest Learning/tests -m "unit or integration"
    
Option of build_map Function
--tile-only Build only the 59 fields of the terrain tile, on the raster of the tile. It takes 28 s and 1.7 GB.
--fields F01,F02 Build only the given fields.
--out <folder> Write the products into a different folder.
--allow-uncommitted Build from inputs with uncommitted changes. Do not commit the products of such a build.

Build after a Level Export#

A level edit makes the Core scene and the obstacle file old, because ACRES Core examines the bytes of the level file. After the editor export (Tools/Scene/export_photo_scene_core.py in Unreal), one command builds all products again. It needs no Unreal and no GPU.

  1. Build ACRES Core (Build ACRES Core).
  2. Run the command.

    Tools/Scene/rebuild_scene_and_map.sh --staging <folder of the export> --level <level dump with instances>
    

    Expected result

    The command prints PASS. It takes approximately 30 minutes and 7.3 GB of memory.

  3. Commit the products and the result files.

  4. Drive the cost tables again.

The command does these steps:

  1. It builds the Core scene and the obstacle file from the export, then the map products.
  2. It applies them to Core/Data and Acres/Content/Simulation/ACRE/Scouting.
  3. It counts the lot furniture and the trees that go out of the level.
  4. It runs the tests of the products.
  5. It compares each mission path with the objects of the level.
  6. It examines the edge and the smoothness of each path.
  7. It drives a set of missions in ACRES Core.

The header of Tools/Scene/rebuild_scene_and_map.sh gives each step and each input.

What the Tests Examine#

Learning/tests/test_scouting_map.py examines the products:

  • Each field has a closed loop with points 1 m apart. The curvature of a loop is at most 0.15 1/m.
  • No loop point is on crop outside the edge band, or within 1.0 m of an obstacle.
  • The checkpoints are at most 10 m apart, and the loop covers at least 95 % of them.
  • Each field has 1 to 6 entries.
  • The transit graph joins the entries of each field to H and stays off obstacles.
  • The wheels of a vehicle on a loop are at least 4.5 m inside the bounds of the map.

Learning/tests/test_route_fixes.py examines the corrections of the routes at known places of the map.

Limits of the Products#

  • The regional field outlines follow crop maps of 10 m and 30 m cells. A loop on a regional edge band can be 10 m from the real field edge.
  • Most regional loops are on the edge band. Few regional fields are adjacent to a lane.
  • A routed connector has no curvature limit. A sharp connector can need a reverse turn.
  • The collision geometry is an approximation: buildings are their outlines, bins and trunks are cylinders, props are boxes.
  • The nodes of the transit graph merge within 4.5 m. A chord can thus cut a field corner by up to 4 m.
  • The lane network is as surveyed. A lane that the survey did not record is not in the products.