Skip to content

Run drone simulators, firmware, and experiment scripts from a unified interface (currently Sphinx, more planned)

License

Notifications You must be signed in to change notification settings

SpaceTime-Vision-Robotics-Laboratory/drone-sim-runner

Repository files navigation

Drone Simulation Runner

Ubuntu Ruff Linter

Python Version License: AFL-3.0

A tool for orchestrating drone simulation experiments.

Overview

drone-sim-runner is a Python package that simplifies running drone simulations by managing multiple processes:

  1. Simulator: Launches the simulation environment (currently Parrot Sphinx/UE4)
  2. Firmware: Starts the drone firmware to connect to the simulator (compatible with Sphinx Sim)
  3. Script: Executes your experiment/control algorithm

The package handles process lifecycle, initialization detection, logging, and cleanup automatically.

Installation

In a virtual environment

python -m pip install -e .

For running the examples with Parrot Sphinx:

python -m pip install -r requirements-optional.txt

Prerequisites (for Sphinx simulator)

  • Will work on GNU/Linux systems only (Ubuntu and Debian supported by Sphinx currently)
  • Parrot Sphinx simulator installed
  • Parrot UE4 environment (e.g., sudo apt install parrot-ue4-empty as in example-config.yaml)
  • A .env file with your AUTH variable for sudo operations

Note: You will need a .env at the base project level that has the root password under a variable named AUTH. For example:

AUTH=YOUR-SUDO-PASSWORD

This is needed to run the following command:

sudo systemctl restart firmwared.service

Project Structure

drone-sim-runner/
├── core/       # Shared utilities (logging, process management)
└── sphx/       # Sphinx-specific implementation

Usage

Available examples are provided with a configuration file, the script will open the Parrot Sphinx ue4-empty map, load the Anafi 4K drone firmware and then run the takeoff and land script. Running the example:

python -m pip install -e .
python examples/run_sphinx_simulator_take_off_and_land.py

Using in your projects

Configuration File

Create a YAML configuration file similar to examples/example-config.yaml to define your simulation setup. If no additional .fbx files (Parrot Sphinx supports only these files) are needed that field can be left empty. If they are needed you need to provide the path from the base directory where the .fbx config .yaml file lives, and it must match this structure:

├── config
│   └── add_car.yaml
├── models
│   └── car.fbx

This is needed because in add_car.yaml the FBX path is given a relative path to avoid hardcoding absolute paths (whom are needed by Parrot Sphinx -config-file parameter):

FbxPath: "${MODELS_DIR}/car.fbx"

For scripts arguments if custom parameters are needed they can be added in the YAML configuration file based on your needs. If paths need to be provided (e.g., for creating output directories) you can pass them with ${output_dir}/ placeholder to avoid hardcoding paths in the YAML.

Your custom controller

Your controller script can accept custom arguments via argparse.ArgumentParser(). These must match the keys defined under args in the YAML configuration file.

For example, given this config:

args:
  --log_path: "${output_dir}/logs"
  --sleep_time: 10

Your script should have:

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("--sleep_time", type=int, help="Time in seconds to wait.")
parser.add_argument("--log_path", type=str, help="Where to store the logs.")
args = parser.parse_args()

Roadmap

  • MuJoCo support

About

Run drone simulators, firmware, and experiment scripts from a unified interface (currently Sphinx, more planned)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages