Skip to main content

Nav Sim

A lightweight 2D simulation framework for mobile robot navigation using Pygame, with support for sensors, external controllers, and interactive visualization.


Compile

python.exe -m build   

python.exe -m twine upload dist/*

sudo apt install python3-tk

Necessário colocar a API token obtida do site pipy.


🚀 Key Features

  • Dual Environment Representation: Supports both traditional coordinate-based circular obstacles AND image-based Occupancy Grid Maps.
  • Interactive GUI:
    • Map Loading: Load maps dynamically during simulation with custom resolution.
    • Theming: Dynamic switching between Light and Dark themes.
    • Map Panning: Drag the environment view using SHIFT + Right Click.
  • Map Generation (Benchmarking): Built-in MapGenerator for 'U', 'L', and Random maze patterns.
  • Precision Sensing: Ray-casting based LiDAR using DDA algorithm for accurate grid-based collision.

🏗️ Architecture

  • ✅ Simulator (nav_sim): Handles physics, UI, sensors, and environment.
  • ✅ Occupancy Grid: Automatic conversion of images to binary/inflated grids for collision and LiDAR.
  • ✅ External Controllers: Easily pluggable navigation strategies.

Supported Robot Models

  • holonomic
    Command:

    {"vx": ..., "vy": ...}
    
  • differential
    Command:

    {"v": ..., "omega": ...}
    
  • ackermann
    Command:

    {"speed": ..., "steer": ...}
    

📡 Sensors

LiDAR (2D)

The simulator provides a configurable 2D LiDAR:

  • Angular scan
  • Range-limited
  • Returns (angle, distance, hit_point)

⚙️ Installation

python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

pip install -r requirements.txt

▶️ Run Examples

python examples/run_holonomic.py
python examples/run_differential.py
python examples/run_maze.py

🗺️ Occupancy Grid Maps

You can define map sources directly in your config or load them dynamically:

world:
  map_image: "maze.png"
  resolution: 0.1
  show_inflation: true
theme: "dark"

⌨️ User Interaction

  • Left Click: Set Waypoint.
  • Right Click: Add Obstacle (opens radius dialog).
  • SHIFT + Right Click: Pan/Drag the environment.
  • Scroll: Zoom.
  • UI Panel: Toggle LiDAR, switch themes, load new maps.

🧩 Controller Interface

def controller(robot, world, goal, config, dt, lidar_readings=None) -> dict:
    ...

🛑 Collision Handling

The simulator detects collisions using: d <= r_robot + r_obstacle

  • Immediate stop.
  • Visual indicator (💥) displayed.

📄 License

Free for educational and research use.

Metadata

Release files for nav-sim2d 0.1.3.1.3

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

Source distribution (sdist)

Source distribution for nav-sim2d 0.1.3.1.3
File Size Uploaded Provenance Actions
nav_sim2d-0.1.3.1.3.tar.gz 2.0 MB Without provenance Details for nav_sim2d-0.1.3.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nav-sim2d 0.1.3.1.3
File Interpreter ABI Platform Actions
nav_sim2d-0.1.3.1.3-py3-none-any.whl Python 3 none any Details for nav_sim2d-0.1.3.1.3-py3-none-any.whl

Total release size: 3.9 MB

Security for nav-sim2d 0.1.3.1.3

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.

Release history Release notifications | RSS feed

This release

0.1.3.1.3 This release

2 release files No provenance

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