Skip to main content

Comprehensive SDK for building autonomous vehicle systems with modular sensors, controllers, planners, and alert systems

Project description

Simple Autonomous Car SDK

CI PyPI version codecov License: MIT PyPI - Downloads

A comprehensive Python SDK for building autonomous vehicle systems with modular sensors, controllers, planners, and alert systems. Designed for researchers, engineers, and developers working on autonomous vehicle systems.

Features

  • ๐Ÿš— Modular Car System: Add multiple sensors, controllers, and planners
  • ๐ŸŽฏ Multiple Coordinate Frames: Global, Ego, Sensor, and Frenet frame support
  • ๐Ÿ‘๏ธ Modular Sensors: LiDAR and extensible sensor system (add Camera, Radar, etc.)
  • ๐ŸŽฎ Control Systems: Built-in Pure Pursuit and PID controllers, extensible architecture
  • ๐Ÿ—บ๏ธ Planning Systems: Track planner and extensible planning framework
  • ๐Ÿšจ Alert Systems: Track bounds alert system with extensible architecture
  • ๐Ÿ”„ Frame Conversions: Comprehensive utilities for coordinate transformations
  • ๐Ÿ“Š Visualization: Rich visualization tools for debugging and analysis
  • ๐Ÿงช Well Tested: Comprehensive test suite with CI/CD

Installation

From PyPI

pip install simple_autonomous_car

From Source

git clone https://github.com/yourusername/simple_autonomous_car.git
cd simple_autonomous_car
pip install -e .

With uv (Recommended)

uv pip install simple_autonomous_car

Quick Start

from simple_autonomous_car import (
    Track,
    Car,
    CarState,
    LiDARSensor,
    PurePursuitController,
    TrackPlanner,
    FrenetMap,
    TrackBoundsAlert,
)

# Create track and car
track = Track.create_simple_track()
car = Car(initial_state=CarState(x=0.0, y=0.0, heading=0.0, velocity=8.0))

# Add sensors to car
ground_truth_map = GroundTruthMap(track)
perceived_map = PerceivedMap(ground_truth_map)
lidar = LiDARSensor(ground_truth_map, perceived_map, max_range=40.0)
car.add_sensor(lidar)

# Create planner and controller
planner = TrackPlanner(track)
controller = PurePursuitController(target_velocity=10.0)

# Control loop
for step in range(100):
    plan = planner.plan(car.state)
    perception_data = car.sense_all()
    control = controller.compute_control(car.state, perception_data, plan)
    car.update(dt=0.1, **control)

Architecture

Modular Design

Car
โ”œโ”€โ”€ Sensors (LiDAR, Camera, Radar, etc.)
โ”œโ”€โ”€ Controller (Pure Pursuit, PID, MPC, etc.)
โ””โ”€โ”€ Planner (Track Planner, A*, RRT, etc.)

Data Flow

Planner โ†’ Plan โ†’ Controller โ†’ Control Commands โ†’ Car
                โ†‘
         Sensors โ†’ Perception Data

Documentation

Comprehensive documentation is available in the docs/ directory:

See the Documentation Index for a complete overview.

Key Concepts

Modular Components

  • Car: Vehicle with dynamics, can have multiple sensors
  • Sensors: Modular sensor system (LiDAR, Camera, Radar, etc.)
  • Controllers: Control algorithms (Pure Pursuit, PID, MPC, etc.)
  • Planners: Path planning algorithms (Track Planner, A*, RRT, etc.)

Coordinate Frames

  • Global Frame: World coordinates (track reference)
  • Ego Frame: Car-centered (x=forward, y=left)
  • Sensor Frame: Sensor-centered coordinates
  • Frenet Frame: Path-aligned (s=distance along path, d=lateral offset)

Tutorials and Examples

Jupyter Notebooks

Interactive tutorials are available in the notebooks/ directory:

Code Examples

  • Unified Simulation Runner - Config-based simulation runner with enhanced visualization
    • Run with: python -m simulations.simulation simple_track or python -m simulations.simulation race_track
    • Supports custom configs via --config flag

Notebooks

The SDK includes comprehensive Jupyter notebooks organized by category:

Tutorials (notebooks/tutorials/)

Building Custom Components (notebooks/building/)

Learning Notebooks (notebooks/learning/) - Fill-in-the-Blank

Incomplete notebooks where you fill in the code - perfect for hands-on learning:

Examples

Adding Multiple Sensors

# Add front LiDAR
front_lidar = LiDARSensor(..., name="front_lidar", pose_ego=np.array([1.0, 0.0, 0.0]))
car.add_sensor(front_lidar)

# Add rear LiDAR
rear_lidar = LiDARSensor(..., name="rear_lidar", pose_ego=np.array([-1.0, 0.0, np.pi]))
car.add_sensor(rear_lidar)

# Get data from all sensors
perception_data = car.sense_all()

Using Controller with Planner

# Create planner and controller
planner = TrackPlanner(track)
controller = PurePursuitController(target_velocity=10.0)

# Control loop
plan = planner.plan(car.state)
control = controller.compute_control(car.state, perception_data, plan)
car.update(dt=0.1, **control)

Building Custom Components

# Custom sensor
class MySensor(BaseSensor):
    def sense(self, car_state, environment_data):
        # Your sensor logic
        return PerceptionPoints(points, frame="ego")

# Custom controller
class MyController(BaseController):
    def compute_control(self, car_state, perception_data, plan):
        # Your control logic
        return {"acceleration": 0.0, "steering_rate": 0.0}

# Custom planner
class MyPlanner(BasePlanner):
    def plan(self, car_state, perception_data, goal):
        # Your planning logic
        return waypoints

Development

# Clone repository
git clone https://github.com/yourusername/simple_autonomous_car.git
cd simple_autonomous_car

# Install with uv
uv sync --dev

# Run tests
uv run pytest

# Run linting
uv run black src tests
uv run ruff check src tests
uv run mypy src

# Install pre-commit hooks
uv run pre-commit install

Project Structure

simple_autonomous_car/
โ”œโ”€โ”€ src/simple_autonomous_car/
โ”‚   โ”œโ”€โ”€ car/             # Car model with sensor support
โ”‚   โ”œโ”€โ”€ sensors/         # Modular sensor system
โ”‚   โ”œโ”€โ”€ control/         # Control algorithms
โ”‚   โ”œโ”€โ”€ planning/        # Path planning algorithms
โ”‚   โ”œโ”€โ”€ alerts/          # Alert systems
โ”‚   โ”œโ”€โ”€ maps/            # Map representations
โ”‚   โ”œโ”€โ”€ perception/      # Perception data structures
โ”‚   โ”œโ”€โ”€ frames/          # Frame conversion utilities
โ”‚   โ”œโ”€โ”€ track/           # Track generation
โ”‚   โ””โ”€โ”€ visualization/   # Visualization tools
โ”œโ”€โ”€ docs/                # Documentation
โ”œโ”€โ”€ notebooks/           # Jupyter notebooks
โ”œโ”€โ”€ tests/               # Test suite
โ””โ”€โ”€ src/simulations/     # Example simulations

Contributing

Contributions are welcome! Please see Contributing Guidelines for details.

License

MIT License - see LICENSE file for details.

Citation

If you use this SDK in your research, please cite:

@software{simple_autonomous_car,
  title = {Simple Autonomous Car SDK},
  author = {Your Name},
  year = {2024},
  url = {https://github.com/yourusername/simple_autonomous_car}
}

Acknowledgments

Inspired by the AutonomousVehicleControlBeginnersGuide repository.

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

simple_autonomous_car-0.1.2.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

simple_autonomous_car-0.1.2-py3-none-any.whl (75.2 kB view details)

Uploaded Python 3

File details

Details for the file simple_autonomous_car-0.1.2.tar.gz.

File metadata

  • Download URL: simple_autonomous_car-0.1.2.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for simple_autonomous_car-0.1.2.tar.gz
Algorithm Hash digest
SHA256 83670d4cadadce523498e558d5de1d7e17155c4196d1dda0973c591b9300d849
MD5 23fbd856dd6ddbfc3b1c6284ae3d8ec0
BLAKE2b-256 b3d5c884a03702d02a5f8accddb6dda6c9105e597cab058a9abe18f444927d3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_autonomous_car-0.1.2.tar.gz:

Publisher: publish.yml on guilyx/simple_autonomous_car

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_autonomous_car-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_autonomous_car-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23886d9154fb67413c61f8345ba52c38cb90209c37d8463c098abe64f976964b
MD5 9cb28c8d281daa413b1324eb60ee216f
BLAKE2b-256 bc182c7269aba3acd82b75f86ba252847f51429bca12de7606dd0639bf325956

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_autonomous_car-0.1.2-py3-none-any.whl:

Publisher: publish.yml on guilyx/simple_autonomous_car

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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