Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[run]
source = src
source = avisengine
omit =
*/site-packages/*
tests/*
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -22,13 +22,11 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6
sudo apt-get install -y libgl1 libglib2.0-0 libsm6 libxrender1 libxext6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -r requirements.txt
pip install -e .
pip install -e ".[test]"
- name: Run tests
run: |
python -m pytest tests/ -v --cov=avisengine --cov-config=.coveragerc
86 changes: 71 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AVIS Engine Python API

A Python API for AVIS Engine (Autonomous Vehicles Intelligent Simulation Software) - a robust simulation platform for autonomous vehicle development and testing.
A Python API for AVIS Engine (Autonomous Vehicles Intelligent Simulation Software), a robust simulation platform for autonomous vehicle development and testing. It drives both the AVIS Engine desktop simulator and the [AVIS Academy](https://academy.avisengine.com) web Sandbox, which runs in your browser with nothing to download.

[![Python Version](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/)
[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Simulator Version](https://img.shields.io/badge/simulator-v2.1.0--beta-orange.svg)](https://avisengine.com)

Expand All @@ -21,25 +21,18 @@ AVIS Engine provides a realistic simulation environment for developing and testi

## Installation

### Requirements
#### Option 1: Using pip

```bash
pip install -r requirements.txt
pip install avisengine
```

### Python API

#### Option 1: Using git
#### Option 2: Using git

```bash
git clone https://github.com/AvisEngine/AVIS-Engine-Python-API
cd AVIS-Engine-Python-API
```

#### Option 2: Using pip (Coming soon)

```bash
pip install avisengine
pip install -e .
```

### Simulator
Expand Down Expand Up @@ -119,12 +112,69 @@ finally:
car.stop()
```

## The web Sandbox (AVIS Academy)

The [AVIS Academy](https://academy.avisengine.com) Sandbox is a simulator in your browser. This
library lets you drive it from Python on your own computer, with your own editor and libraries
(OpenCV, PyTorch, ROS). You can write the script in either of two ways.

### setup() and loop(), like the Sandbox editor

```python
# my_driver.py
from avisengine import car

def setup():
car.setSpeed(30)

def loop():
img = car.getImage() # numpy array (120, 160, 3), BGR like OpenCV
sensors = car.getSensors() # [left, middle, right] in cm
car.setSteering(0)
```

```bash
python -m avisengine my_driver.py
```

This is the same code as the Sandbox's own editor, with the same API (`getImage`, `getDepth`,
`getSemanticLabels`, `getIMU`, `getGNSS`, `setControl` and more). Each Run in the browser loads
the file again, so edits apply on the next Run. See `example_sandbox.py`.

### A classic loop

Existing scripts work by changing one line:

```python
car = avisengine.Car()
car.connectSandbox() # instead of car.connect(ip, port)
while True:
car.setSpeed(20)
car.getData() # one simulation step
image = car.getImage()
```

### Connecting

Both print a port and a six-digit pairing code. In the Sandbox, open **Laptop Python**, enter
them and press **Connect**, then **Run**. The simulator waits for your code at every control step
(each `loop()` call, or each `getData()` call), so results do not depend on how fast your
computer is.

The connection stays on your computer: the script listens on 127.0.0.1 only, accepts only the
AVIS Academy page, and needs the pairing code. Graded practices always run in the browser.

In the Sandbox, `setSpeed` and `setSteering` take percent (-100 to 100), `getSpeed()` on the
classic `Car` is km/h as with the desktop simulator, and `setSensorAngle` is set in the Sandbox's
Sensors window instead.

## API Reference

### Car Class

#### Connection Methods
- `connect(ip, port)` - Connect to the simulator
- `connect(ip, port)` - Connect to the desktop simulator
- `connectSandbox(port=8765)` - Wait for the web Sandbox to connect (prints a pairing code)
- `getData()` - Retrieve the latest data from the simulator
- `stop()` - Stop the car and close the connection

Expand All @@ -148,6 +198,12 @@ The simulator includes a checkerboard pattern for camera calibration. Access thi

## Changelog

### Python API 0.2.0
- Drive the AVIS Academy web Sandbox: `python -m avisengine my_driver.py` (setup/loop) or `car.connectSandbox()` (classic loop)
- Installable package with `pip install avisengine`
- Fewer dependencies (numpy, opencv-python, Pillow, websockets)
- Tests for the desktop protocol and the Sandbox link

### 2.1.0 (Coming Soon)
- ZMQ communication protocol
- Configuration file support
Expand Down Expand Up @@ -217,4 +273,4 @@ For questions, issues, or feature requests:

---

Last updated: May 19, 2025
Last updated: November 26, 2026
220 changes: 0 additions & 220 deletions avisengine.py

This file was deleted.

Loading
Loading