Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

connected_car_simulation-0.1.0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

connected_car_simulation-0.1.0-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

File details

Details for the file connected_car_simulation-0.1.0.tar.gz.

File metadata

File hashes

Hashes for connected_car_simulation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a47a6476238d9953b9c6a2a7b22f1a949e84d6de13ce23dd5ad9a7b6b21623e
MD5 dcf8a9e6d32ed06421f82e17d992798c
BLAKE2b-256 9650a301000f26f04fe3b62051ca2ce1fd2a3caa281b63814ae7d246efda0d62

See more details on using hashes here.

File details

Details for the file connected_car_simulation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for connected_car_simulation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe8092d48c07205e3a6b07ee7d396ff45031c20184054b65ff31c21777737b2c
MD5 c799a3440be8773092e4d9b98bc6f05c
BLAKE2b-256 055f5f63bda2a0d1c22dfaa72a8872c93b7efe89aa50467327be01afcb618f46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page