Skip to main content

Rule-based navigation command from detections; protocol-agnostic (map output to MAVLink or your system).

Project description

nav-rules

nav-rules is a Python library that converts vision detections into a simple navigation command.

Input: detections + rules JSON
Output: heading + speed scale (+ diagnostics)

Install

pip install nav-rules

For local development:

pip install -e ".[dev]"

Usage

from pathlib import Path
from nav_rules import load_config, compute_navigation, Detection

config = load_config(Path("config_examples/example_rules.json"))
detections = [
    Detection(label="person", confidence=0.9, center_x=160, center_y=120, area_ratio=0.05),
]
cmd = compute_navigation(detections, config, frame_wh=(320, 240))
print(cmd.heading_command_deg, cmd.speed_scale, cmd.goal_visible)

What you provide

  • Detections: label, confidence, center_x, center_y, optional area_ratio, source.
  • Config: rules JSON (goal classes, obstacle classes, sectors, blending).
  • Details: docs/api.md, docs/rules_format.md.

What you get

NavigationCommand with:

  • heading_command_deg
  • speed_scale
  • avoid_side
  • goal_visible
  • selected_goal
  • heading_to_goal_deg
  • obstacle_scores

Map this output to MAVLink, ArduPilot, PX4, or your own controller.

Rule editor

A GUI lets you create and edit rules without writing JSON by hand. Run the editor, fill the form (goal classes, obstacle classes, blending, etc.), then save to generate a rules JSON file.

pip install ".[gui]"
nav-rules-edit                    # new config (defaults)
nav-rules-edit path/to/rules.json # open and edit existing
# or
python -m nav_rules.gui [path]

In the window: use Open to load a JSON file, Import to load rules and merge with defaults for missing fields (useful when fixing or upgrading existing rules), New to reset to defaults, Validate to check the form, and Save as JSON... to write the config. See docs/editor.md for the workflow.

License

MIT. See LICENSE.

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

heur_nav_rules-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

heur_nav_rules-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heur_nav_rules-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for heur_nav_rules-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c05a9ddbd807200e3931b893a1b37e623de2eb192bcd040fcc924b32d2c6ad8
MD5 b37a2cd45c20d0d4b60b4c148132c3f6
BLAKE2b-256 5be239b2563ea1186cc5e4d01c03b74bffe689ebcb59f0cf02d3e7db5534fd5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for heur_nav_rules-0.1.0.tar.gz:

Publisher: publish.yml on embeir/heur-nav-rules

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

File details

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

File metadata

  • Download URL: heur_nav_rules-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for heur_nav_rules-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 781681b40345ac00fcff29f86db7e1846677cf94db47b94c5f2a7538d3a2946b
MD5 91581af53cab5ad413bdb2e138504f3d
BLAKE2b-256 9ae0b14a14e8b272d1cf1250435d908ca10d3c79a47c944aafa381f3c7ee912f

See more details on using hashes here.

Provenance

The following attestation bundles were made for heur_nav_rules-0.1.0-py3-none-any.whl:

Publisher: publish.yml on embeir/heur-nav-rules

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