API reference

OpenCRG.CRGData — Type
CRGData

All data parsed from an OpenCRG file by read_crg. Fields:

  • comment: $CT comment lines, joined with newlines
  • refline: reference-line and long-section parameters from $ROAD_CRG
  • format_code: payload format, one of :LRFI, :LDFI, :KRBI, :KDBI
  • opts: numeric $ROAD_CRG_OPTS entries, keyed by upper-cased name
  • mods: $ROAD_CRG_MODS modifiers (applied by road_surface_grid, not here)
  • mpro: $ROAD_CRG_MPRO projection entries as strings (parsed, never applied)
  • phi: reference-line heading at each u row (rad); phi[1] is the start heading
  • banking: cross slope at each u row (m/m), or nothing if absent
  • slope: longitudinal slope at each u row (m/m), or nothing if absent
  • v: lateral positions of the long sections, ascending (m, positive left)
  • z: raw (nu, nv) elevation grid relative to the reference line (m); columns match v
source
OpenCRG.read_crg — Method
read_crg(path) -> CRGData

Parse the OpenCRG .crg file at path. The row count comes from the payload size. Throws an error if the file declares no channels or no long sections, or if the payload is truncated or has an unknown format.

source
OpenCRG.road_surface_grid — Method
road_surface_grid(data::CRGData) -> (u, v, X, Y, Z)

Apply data's $ROAD_CRG_MODS and compute world-frame grids of the road surface. u (along the reference line) and v (positive left) are axis vectors in m; X, Y, Z are (length(u), length(v)) matrices.

Throws an error for unsupported modifiers (REFPOINT_U*/REFPOINT_V*, or REFPOINT_* without an exact v = 0 column) or if only one of REFERENCE_LINE_END_X/_END_Y is set.

u, v, X, Y, Z = road_surface_grid(read_crg("road.crg"))
source