TODO
From Vehicle Config, TODO edit
The root properties class is VehicleProperties
which contains all the necessary sub-classes to entirely define a Vehicle.
This structure uses inheritance to specify sub-components with different types.
While this structure can be created using code, it is also entirely (de-)serializable (from/)to JSON and can also be loaded from a CarLang file (TODO coming).
Specifying Vehicles in JSON
TODO for simulations
The structure of JSON file describing a Vehicle is directly derivable from the Class structure shown above. A complete example can be seen here.
The Vehicle's JSON doesn't have to contain all entries: the default values specified in the classes themselves (as in the example file above) are used as default.
(Another way of seeing this: the Properties Structure is instanced with its default values, then only the entries specified in the JSON data are written to the structure.)
-
Fields are specified as
"field_name": value
entries. The key name defaults to the field name unless specified otherwise in the class by a@JsonEntry
annotation. Fields markedtransient
are ignored. - Classes are described by a JSON object.
-
Sub-classes with different types must have
"type"="type_name"
as first entry. The type name can be seen in the@Typed()
annotation on the various sub-classes.
Note: Durations are represented in JSON with an array: [seconds, nanoseconds]
.