UAV Flight Simulator Gymnasium Environments for Reinforcement Learning Research.
Project description
PyFlyt - UAV Flight Simulator Gymnasium Environments for Reinforcement Learning Research
View the documentation here!
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:
-
QuadX
- Quadrotor UAV in the X configuration
- Inspired by the original pybullet drones by University of Toronto's Dynamic Systems Lab
- Actual full cascaded PID flight controller implementations for each drone.
- Actual motor RPM simulation using first order differential equation.
- For developers - 8 implemented flight modes that use tuned cascaded PID flight controllers, available in
PyFlyt/core/drones/quadx.py
.
-
Fixedwing
- Small tube-and-wing fixed wing UAV with a single motor (< 3 Kg)
- Aerofoil characteristics derived from the paper: Real-time modeling of agile fixed-wing UAV aerodynamics
-
Rocket
- 1:10th scale SpaceX Falcon 9 v1.2 first stage and interstage
- Mass and geometry properties extracted from Space Launch Report datasheet
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 # noqa
env = gymnasium.make("PyFlyt/QuadX-Hover-v0", render_mode="human")
obs = env.reset()
termination = False
truncation = False
while not termination or 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"
orrgb_array
orNone
.
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"
orrgb_array
orNone
.
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"
orrgb_array
orNone
.
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"
orrgb_array
orNone
.
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PyFlyt-0.6.0.tar.gz
.
File metadata
- Download URL: PyFlyt-0.6.0.tar.gz
- Upload date:
- Size: 155.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca54442ca0b5a3f2f44f70d3836e1adbc4c84dda68789c8f204200fbadfbde13 |
|
MD5 | b651a2b5d99fdf6e335df647293f7d18 |
|
BLAKE2b-256 | fa08ba2673e65e237f9fc5536a76d76da057472bf8296302ea5acb36cc41a83a |
File details
Details for the file PyFlyt-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: PyFlyt-0.6.0-py3-none-any.whl
- Upload date:
- Size: 175.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b2cd3244bc0cdc62e3b35b5f6ec711801d25887dcc9e813b8029e002317c0d |
|
MD5 | 3dc5cb3749c996622ab58a0d0ba440ac |
|
BLAKE2b-256 | f8194b96a27a1eeabb0082ea5700d7d17211e88967152824d313fbddaf7974d0 |