# OpenCRG

OpenCRG is a complete free and open-source project for the creation, modification and evaluation of road surfaces, and an open file format specification CRG (curved regular grid). Its objective is to standardize a detailed road surface description and it may be used for applications like tire-, vibration- or driving-simulation.
The initial release of OpenCRG was a beta version 0.3 in early 2009; as of August 2015, the current stable release of the OpenCRG C-API and MATLAB tool suite is version 1.0.6.

## Overview

OpenCRG is a standardized efficient 3D road data representation defined in base plane by its direction (heading, yaw angle). It is optionally complemented by hilliness (slope, inclination, grade, pitch angle) and cross slope (super-elevation, banking, cant, camber, roll angle). Compact storage and sufficient accuracy, even for long tracks are the objectives for the open file format specification CRG.
A C-API as well as a MATLAB API are provided for the creation, evaluation or modification of OpenCRG files. Both APIs include basic operations like transforming between intrinsic to global coordinates. The MATLAB tool suite provides powerful modification or creation tools and allows to visualize the 3D road data representation.
OpenCRG was initiated by Daimler and is currently driven by VIRES Simulationstechnologie GmbH, the research group AK 6.1.3 'Tire Models for Vehicle Dynamics, Ride Comfort and Uneven Roads' and the OpenCRG community. The associated website maintained by VIRES GmbH is the main portal for information about OpenCRG including latest news concerning the data format, free and commercial tool-sets, test data etc..
With OpenCRG real road surfaces (e.g. by measurement) have also become available to "classic" simulation applications using a macroscopic description of road networks. The gap between the logical road description and the microscopic description of road surfaces (i.e. OpenCRG) is closed by the open file format OpenDRIVE. An implementation of OpenCRG into the OpenDRIVE file format specification has already been established in January 2008.

## History

The predecessor of OpenCRG is a format called CRG (curved regular grid) which has been used internally for several years by Daimler AG. An entire suite of MATLAB and FORTRAN tools had been developed for the handling, evaluation and generation of CRG data.
The early phase of the OpenCRG initiative is funded by a series of German automotive OEMs. Representatives of Audi AG Ingolstadt, BMW AG München, Daimler AG Sindelfingen, Porsche AG Weissach and Volkswagen AG Wolfsburg define the objectives of OpenCRG.
Since 2008, Daimler AG develops and refines OpenCRG in collaboration with VIRES GmbH, a simulation technology company.

## Features
### Clear-text headers

OpenCRG provides various ASCII/binary file formats with clear-text headers. The header contains road parameters for the reference line and the overall configuration of the longitudinal sections, a data definition to define the data format (ASCII/binary) and the sequence of data which is to be expected in the trailing data block as well as modifier and option parameters. Furthermore, it may contain references to other files (typically containing the actual data) to handle different parameters for the same data set.

### Arbitrary scalar data

OpenCRG handles any arbitrary scalar data versus a reference grid. These are typically elevation data or friction coefficients. By this, different applications like tire- or vibration simulations take advantage of the open surface descriptions format OpenCRG.

### C-API

OpenCRG provides an open source C-API for data handling and evaluation. Based on predecessor CRG-FORTRAN routines (Daimler AG), the enhanced C-API allows easy integration of OpenCRG functionality into third party applications. The major focus is the fast conversion from inertial to global coordinate space of OpenCRG data.

### MATLAB API

OpenCRG provides a wide range open source MATLAB tool suite. Additional functionality to the predecessor CRG-MATLAB routines (Daimler AG) for the modification, creation and visualization of OpenCRG files is provided. The focus of the MATLAB tool suite is mainly the modification and visualization of OpenCRG data.

### World geodetic system

Real world OpenCRG data files may be generated by several laser scans along a road. World geodetic system coordinates (WGS84), as used by GPS and e.g. Google Maps may be attached to OpenCRG header informations. This allows to track and visualize the road description. The MATLAB API provides an interface to visualize the location of OpenCRG roads on Google Maps.

### Sample data

Getting started with OpenCRG is facilitated by a growing library of sample data. A set of test and demo OpenCRG files as well as a detailed documentation are included. Simple examples explain the usage of OpenCRG.

## Fields of application

* Tire simulation
* Vibration simulation
* Driving simulation
* Passenger comfort
* etc.

## Version history

| Project name | Version | Release date | Status |
| OpenCRG (beta) | C-API 0.3beta | 10 February 2009 |
| OpenCRG (beta) | C-API 0.4beta | 26 May 2009 |
| OpenCRG (beta) | C-API 0.6beta | 20 August 2009 |
| OpenCRG (beta) | tools-suite 0.7beta | 12 November 2009 |
| OpenCRG | tools-suite 0.8 | 17 December 2009 |
| OpenCRG | tools-suite 1.0 | 15 April 2010 |
| OpenCRG | tools-suite 1.0.1 | 4 June 2010 |
| OpenCRG | tools-suite 1.0.2 | 28 September 2010 |
| OpenCRG | tools-suite 1.0.3 | 30 June 2011 |
| OpenCRG | tools-suite 1.0.4 | 8 December 2011 |
| OpenCRG | tools-suite 1.0.5 | 28 May 2013 |
| OpenCRG | tools-suite 1.0.6 | 31 July 2013 | RC 1 |
| OpenCRG | tools-suite 1.0.6 | 9 April 2014 | Stable |
| OpenCRG | tools-suite 1.1.0 | 31 July 2015 | RC 1 |

## System requirements

OpenCRG has full support for 32-bit i586 and 64-bit x86-64 PC hardware. Big and little endian encoding of a given processor is detected automatically in the C-API. It is constantly tested in the following environments:
* Linux on PC
* Microsoft Windows
* Irix on sgi workstations
The OpenCRG MATLAB Tool Suite is provided on any system distribution running MATLAB (R14) or higher.

## Gallery

* Example 'belgian_block.crg' patch visualization
* Example 'country_road.crg' elevation grid cuts and limits
* Example 'country_road.crg' reference line map
* Example 'country_road.crg' header and binary data