Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/build_config/setup-traci.py
169674 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2017-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file setup-traci.py
15
# @author Dominik Buse
16
# @author Michael Behrisch
17
# @date 2017-01-26
18
19
20
from setuptools import setup
21
import version
22
23
SUMO_VERSION = version.get_pep440_version()
24
25
setup(
26
name='traci',
27
version=SUMO_VERSION,
28
url='https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html',
29
download_url='https://sumo.dlr.de/download',
30
author='DLR and contributors',
31
author_email='[email protected]',
32
license='EPL-2.0',
33
description='The pure python version of the TraCI API to communicate with the traffic simulation Eclipse SUMO',
34
long_description='''# TraCI - Traffic Control Interface
35
36
TraCI (short for Traffic Control Interface) is an API that provides access to a SUMO traffic simulation,
37
enabling controlling the behavior of multiple simulation objects during a live simulation.
38
It allows for external scripts to interact with the simulation and its vehicles, pedestrians, and infrastructure.
39
40
## Installation
41
42
To use TraCI, you must first have an Eclipse SUMO installation. Install TraCI by simply executing:
43
```pip install traci```
44
45
A [daily version](https://test.pypi.org/project/traci/) is also available in TestPyPI:
46
```pip install -i https://test.pypi.org/simple/ traci```
47
48
## Getting Started
49
50
To use TraCI in your Python code, import the `traci` module. The following code snippet shows a basic example
51
of how to connect to a running SUMO simulation using TraCI:
52
53
```python
54
import traci
55
56
# Connect to SUMO simulation
57
traci.start(["sumo", "-c", "path/to/your/sumocfg/file.sumocfg"])
58
59
# Simulation loop
60
step = 0
61
while step < 1000:
62
traci.simulationStep()
63
# Your simulation logic here
64
step += 1
65
66
# Close TraCI connection
67
traci.close()
68
```
69
70
Once connected to the SUMO simulation, TraCI provides a range of functions that can be used to query and modify
71
the state of the simulation. For example, you can use TraCI to control the behavior of individual vehicles,
72
modify the traffic light phases, or query the current state of the simulation.
73
74
## Documentation
75
76
The TraCI documentation is available online at
77
[http://sumo.dlr.de/docs/TraCI.html](http://sumo.dlr.de/docs/TraCI.html). The documentation provides detailed
78
information on the TraCI API, including a list of available functions and their parameters.
79
80
## Examples
81
82
There are some [TraCI Tutorials](https://sumo.dlr.de/docs/Tutorials/index.html#traci_tutorials) available.
83
84
## Contributing
85
86
If you find a bug in TraCI or have a suggestion for a new feature, please report it on the SUMO issue tracker at
87
[https://github.com/eclipse-sumo/sumo/issues](https://github.com/eclipse-sumo/sumo/issues).
88
If you would like to contribute code to TraCI, please submit a pull request to the SUMO repository at
89
[https://github.com/eclipse-sumo/sumo](https://github.com/eclipse-sumo/sumo).
90
91
## License
92
93
TraCI is released under the Eclipse Public License 2.0 (EPL-2.0).''',
94
long_description_content_type='text/markdown',
95
96
classifiers=[
97
'Development Status :: 5 - Production/Stable',
98
'Intended Audience :: Developers',
99
'Intended Audience :: Science/Research',
100
'Programming Language :: Python :: 2',
101
'Programming Language :: Python :: 3',
102
],
103
keywords='traffic simulation traci sumo',
104
105
packages=["traci", "simpla"],
106
107
install_requires=['sumolib>='+SUMO_VERSION],
108
)
109
110