Skip to main content

Connected Car Simulation

Connected Car Simulation is a Python-based simulator for experimenting with vehicle movement, route-following, and traffic-light interaction. It ships with:

  • a live OpenLayers web UI
  • a WebSocket stream for realtime simulation updates
  • an HTTP API for controlling the simulation and reading state
  • Swagger-based API documentation

Traffic light states

Features

  • Realtime vehicle simulation on a GPX-based route
  • Configurable traffic-light timings and vehicle parameters
  • Browser UI for map visualization and simulation control
  • HTTP endpoints for control and inspection
  • OpenAPI/Swagger documentation at /api/docs
  • PyInstaller build support

Project Layout

connected_car_simulation/
├── connected_car_simulation/
│   ├── main.py
│   ├── simulation_environment.py
│   ├── webserver.py
│   ├── websocket.py
│   └── resources/
│       ├── config.xml
│       └── ui/
├── resources/
│   └── images/
├── examples/
├── pyinstaller.spec
└── tox.ini

Requirements

  • Python 3.9+
  • A virtual environment is recommended

Development Setup

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Running the Simulator

Start the application with:

python -m connected_car_simulation

Once started, open:

  • UI: http://localhost:8080/static/index.html
  • Swagger docs: http://localhost:8080/api/docs

The simulator writes logs to stdout and to connected_car_simulation.log in the current working directory.

The simulator also exposes a WebSocket endpoint on:

  • ws://localhost:8081

Python client examples are available in examples/python, with one simple_example over HTTP and one over WebSocket.

HTTP API

The simulator provides these main HTTP endpoints:

  • GET /api/actions/set_vehicle_output
  • GET /api/actions/set_vehicle_position
  • GET /api/actions/get_simulation_state
  • GET /api/actions/get_model_ui_resources
  • GET /api/actions/get_route_information
  • GET /api/actions/get_vehicle_input_adhoc
  • GET /api/actions/get_vehicle_input_infrastructure
  • GET /api/openapi.json
  • GET /api/docs

For parameter and schema details, use the Swagger UI.

Configuration

The simulator reads its runtime configuration from:

This file controls vehicle parameters, speed limits, and traffic-light definitions.

Packaging with PyInstaller

Build the standalone executable with:

tox -e pyinstaller

The PyInstaller spec bundles:

  • connected_car_simulation/resources/config.xml
  • the web UI assets
  • example files

Notes

  • In PyInstaller --onefile mode, bundled resources are extracted into a temporary _MEI... directory at startup.
  • The project resolves bundled resource paths at runtime so the same code works in development and in the packaged executable.

License

GPL 3.0

Metadata

Release files for connected-car-simulation 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connected-car-simulation 0.1.0
File Size Uploaded
connected_car_simulation-0.1.0.tar.gz 67.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for connected-car-simulation 0.1.0
File Interpreter ABI Platform
connected_car_simulation-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 124.1 kB

Release files / connected_car_simulation-0.1.0.tar.gz

Download URL connected_car_simulation-0.1.0.tar.gz
Size 67.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5a47a6476238d9953b9c6a2a7b22f1a949e84d6de13ce23dd5ad9a7b6b21623e
BLAKE2b-256 checksum
How to use checksums
9650a301000f26f04fe3b62051ca2ce1fd2a3caa281b63814ae7d246efda0d62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / connected_car_simulation-0.1.0-py3-none-any.whl

Download URL connected_car_simulation-0.1.0-py3-none-any.whl
Size 56.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe8092d48c07205e3a6b07ee7d396ff45031c20184054b65ff31c21777737b2c
BLAKE2b-256 checksum
How to use checksums
055f5f63bda2a0d1c22dfaa72a8872c93b7efe89aa50467327be01afcb618f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page