Skip to content

Commit

Permalink
Init. Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
finnBsch committed Dec 16, 2022
0 parents commit 0eb685f
Show file tree
Hide file tree
Showing 99 changed files with 22,636 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
apt_packages:
- libsfml-dev
- libeigen3-dev
- python3-pybind11
os: ubuntu-22.04
tools:
python: "3.9"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.15...3.25)
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})

set(CMAKE_CXX_STANDARD 17)
find_package (Eigen3 REQUIRED NO_MODULE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -ffast-math -fopenmp -fPIC" )
#set(CMAKE_MODULE_PATH "/usr/share/SFML/cmake/Modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED network audio graphics window system)
#find_package(PythonLibs REQUIRED)
#find_package(Python3 COMPONENTS Interpreter NumPy REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
if(SKBUILD)
message(STATUS "The project is built using scikit-build")
endif()
pybind11_add_module(pomdp_spaceship_env MODULE
src/scenario.cpp
src/rl_agent.cpp
src/Controller.cpp
src/SpaceShipSim/SpaceShipSim.cpp
src/SpaceShipSim/SpaceShip.cpp
src/SpaceShipSim/viz_helpers/emitter.cpp
src/SpaceShipSim/viz_helpers/particle.cpp
src/SpaceShipSim/SpaceControllers.cpp
src/Label.cpp
src/ThreadPool.cpp
src/SpaceShipSim/viz_helpers/goal.cpp
src/SpaceShipSim/viz_helpers/boosterglare.cpp
src/SpaceShipSim/viz_helpers/GlowingBall.cpp
src/SpaceShipSim/DistanceSensors.cpp
src/SpaceShipSim/Obstacle.cpp
src/interface.cpp
src/resources/booster.h
src/resources/mainframe.h
src/resources/Arial.h
)

target_link_libraries(pomdp_spaceship_env PRIVATE ${PYTHON_LIBRARIES} sfml-graphics sfml-audio sfml-window sfml-system Eigen3::Eigen)

target_compile_definitions(pomdp_spaceship_env PRIVATE VERSION_INFO=${PROJECT_VERSION})

install(TARGETS pomdp_spaceship_env
DESTINATION .)

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.rst
79 changes: 79 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
POMDP Space Ship Environment Documentation
===============================================

This is the documentation to the POMDP Space Ship Environment. This is a 2D environment
for a Space Ship with two individually controllable thrusters. The goal is to reach a desired goal point (static or dynamic).
The environment is filled with obstacles which can be sensed through distance sensors.
This renders the environment only partially
observable and thus the Markov Assumption is violated leading to issues with standard MLP-RL approaches.



`Example video <https://www.youtube.com/watch?v=su16NdsVE5I&ab_channel=FinnBusch>`_

`Source Code <https://github.com/finnBsch/PomdpSpaceShipEnv>`_

`Documentation <https://pomdpspaceshipenv.readthedocs.io/en/latest/>`_

Dependencies
---------------------
* `SFML <https://www.sfml-dev.org/>`_ for visualisation. Install with ``sudo apt install libsfml-dev`` for Debian-based distros.
* `Eigen3 <https://eigen.tuxfamily.org/index.php?title=Main_Page>`_ for math. Install with ``sudo apt install libeigen3-dev`` for Debian-based distros.


Getting Started
---------------------
Build and install the module

.. code-block:: console
# Clone the repository
git clone https://github.com/finnBsch/PomdpSpaceShipEnv
# Install the Python Module
pip install PomdpSpaceShipEnv
Example Usage
---------------------
Generally, the environment is to be used as shown here.

.. code-block :: python
# Simple script to test environment in real-time
import pomdp_spaceship_env
import numpy as np
conf = pomdp_spaceship_env.Config()
N = 10000
n_ships = 1
# Set Config
conf.Viz = True
conf.AutoReset = True
conf.ShareEnvs = False
conf.NumObs = 60
conf.DynamicGoals = False
env = pomdp_spaceship_env.Env(conf, n_ships=n_ships)
env.SetViz(True, True) # Draw Rays and Obstacles
# Use np.float32 as input data type.
ins = np.array([[10, 10, -1, 1]], dtype=np.float32)
ins = np.repeat(ins, n_ships, axis=0)
env.SetControl(ins)
# Loop the env
for i in range(N):
env.Step() # could also provide a dt by calling .Step(dt=dt), useful for training.
states = env.GetState()
rewards = env.GetReward()
dones = env.GetAgentDone()
Currently working on
---------------------
* Fully Customizable cost function (from Python)
* Reproducible benchmark scenarios
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/build/doctrees/index.doctree
Binary file not shown.
Binary file added docs/build/doctrees/modules.doctree
Binary file not shown.
Binary file added docs/build/doctrees/pomdp_spaceship_env.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e52a4748bf1ea5a50376bb9ea55d2d27
tags: 645f666f9bcd5a90fca523b33c5a78b7
97 changes: 97 additions & 0 deletions docs/build/html/_modules/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; Pomdp Space Ship Environment documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> Pomdp Space Ship Environment
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../modules.html">API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Usage</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Pomdp Space Ship Environment</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a></li>
<li class="breadcrumb-item active">Overview: module code</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>All modules for which code is available</h1>
<ul><li><a href="pomdp_spaceship_env/pomdp_spaceship_env.html">pomdp_spaceship_env.pomdp_spaceship_env</a></li>
</ul>

</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2022, Finn Lukas Busch.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
8 changes: 8 additions & 0 deletions docs/build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. include:: ../../README.rst
Contents
========================================================
.. toctree::
Home <self>
modules
usage

7 changes: 7 additions & 0 deletions docs/build/html/_sources/modules.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API
=====================

.. toctree::
:maxdepth: 4

pomdp_spaceship_env
8 changes: 8 additions & 0 deletions docs/build/html/_sources/pomdp_spaceship_env.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Pomdp Space Ship Environment
============================

.. automodule:: pomdp_spaceship_env
:members:
:exclude-members: Viz, ResX, ResY, AutoReset, DynamicGoals, NumObs, PrintLevel, ShareEnvs, SizeX, SizeY
:undoc-members:

Loading

0 comments on commit 0eb685f

Please sign in to comment.