@@ -39,6 +39,9 @@ After installation, start at least one rmiserver, by default it should be listen
Go to the rpc module for installation guid.
Start at least one RPC server on **localhost:6000**
After all services are up, there are some simple scenarios and maps for testing purpose
available in `restful/src/test/resources`.
## Configuration
The configuration file are located at `restful/src/main/resources/config.properties`.
Several options are available in there.
...
...
@@ -123,211 +126,7 @@ The sequence should be:
6. Once finished, retrieve all results with `GET /simulation/{id}/result`
7. Individual sector map data can downloaded with `GET /simulation/{id}/map-data/{sectorIdx}`. The minimal sector index is 0, maximal is *num_sectors* - 1.
## Endpoints
The restful endpoints are defined in the `openapi.yml`.
### Map
#### `POST /map`
Upload a map.
| arg | value |
| --- | --- |
| file | map file |
Return:
```json
{
"id":1,
"name":null,
"path":null,
"streets":null,
"buildings":null,
"bound":null
}
```
#### `GET /map`
List all available maps.
Return:
```json
[
{
"id":1,
"name":"map.osm",
"path":null,
"streets":null,
"buildings":null,
"bound":null
},
{
"id":2,
"name":"straight.osm",
"path":null,
"streets":null,
"buildings":null,
"bound":null
}
]
```
### Scenario
#### `POST /scenario`
Upload a scenario.
| arg | value |
| --- | --- |
| file | .sim file |
```json
{
"id":1,
"name":"straight",
"path":null
}
```
#### `GET /scenario`
List all available scenarios.
Return:
```json
[
{
"id":1,
"name":"straight",
"path":null
},
{
"id":2,
"name":"aachen",
"path":null
}
]
```
### Simulation
#### `POST /simulation`
Configure an simulation, mainly choose an scenario file, and number of sectors that you want you simulation
to be split into.
| arg | type |
| --- | --- |
| scenario_id | int |
| num_sectors | int |
Return:
```json
{
"id":1,
"scenarioID":1,
"numSectors":1,
"mapID":-1
}
```
#### `GET /simulation`
List all available simulations.
Return:
```json
[
{
"id":1,
"scenarioID":1,
"numSectors":1,
"mapID":0
},
{
"id":2,
"scenarioID":3,
"numSectors":5,
"mapID":0
}
]
```
#### `POST /simulation/{id}/start`
Start to run a simulation
Return
```json
{"result":"ok"}
```
#### `GET /simulation/{id}/result`
Retrieve the result of a given simulation. It will return all up-to-date result if the simulation is
not finish yet.
Results contains a list of vehicles. Id is a UUID for the vehicle, frames are the actual simulation results.
```json
[
{
"id":"eb280a97-0a22-4b36-986e-cc1dfb3a5302",
"frames":[
{
"posX":73.1795654296875,
"posY":0,
"posZ":0.5429999828338623,
"steering":0,
"engine":0,
"brake":0,
"deltaTime":33,
"totalTime":33
}
]
}
]
```
#### `GET /simulation/{id}/map-data/{sector-idx}`
Get the map data of a specific sector of a given simulation.
Return:
```json
{
"id":0,
"name":null,
"path":null,
"streets":[
{
"id":6767361,
"width":6,
"nodes":[
{
"id":875165172,
"longitude":5.881338596343994,
"latitude":50.83610153198242,
"altitude":0
}
],
"intersections":[],
"type":"A_ROAD",
"streetPavements":"QUALITY",
"speedLimit":50,
"oneWay":false
}
],
"buildings":[],
"bound":{
"minX":5.88016939163208,
"minY":50.835357666015625,
"minZ":0,
"maxX":5.881338596343994,
"maxY":50.8371467590332,
"maxZ":0
}
}
```
\ No newline at end of file
## API Documentation
The APIs are defined using OpenAPI2.0 in `openapi.yml`.
However, the restful server also provides an auto generated API documentation page at