Skip to content

NavGrid format

Manolis Savva edited this page Feb 9, 2018 · 1 revision

Precomputed navgrid files are used for reproducible navigation and faster collision detection.

The navgrid data is loaded and then post-processed at runtime to account for larger agents than the precomputed agent radius, and to avoid areas near walls.

SceneGrid2D

Single level 2D grid

{
  "type": "SceneGrid2D",
  "metadata": {
    "sceneId": "p5dScene.0049e2ed9d7b7c49930d92c30fd59ff7",       // Scene Id
    "cellAttributes": [                                           // List of dense attributes that is stored per cell
      {
        "name": "floorHeight",                                    // field name
        "type": "Float32Array",                                   // javascript array type
        "dataType": "continuous"                                  // type of each field (categorical|continuous)  
      },
      {
        "name": "roomIndex",
        "type": "Uint16Array",
        "dataType": "categorical"
      },
      {
        "name": "occupancy",
        "type": "Uint8Array",
        "dataType": "categorical"
      }
    ],
    "agentHeight": 1.1400000000000001,                            // height of agent used for computing the navgrid
    "agentRadius": 0.05,                                          // radius of agent used for computing the navgrid
    "traversableFloorHeight": 0.25,                               // objects below this height is ignored in occupancy computations
    "useCellFloorHeight": true                                    // Whether to use the cell floor height (agent is adjusted upward/download accordingly based on computed floor height)
  },
  "weights": {                                                    // Weights/cost per cell/tile
    "type": "array",
    "length": 5032,
    "encoding": "rle",                                            // raw for raw array, rle for simple run length encoding with value + number of times the value appears
    "data": [null, 59, 1, 9, ...]
  },
  "userData": {                                                   // Sparse user data per cell/tile
    "431": { "doors": [ "0_10" ] },                               // Any data keyed by cell/tile id (x + y*width)
    ...
  },
  "tileAttributes": {                                             // Actual values for cell/tile attributes 
    "floorHeight": {                                              // Floor height (for scenes where the floor height varies).  null values indicate there is no floor there.
      "type": "array",                                            
      "datatype": "float32",
      "length": 5032,
      "encoding": "rle",
      "data": [null, 1, 0.05, 57,...]
    }, 
    "roomIndex": {                                               // Room index (which room is this tile in).  0 values indicate there is no room there.
      "type": "array",
      "datatype": "uint16",
      "length": 5032,
      "encoding": "rle",
      "data": [0, 1, 3, 23, ...]
    }
    "occupancy": {                                               // Occupancy (is this tile occupied by stuff (from floorHeight + traversableFloorHeight up to floorHeight + agentHeight?)
      "type": "array",
      "datatype": "uint8",
      "length": 5032,
      "encoding": "rle",
      "data": [ 1, 59, 0, 9, ...]
  },
  "width": 68,            // Width of grid
  "height": 74,           // Height of grid
  "cellSize": 0.1,        // Cellsize (in units)
  "min": [ -42.707003021161874, 0.04999999701976885, -44.075568771362306 ],  // minimum point of 0th cell (y gives the ground plane)
  "unit": 1,              // Unit to meters (1 to 1 is good)
  "bbox": {               // min/max of axis-aligned bounding box of scene
    "min": [ -42.658744811854994, -1.862645572503485e-09, -44.06613540649414 ],
    "max": [ -35.95526123046875, 2.734999938867986, -36.685002136230466 ]
  },
  "timings": {
    "createMillis": 2275                       
  }
}

MultiLevelGrid

Multi-level grid for houses with multiple levels

{
  "type": "MultiLevelGrid",
  "metadata": {
    "sceneId": "mp3d.1LXtFkjw3qL",       // Scene Id
    "cellAttributes": [                                           // List of dense attributes that is stored per cell
      {
        "name": "floorHeight",                                    // field name
        "type": "Float32Array",                                   // javascript array type
        "dataType": "continuous"                                  // type of each field (categorical|continuous)  
      },
      {
        "name": "roomIndex",
        "type": "Uint16Array",
        "dataType": "categorical"
      },
      {
        "name": "occupancy",
        "type": "Uint8Array",
        "dataType": "categorical"
      }
    ],
    "agentHeight": 1.1400000000000001,                            // height of agent used for computing the navgrid
    "agentRadius": 0.05,                                          // radius of agent used for computing the navgrid
    "traversableFloorHeight": 0.25,                               // objects below this height is ignored in occupancy computations
    "useCellFloorHeight": true                                    // Whether to use the cell floor height (agent is adjusted upward/download accordingly based on computed floor height)
  },
  "unit": 1,                                                      // Unit to meters (1 to 1 is good)
  "grids" [{                                                      // Array of grids per level
    "type": "SceneGrid2D",                                        // Grid type (see above for SceneGrid2D)
    "weights": {...},                                             // Weights/cost per cell/tile
    "userData": {...},                                            // Sparse user data per cell/tile
    "tileAttributes": {...},                                      // Actual values for cell/tile attributes 
    "width": 215,           // Width of grid
    "height": 94,           // Height of grid
    "cellSize": 0.1,        // Cellsize (in units)
    "min": [ -17.255074977874756, -2.879965732597734, -7.502715113143921 ],  // minimum point of 0th cell (y gives the ground plane)
    "unit": 1,              // Unit to meters (1 to 1 is good)
    "bbox": {               // min/max of axis-aligned bounding box of scene
      "min": [ -17.225500106811523, -3.0610299110412598, -7.469970226287842 ],
      "max": [ 4.215350151062012, 0.35231794438171393, 1.86454 ]
    },

  }, ...]
}
Clone this wiki locally