Skip to main content

intsys car v1

This repository contains code run on our intsys cars (v1). It's primarily code to control the motors, servos and sensors.

Fahrzeug-Konfiguration

Pins und Kalibrierung eines Autos stehen in /etc/intsys/car.toml (zentral per Ansible gepflegt, anderer Pfad über INTSYS_CAR_CONFIG). Die Abschnitte passen direkt zu den Konstruktoren:

from gpiozero.pins.lgpio import LGPIOFactory
from intsys_car_v1 import load_car_config, Motor, Servo, HC_SR04, AnalogGrayscale

car = load_car_config()
factory = LGPIOFactory()
motor_links = Motor(factory=factory, **car["motor_left"])
lenkung = Servo("Lenkung", **car["servo_steering"])
ultraschall = HC_SR04(factory=factory, **car["ultrasonic"])
linie = AnalogGrayscale(**car["line_sensor"])

Fehlt die Datei, gilt der Standard (CAR_CONFIG_STANDARD). Unbekannte Schlüssel oder falsche Typen lösen ValueError aus.

Änderungen in 0.0.6

  • Motor: Rückwärts wird mit min_speed_to_move gleich skaliert wie vorwärts (vorher maximal 50 % und Stillstand zwischen 0 und −33). Richtung wird vor der Leistung gesetzt. Neu: close().
  • Servo: min_angle/max_angle begrenzen den gewünschten Winkel vor compensate_angle, also symmetrisch um die kalibrierte Mitte; danach Begrenzung auf ±90°. Kein print mehr, numpy-Zahlen erlaubt.
  • I2C: Bus-Sperre für alle Zugriffe; nach fünf Fehlversuchen OSError statt still False. Adresssuche ohne i2cdetect, einmal pro Prozess. Ein Logger pro Klasse.
  • AnalogGrayscale: findet die Controller-Adresse wie die PWM, misst als eine gesperrte Transaktion mit Wiederholung, akzeptiert "A0"…"A7", warnt bei Kanälen, die kein ADC-Eingang sind. Neu: close().
  • HC_SR04: Zeitlimit 40 ms beim Warten auf Beginn und Ende des Echos (vorher ohne Limit bzw. abhängig von der CPU), perf_counter statt time.time. factory ist optional und wird erst im Konstruktor erzeugt; import intsys_car_v1 öffnet keinen GPIO-Chip mehr. Neu: temperature_c, close().
  • load_car_config() / CAR_CONFIG_STANDARD für /etc/intsys/car.toml.
  • Paket: Python ≥ 3.11, opencv-python-headless statt opencv-python, gpiozero als Abhängigkeit. lgpio und picamera2 kommen aus Raspberry Pi OS.

Entwicklungsumgebung

mise trust          # einmalig: mise.toml freigeben
mise install        # installiert uv
mise run dev        # Paket editierbar + Test-Extras in .venv installieren

mise legt beim Betreten des Ordners .venv (Python 3.11 wie auf den Autos, von uv bereitgestellt) an und aktiviert sie automatisch – python und pytest kommen dann aus .venv. Voraussetzung: mise ist in der Shell aktiviert (mise activate).

Tests

mise run test
# ohne mise:
pip install -e '.[test]' && python -m pytest

Laufen ohne Raspberry Pi (I2C-Attrappe, gpiozero MockFactory).

Build & Upload (PyPI)

Voraussetzung: Entwicklungsumgebung wie oben eingerichtet (uv kommt über mise).

API-Tokens

Die Tokens gehören ausschließlich in die Datei .env im Wurzelverzeichnis dieses Repos. Sie ist git-ignoriert; eingecheckt wird nur die Vorlage .env.template.

cp .env.template .env

Dann in .env eintragen:

Variable Für Token erstellen
PYPI_TOKEN mise run publish https://pypi.org/manage/account/token/
TESTPYPI_TOKEN mise run publish:test https://test.pypi.org/manage/account/token/

Tokens beginnen mit pypi-…. TestPyPI ist ein eigener Dienst mit eigenem Account und eigenem Token. Am besten das Token auf das Projekt intsys_car_v1 beschränken. mise lädt .env automatisch und blendet die Werte in seinen Ausgaben aus.

Ablauf

  1. version in pyproject.toml erhöhen (eine Version lässt sich nur einmal hochladen).
  2. Bauen und prüfen:
    mise run build          # dist/*.whl + dist/*.tar.gz, danach twine check
    
  3. Erst auf TestPyPI, dann ausprobieren:
    mise run publish:test
    pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ intsys_car_v1
    
  4. Auf PyPI:
    mise run publish
    

publish und publish:test bauen vorher immer frisch (clean → build). Alle Tasks: mise tasks.

Metadata

Release files for intsys_car_v1 0.0.6

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

Source distribution (sdist)

Source distribution for intsys_car_v1 0.0.6
File Size Uploaded Provenance Actions
intsys_car_v1-0.0.6.tar.gz 32.5 kB Without provenance Details for intsys_car_v1-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for intsys_car_v1 0.0.6
File Interpreter ABI Platform Actions
intsys_car_v1-0.0.6-py3-none-any.whl Python 3 none any Details for intsys_car_v1-0.0.6-py3-none-any.whl

Total release size: 64.4 kB

Release files / intsys_car_v1-0.0.6.tar.gz

Download URL intsys_car_v1-0.0.6.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c03ba6858da60e9020ec750389dd49a529327584ddea94709b8c0e51cf363801
BLAKE2b-256 checksum
How to use checksums
206894e35e510b38498bfa5fa148e836c92432bdf9ffdfe2ceab8224547edb4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / intsys_car_v1-0.0.6-py3-none-any.whl

Download URL intsys_car_v1-0.0.6-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c1b0659bbd7bce940e9a69592bc22d3ab7a4f49c1b01b3637b2b0f147a1f4a9
BLAKE2b-256 checksum
How to use checksums
0e7afcf4eb353748d5888c0a142836df6d0b9f473aa79b4c40636e406b0a6d99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for intsys_car_v1 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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