Skip to main content

A simple GUI to create 2D scenes with obstacles and drone paths for multi-agent path planning algorithms

Project description

SceneBuilder

Overview

SceneBuilder is a Python package that provides a Matplotlib-based GUI for designing 2D test environments for use in multiagent path planning algorithms. Users can draw polygons to represent obstacles and arrows to indicate the starting and ending points of each agent's path.

Example Scene 1 Example Scene 2

Installation

To install SceneBuilder, you have two options:

  1. Using pip (recommended):

    pip install scenebuilder
    
  2. From source:

    git clone git@github.com:enac-drones/scenebuilder.git
    pip install -e .
    

Prerequisites

SceneBuilder's prerequisites are defined in the pyproject.toml file and include Matplotlib and numpy.

Quick Start Guide

Using Command-Line Options

You can use SceneBuilder directly from the command line with the following option:

  • -l, --load: Specify a JSON file path to load an existing scene.

Example usage:

scenebuilder --load path/to/scene.json
scenebuilder -l     path/to/scene.geojson

In Code

To use SceneBuilder in code, you need to create an instance of the SceneBuilder class and invoke the draw_scene() method. Below is a simple example to get you started:

from scenebuilder import SceneBuilder

# Create an instance of the SceneBuilder
scene = SceneBuilder()

# Open the GUI to draw a scene
scene.draw_scene()

Alternatively, load in an existing compatible json file for modification:

scene = SceneBuilder()
scene.load_scene("path/to/your_file.json")
scene.draw_scene()

Features

  • Draw Obstacles: Click within the GUI to place vertices of polygons that represent obstacles. Press Tab to complete an obstacle.
  • Add new obstacle vertices: To add new vertices, click somewhere on the polygon's perimeter and drag to move the vertex to its desired location.
  • Set Drone Paths: Click once to place the starting point, and again to place the goal of an agent/drone. An arrow will automatically be drawn from start to goal.
  • Move or adjust existing obstacles/drones: Obstacles and drones can be moved by clicking and dragging. Drone start and goal points, as well as existing obstacle vertices can be moved in the same way.
  • Switch between Obstacle and Drone Modes: Press b to switch to building/obstacle mode. Press d to switch to drone/agent mode. Alternatively click the Switch button on the bottom left of the gui.
  • Delete obstacles: Select the obstacle and press delete or backspace. NOTE this is not yet available for drones.
  • Clear temporary points: To clear building vertices prior to completing the building, or to remove a drone's starting point before placing the goal, press 'esc' or 'escape'.
  • Undo drone/obstacle placement: To remove the last obstacle or drone that was placed, press z or ctrl+z. *
  • Reset Scene: To reset the scene to a blank canvas, click the Reset button in the gui.

*Note: due to a quirk in tkinter, some standard keystrokes starting with ctrl/cmd are sometimes captured by the system instead of SceneBuilder, for this reason we provide the option to use them without the leading ctrl/cmd, for example "z" instead of "ctrl/cmd + z" for undo. This applies for the following commands usually found in the 'edit' dropdown menu on most systems: undo, redo, copy, paste, cut **

**Not all of undo, redo, copy, paste, cut are currently implemented, this is a work in progress.

Saving Scenes

Once you have created a scene, you can save it to a JSON or GeoJSON file by clicking the 'Save' button in the GUI. You will then be prompted to select whether you want to use our basic JSON format or GeoGSON.

Unless otherwise specified, the file is saved as "scenebuilder.json" in the current working directory.

Contributing

Contributions to SceneBuilder are welcome! If you have suggestions for improvements or new features, feel free to create an issue or pull request on our GitHub 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

scenebuilder-0.2.5.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

scenebuilder-0.2.5-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file scenebuilder-0.2.5.tar.gz.

File metadata

  • Download URL: scenebuilder-0.2.5.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Darwin/23.5.0

File hashes

Hashes for scenebuilder-0.2.5.tar.gz
Algorithm Hash digest
SHA256 0e8ecdb351e1d7e8b33daec6819182f867e548e9b00577e586cdd86f64d2248e
MD5 aa234229689fd4d2da3321766eae3748
BLAKE2b-256 3f052502ded3d45c4adc2a6b4b0fca08efcb890ab5aefdb7f551398f452fcda3

See more details on using hashes here.

File details

Details for the file scenebuilder-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: scenebuilder-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Darwin/23.5.0

File hashes

Hashes for scenebuilder-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b33f9aadac3ee0e7e062232523f43eb1d2c1b94da6ebd0f85ed76a4e346de460
MD5 99833fd62bd6afb9036f462d5a54a529
BLAKE2b-256 ee20bbc1aa8d0dccf56ffb5a4d0fc8e1124493cb8fe897847850577bca9425e5

See more details on using hashes here.

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