Skip to main content

UAV Flight Simulator Gymnasium Environments for Reinforcement Learning Research.

Project description

GitHub CI pre-commit hits total downloads weekly downloads

PyFlyt - UAV Flight Simulator Gymnasium Environments for Reinforcement Learning Research

This is a library for testing reinforcement learning algorithms on UAVs. This repo is still under development. We are also actively looking for users and developers, if this sounds like you, don't hesitate to get in touch!

PyFlyt currently supports two separate UAV platforms:

Table of Contents

Installation

pip3 install pyflyt

Usage

Usage is similar to any other Gymnasium and (soon) PettingZoo environment:

import gymnasium
import PyFlyt.gym_envs

env = gymnasium.make("PyFlyt/QuadX-Hover-v0")

# omit the below line to remove rendering and let the simulation go as fast as possible
env.render()
obs = env.reset()

termination = False
truncation = False
while not termination and not truncation:
    observation, reward, termination, truncation, info = env.step(env.action_space.sample())

Environments

PyFlyt/QuadX-Hover-v0

A simple environment where an agent can learn to hover. The environment ends when either the quadcopter collides with the ground or exits the permitted flight dome.

env = gymnasium.make(
  "PyFlyt/QuadX-Hover-v0",
  flight_dome_size: float = 3.0,
  max_duration_seconds: float = 10.0,
  angle_representation: str = "quaternion",
  agent_hz: int = 40,
  render_mode: None | str = None,
)

angle_representation can be either "quaternion" or "euler".

render_mode can be either "human" or rgb_array or None.

PyFlyt/QuadX-Waypoints-v0

A simple environment where the goal is to fly the quadrotor to a collection of random waypoints in space within the permitted flight dome. The environment ends when either the quadrotor collides with the ground or exits the permitted flight dome.

env = gymnasium.make(
  "PyFlyt/QuadX-Waypoints-v0",
  sparse_reward: bool = False,
  num_targets: int = 4,
  use_yaw_targets: bool = False,
  goal_reach_distance: float = 0.2,
  goal_reach_angle: float = 0.1,
  flight_dome_size: float = 5.0,
  max_duration_seconds: float = 10.0,
  angle_representation: str = "quaternion",
  agent_hz: int = 30,
  render_mode: None | str = None,
)

angle_representation can be either "quaternion" or "euler".

render_mode can be either "human" or rgb_array or None.

PyFlyt/Fixedwing-Waypoints-v0

A simple environment where the goal is to fly a fixedwing aircraft towards set of random waypionts in space within the permitted flight dome. The environment ends when either the aircraft collides with the ground or exits the permitted flight dome.

env = gymnasium.make(
  "PyFlyt/Fixedwing-Waypoints-v0",
  sparse_reward: bool = False,
  num_targets: int = 4,
  goal_reach_distance: float = 2.0,
  flight_dome_size: float = 100.0,
  max_duration_seconds: float = 120.0,
  angle_representation: str = "quaternion",
  agent_hz: int = 30,
  render_mode: None | str = None,
)

angle_representation can be either "quaternion" or "euler".

render_mode can be either "human" or rgb_array or None.

PyFlyt/Rocket-Landing-v0

An environment where the goal is to land a rocket on a landing pad at a speed of less than 1 m/s and comes to a halt successfully. The 4 m tall rocket starts off with only 1% of fuel and is dropped from a height of 450 meters with a random linear and rotational velocity. The environment ends when the rocket lands outside of the landing pad, or hits the landing pad at more than 1 m/s.

env = gymnasium.make(
  "PyFlyt/Rocket-Landing-v0",
  sparse_reward: bool = False,
  ceiling: float = 500.0,
  max_displacement: float = 200.0,
  max_duration_seconds: float = 10.0,
  angle_representation: str = "quaternion",
  agent_hz: int = 40,
  render_mode: None | str = None,
  render_resolution: tuple[int, int] = (480, 480),
)

angle_representation can be either "quaternion" or "euler".

render_mode can be either "human" or rgb_array or None.

Citation

If you use our work in your research and would like to cite it, please use the following bibtex entry:

@software{pyflyt2023github,
  author = {Jun Jet Tai and Jim Wong},
  title = {PyFlyt - UAV Flight Simulator Gymnasium Environments for Reinforcement Learning Research},
  url = {http://github.com/jjshoots/PyFlyt},
  version = {1.0.0},
  year = {2023},
}

Project details


Release history Release notifications | RSS feed

This version

0.5.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyFlyt-0.5.3.tar.gz (153.3 kB view details)

Uploaded Source

Built Distribution

PyFlyt-0.5.3-py3-none-any.whl (172.2 kB view details)

Uploaded Python 3

File details

Details for the file PyFlyt-0.5.3.tar.gz.

File metadata

  • Download URL: PyFlyt-0.5.3.tar.gz
  • Upload date:
  • Size: 153.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for PyFlyt-0.5.3.tar.gz
Algorithm Hash digest
SHA256 982d04fa730ffb2e41109b91060e57413c020ded3c52001d22b647359bdf0df2
MD5 80a2f6ff14e380457d5cae6c3500b4de
BLAKE2b-256 2e15a3715df86c044e7366a08d84c3d76ad525f33b2e3f951864ba485615eb62

See more details on using hashes here.

File details

Details for the file PyFlyt-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: PyFlyt-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 172.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for PyFlyt-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f7c5a2d1fcfca2071a286435ca7532e3794d5e71acee53e2bf947a025fca081f
MD5 d5a8d601107a844d74e5d01fac27c337
BLAKE2b-256 9aadb97c99133aab538bd6edd5d7d292e929b334fa9764768d7bc948a9b304c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page