- Update for CarLang.
Vehicles in the simulator are instanced from a Vehicle Configuration represented by the following Properties structure:
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
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": valueentries. The key name defaults to the field name unless specified otherwise in the class by a
@JsonEntryannotation. Fields marked
- 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:
Specifying Vehicles with CarLang
The following tables show the possible entries for the different Properties structures.
||-||S||Name of the vehicle.||
||-||[O]||A JSON Array containing
Right now only specify:
All these must have
type as first entry.
They can also have the following entry:
||-||[S]||List of component names this component is attached to.||-|
||-||I||For components that can send messages: the priority on the buses.||-|
As can be seen in the graphic at the start of this page, the following properties are
- Body and Wheel Properties
- BusProperties (Buses)
- Sensor and Actuator Properties (EE-components)
- Bridge, Navigation and SimpleCommunicationGateway Properties (EE-components)
- TestAutopilot and JavaAutopilot Properties (EE-components)
- ComputerProperties (EE-component)
The Type columns in the tables specify the JSON type to use in order to describe the property.
|FP||Floating Point / Decimal Number|
|[S]||List of Strings|
|[O]||List of Objects|
Specifies how the values are interpreted in the simulation.