| 1 | |
| 2 | == Interacting with SUMO using TraCI == |
| 3 | |
| 4 | TraCI stands for Traffic Control Interface, a protocol that defines messages that can be used to control a traffic simulation that runs in client-server mode. |
| 5 | |
| 6 | Communication uses TCP messages with the following structure: |
| 7 | {{{ |
| 8 | +--------------------------+-----------+-----------+-----+-----------+ |
| 9 | | message length (4 bytes) | command_1 | command_2 | ... | command_n | |
| 10 | +--------------------------+-----------+-----------+-----+-----------+ |
| 11 | }}} |
| 12 | |
| 13 | A command contains the following: |
| 14 | {{{ |
| 15 | +-----------------+---------------------+---------+ |
| 16 | | length (1 byte) | identifier (1 byte) | content | |
| 17 | +-----------------+---------------------+---------+ |
| 18 | }}} |
| 19 | or, for longer commands |
| 20 | {{{ |
| 21 | +------------+------------------+---------------------+---------+ |
| 22 | | 0 (1 byte) | length (4 bytes) | identifier (1 byte) | content | |
| 23 | +------------+------------------+---------------------+---------+ |
| 24 | }}} |
| 25 | |
| 26 | The server will reply with a single message contaning the responses to every command received, in the same order. |
| 27 | |