# TraCI - Traffic Control Interface
TraCI (short for Traffic Control Interface) is an API that provides access to a SUMO traffic simulation,
enabling controlling the behavior of multiple simulation objects during a live simulation.
It allows for external scripts to interact with the simulation and its vehicles, pedestrians, and infrastructure.
## Installation
To use TraCI, you must first have an Eclipse SUMO installation. Install TraCI by simply executing:
```pip install traci```
A [daily version](https://test.pypi.org/project/traci/) is also available in TestPyPI:
```pip install -i https://test.pypi.org/simple/ traci```
## Getting Started
To use TraCI in your Python code, import the `traci` module. The following code snippet shows a basic example
of how to connect to a running SUMO simulation using TraCI:
```python
import traci
# Connect to SUMO simulation
traci.start(["sumo", "-c", "path/to/your/sumocfg/file.sumocfg"])
# Simulation loop
step = 0
while step < 1000:
traci.simulationStep()
# Your simulation logic here
step += 1
# Close TraCI connection
traci.close()
```
Once connected to the SUMO simulation, TraCI provides a range of functions that can be used to query and modify
the state of the simulation. For example, you can use TraCI to control the behavior of individual vehicles,
modify the traffic light phases, or query the current state of the simulation.
## Documentation
The TraCI documentation is available online at
[http://sumo.dlr.de/docs/TraCI.html](http://sumo.dlr.de/docs/TraCI.html). The documentation provides detailed
information on the TraCI API, including a list of available functions and their parameters.
## Examples
There are some [TraCI Tutorials](https://sumo.dlr.de/docs/Tutorials/index.html#traci_tutorials) available.
## Contributing
If you find a bug in TraCI or have a suggestion for a new feature, please report it on the SUMO issue tracker at
[https://github.com/eclipse/sumo/issues](https://github.com/eclipse/sumo/issues). If you would like to contribute
code to TraCI, please submit a pull request to the SUMO repository at
[https://github.com/eclipse/sumo](https://github.com/eclipse/sumo).
## License
TraCI is released under the Eclipse Public License 2.0 (EPL-2.0).
Raw data
{
"_id": null,
"home_page": "https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html",
"name": "traci",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "traffic simulation traci sumo",
"author": "DLR and contributors",
"author_email": "sumo@dlr.de",
"download_url": "https://files.pythonhosted.org/packages/59/04/9c382ee5dbf0167a2cfe34a6568c9bc7583384f0a60126e28fe31c0eca97/traci-1.21.0.tar.gz",
"platform": null,
"description": "# TraCI - Traffic Control Interface\n\nTraCI (short for Traffic Control Interface) is an API that provides access to a SUMO traffic simulation,\nenabling controlling the behavior of multiple simulation objects during a live simulation.\nIt allows for external scripts to interact with the simulation and its vehicles, pedestrians, and infrastructure.\n\n## Installation\n\nTo use TraCI, you must first have an Eclipse SUMO installation. Install TraCI by simply executing:\n```pip install traci```\n\nA [daily version](https://test.pypi.org/project/traci/) is also available in TestPyPI:\n```pip install -i https://test.pypi.org/simple/ traci```\n\n## Getting Started\n\nTo use TraCI in your Python code, import the `traci` module. The following code snippet shows a basic example\nof how to connect to a running SUMO simulation using TraCI:\n\n```python\nimport traci\n\n# Connect to SUMO simulation\ntraci.start([\"sumo\", \"-c\", \"path/to/your/sumocfg/file.sumocfg\"])\n\n# Simulation loop\nstep = 0\nwhile step < 1000:\n traci.simulationStep()\n # Your simulation logic here\n step += 1\n\n# Close TraCI connection\ntraci.close()\n```\n\nOnce connected to the SUMO simulation, TraCI provides a range of functions that can be used to query and modify\nthe state of the simulation. For example, you can use TraCI to control the behavior of individual vehicles,\nmodify the traffic light phases, or query the current state of the simulation.\n\n## Documentation\n\nThe TraCI documentation is available online at\n[http://sumo.dlr.de/docs/TraCI.html](http://sumo.dlr.de/docs/TraCI.html). The documentation provides detailed\ninformation on the TraCI API, including a list of available functions and their parameters.\n\n## Examples\n\nThere are some [TraCI Tutorials](https://sumo.dlr.de/docs/Tutorials/index.html#traci_tutorials) available.\n\n## Contributing\n\nIf you find a bug in TraCI or have a suggestion for a new feature, please report it on the SUMO issue tracker at\n[https://github.com/eclipse/sumo/issues](https://github.com/eclipse/sumo/issues). If you would like to contribute\ncode to TraCI, please submit a pull request to the SUMO repository at\n[https://github.com/eclipse/sumo](https://github.com/eclipse/sumo).\n\n## License\n\nTraCI is released under the Eclipse Public License 2.0 (EPL-2.0).\n",
"bugtrack_url": null,
"license": "EPL-2.0",
"summary": "The pure python version of the TraCI API to communicate with the traffic simulation Eclipse SUMO",
"version": "1.21.0",
"project_urls": {
"Download": "https://sumo.dlr.de/download",
"Homepage": "https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html"
},
"split_keywords": [
"traffic",
"simulation",
"traci",
"sumo"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2dad6f0b71470069d86f26f6954ea706da31988232565693f62c5a310636a215",
"md5": "4cc02967d64c78bb12bd7c7dea41a160",
"sha256": "d6b5a57518b1d7a52d9eb955d0afc16b43d994674797e930cd0cafcb6920b43c"
},
"downloads": -1,
"filename": "traci-1.21.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4cc02967d64c78bb12bd7c7dea41a160",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 126199,
"upload_time": "2024-10-09T20:40:48",
"upload_time_iso_8601": "2024-10-09T20:40:48.949309Z",
"url": "https://files.pythonhosted.org/packages/2d/ad/6f0b71470069d86f26f6954ea706da31988232565693f62c5a310636a215/traci-1.21.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59049c382ee5dbf0167a2cfe34a6568c9bc7583384f0a60126e28fe31c0eca97",
"md5": "63d7ccda49501d6935ecb46563b7e6e7",
"sha256": "8b0765d08fc8bc7e7fa1647c7cb0ace9964b15d8980de979a5e10a206c417311"
},
"downloads": -1,
"filename": "traci-1.21.0.tar.gz",
"has_sig": false,
"md5_digest": "63d7ccda49501d6935ecb46563b7e6e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 94411,
"upload_time": "2024-10-09T20:40:52",
"upload_time_iso_8601": "2024-10-09T20:40:52.344504Z",
"url": "https://files.pythonhosted.org/packages/59/04/9c382ee5dbf0167a2cfe34a6568c9bc7583384f0a60126e28fe31c0eca97/traci-1.21.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 20:40:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "traci"
}