Skip to main content

A simple map representation and path planning library for 2D occupancy grids.

Project description

cartoblobpy

cartoblobpy is a small Python library for working with 2D occupancy grids, map images, and weighted graph representations for path planning. It can load maps from PNG images or YAML map descriptions, convert between world and grid coordinates, inspect occupancy values, plot maps, inflate obstacles, and build NetworkX graphs from free space.

Features

  • Load maps from image files or YAML map descriptions.
  • Work with start/goal markers embedded in map images.
  • Convert between world coordinates and grid coordinates in ENU or NED frames.
  • Query occupancy, free space, path validity, and distance to obstacles.
  • Plot occupancy grids and named layers with Matplotlib.
  • Build weighted graphs with NetworkX for path-planning workflows.
  • Access bundled example maps and persisted results from cartoblobpy.assets.

Installation

Install the package into your environment from the project root:

pip install -e .

If you prefer a regular install:

pip install .

The runtime dependencies are listed in requirements.txt.

Quick Start

Load a bundled example map, inspect it, and plot it:

from cartoblobpy.assets import get_map_path
from cartoblobpy.graph import Graph

graph = Graph()
graph.load_from_yaml(get_map_path("map012.yaml"))

print("grid shape:", graph.grid.shape)
print("resolution:", graph.resolution)
print("start:", graph.start)
print("goal:", graph.goal)

ax = graph.plot(show_start_goal=True, show_colorbar=True, cmap="gray_r")

If you already have a map image, load it directly:

from cartoblobpy.graph import Graph

graph = Graph()
graph.load_from_image("path/to/map.png")

Working With Maps

YAML map files are expected to define at least:

  • image: path to the map image, absolute or relative to the YAML file.
  • resolution: meters per pixel.
  • origin: map origin as [x, y, yaw].

Optional keys include:

  • start: start position in grid coordinates.
  • goal: goal position in grid coordinates.
  • layers: named layer images, optionally with value mappings.

Typical operations after loading a map include:

point = [2.5, 4.0]

graph.is_free(point)
graph.is_free_path([0.0, 0.0], [5.0, 5.0])
graph.value_at(point)
graph.distance_to_closest_obstacle(point)
graph.inflate_obstacles(radius=1.5)
graph.build_graph()

The graph object supports ENU and NED coordinate frames through the coordinate_frame property.

Bundled Assets

The cartoblobpy.assets module provides helpers for example data and saved results:

  • list_example_maps() lists the packaged YAML maps.
  • get_map_path(name) returns the absolute path to a bundled map.
  • save_result(result, filename) stores a pickle under assets/results.
  • load_result(filename) loads a saved result.
  • list_available_results() lists saved .pkl files.

Running Tests

Run the unittest suite with Python on Windows (PowerShell):

py -m unittest discover -s tests -p "test_*.py" -v

If py is unavailable, use your environment's Python:

python -m unittest discover -s tests -p "test_*.py" -v

Documentation

Sphinx documentation lives under docs/. Build it from the project root if you want the generated HTML docs.

License

cartoblobpy is distributed under the European Union Public Licence 1.2 (EUPL 1.2).

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

cartoblobpy-0.0.10.tar.gz (17.7 MB view details)

Uploaded Source

Built Distribution

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

cartoblobpy-0.0.10-py3-none-any.whl (16.4 MB view details)

Uploaded Python 3

File details

Details for the file cartoblobpy-0.0.10.tar.gz.

File metadata

  • Download URL: cartoblobpy-0.0.10.tar.gz
  • Upload date:
  • Size: 17.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cartoblobpy-0.0.10.tar.gz
Algorithm Hash digest
SHA256 4537f3ca1b969d216df885d555637bfecacad0ab2df680c06da3719b7e686d66
MD5 f34a4691d6e82add0d40daf3bd1561dd
BLAKE2b-256 0fc0a044f52fa948fd7902a54ec77bd16030f5d6d5f74ba5c1c25c2f24af9596

See more details on using hashes here.

Provenance

The following attestation bundles were made for cartoblobpy-0.0.10.tar.gz:

Publisher: publish.yml on incebellipipo/cartoblobpy

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

File details

Details for the file cartoblobpy-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: cartoblobpy-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 16.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cartoblobpy-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 07814c439f36606d21d5246acc62897d19d471c33a39f81051ef37b0ef8879e9
MD5 7f2e4e35ce0a2701bac06b59b3df6b7d
BLAKE2b-256 f83bc0f508322b687001e322a25c1c41e636154181cb82f71db1c92e93e592e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cartoblobpy-0.0.10-py3-none-any.whl:

Publisher: publish.yml on incebellipipo/cartoblobpy

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