Skip to main content

Rocket Landing Gym

Open AI Gym for vertical rocket landing containing an extensive tool to incorporate curriculum learning for your agents.

Installation

pip install rocketgym

Minimal usage

from rocketgym.environment import Environment
import random

env = Environment()
observation = env.reset()
done = False

while not done:
    observation, reward, done, info = env.step(random.randint(0, 3))
    env.render()

Environment

Rocket

Rocket is treated as a 2D free body. Its physics properties have been modeled after Falcon 9. By default rocket is spawned

State space

  1. Angle made with y-axis ($rad$): [$-\frac{\pi}{2},\frac{\pi}{2}$]
  2. Position Y ($m$): $[0,\infty]$
  3. Velocity X ($\frac{m}{s}$): $[-\infty,\infty]$
  4. Velocity Y ($\frac{m}{s}$): $[-\infty,\infty]$
  5. Angular velocity ($\frac{rad}{s}$): $[-\infty,\infty]$

Action space

At each timestep, rocket can perform one of the four actions:

  1. Left - rotate the engine to the left and set maximum thrust
  2. Mid - rotate the engine to the middle and set maximum thrust
  3. Right - rotate the engine to the right and set maximum thrust
  4. None - turn off thrust

Reward

Reward function takes multiple components into consideration:

  1. For each second, agent looses $0.3$.
  2. For impact with the ground, agent receives $15$.
  3. At impact, agent looses $0.5$ for each $rad$ off the vertical axis.
  4. At impact, agent looses $0.25$ for each $\frac{rad}{s}$ of angular velocity
  5. At impact, agent looses $1$ for each $\frac{m}{s}$ away from $-1\frac{m}{s}$ vertical velocity
  6. At impact, agent looses $0.25$ for each $\frac{m}{s}$ of horizontal velocity

Curriculum Learning

The best part about this gym. It allows you to alter the difficulty of the environment by changing things like initial height, action space etc.

Spawn height

from rocketgym.environment import Environment

env = Environment()
env.curriculum.set_fixed_height()
env.curriculum.set_random_height(1,5)

env.curriculum.enable_random_height()
env.curriculum.disable_random_height()

env.curriculum.enable_increasing_height(rate=0.05)
env.curriculum.disable_increasing_height()

Spawn orientation

env.curriculum.enable_random_starting_rotation()
env.curriculum.disable_random_starting_rotation()

Altering the reward function

env.curriculum.enable_x_velocity_reward()
env.curriculum.disable_x_velocity_reward()

Dashboard

This module enables saving flight logs. Logs will be saved in logs/plots directory.

Sample usage

from rocketgym.dashboard import Dashboard

# Creating logger
dash = Dashboard()

# Saving flight log
dash.plot_log(env.rocket.flight_log, episode=0)

Metadata

Release files for rocketgym 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rocketgym 0.0.13
File Size Uploaded
rocketgym-0.0.13.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for rocketgym 0.0.13
File Interpreter ABI Platform
rocketgym-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 3.0 MB

Release files / rocketgym-0.0.13.tar.gz

Download URL rocketgym-0.0.13.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
aa6dfe7bd371d37b6e8ed23955367eda554f85efe80341bed80d95462f7e8b8b
BLAKE2b-256 checksum
How to use checksums
bbb722a05bccb176fc401f7d8b80f8f82943f2d87517b2586c9960ac28a798a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release files / rocketgym-0.0.13-py3-none-any.whl

Download URL rocketgym-0.0.13-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8cae85d0af2c00edce864e7dadc830563e3d24ef1a04ed46d40af87cb6c050fc
BLAKE2b-256 checksum
How to use checksums
e2e252761daf647416964a6e0761dc386cc0cca25ca6b255a5f13ad359459732
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page