Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SupervisorEvolutionary Class #93

Open
wants to merge 71 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
a5b5885
Listed gym in requirements.txt
tsampazk Feb 15, 2021
968a20d
Major refactoring of SupervisorEnv to include gym.Env as well as Supe…
tsampazk Feb 15, 2021
54bd8a2
Major refactoring and docstrings
tsampazk Feb 15, 2021
287f7ef
initialize_comms returns the emitter and receiver similar to robot_em…
tsampazk Feb 15, 2021
ee58fb2
Some fixes in docstrings, removed ABC abstract and timestep->time_ste…
tsampazk Feb 15, 2021
35480aa
Some improvements in the docstrings, refactored import and timestep->…
tsampazk Feb 15, 2021
244afc4
Removed ABC, docstrings improvements, gym integration
tsampazk Feb 15, 2021
51afd8e
Reverted arg formatting and refactored import
tsampazk Feb 15, 2021
de0b972
Fixed multiple inheritance issue in step
tsampazk Feb 15, 2021
fca88ac
Fixed multiple inheritance issue in step for supervisor_emitter_recei…
tsampazk Feb 15, 2021
244d839
Minor typo
tsampazk Feb 15, 2021
d1b53e6
Specified super class for calling step in reset method
tsampazk Feb 15, 2021
5dd167d
Renamed timestep, get_timestep deprecation warning, timestep into pro…
tsampazk Feb 16, 2021
a97091d
Renamed timestep
tsampazk Feb 16, 2021
c3340db
Renamed timestep, get_timestep deprecation warning, timestep into pro…
tsampazk Feb 16, 2021
2902542
Renamed timestep, get_timestep deprecation warning, timestep into pro…
tsampazk Feb 16, 2021
88497bb
Fixed emitter-receiver names unused arguments
tsampazk Feb 16, 2021
48a8df7
Add all-contributors bot
eakirtas Feb 16, 2021
a92dda8
Merge branch 'dev' into dev
KelvinYang0320 Feb 16, 2021
9cb92b4
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
65c5601
Make README.md to support all-contributors
eakirtas Feb 16, 2021
4b02ac5
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
7b245c0
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
9cd9c5b
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
5ea4c5e
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
7595f01
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
89fc18f
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
591394b
Fix all-contributors
eakirtas Feb 16, 2021
6d4c13a
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
08d8b61
docs: create .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
64585f3
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
8021245
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
952495c
docs: update README.md [skip ci]
allcontributors[bot] Feb 16, 2021
9060b44
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 16, 2021
024911c
Add badges and exclude README.md from .pre-commit-config
eakirtas Feb 16, 2021
3191afa
Deepbots version: 0.1.3-dev1 → 0.1.3-dev2
eakirtas Feb 17, 2021
c3c9c9d
docs: update README.md [skip ci]
allcontributors[bot] Feb 17, 2021
f0e6b17
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 17, 2021
8bd940b
docs: update README.md [skip ci]
allcontributors[bot] Feb 17, 2021
ab7311a
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 17, 2021
f9694e1
Added tutorial links to the two schemes descriptions
tsampazk Feb 24, 2021
ebc8790
Shorten README
eakirtas Mar 16, 2021
119fc2e
Add logos
eakirtas Mar 16, 2021
dd414d5
Fix typo
eakirtas Mar 16, 2021
7b594d2
Fix deepworlds logo
eakirtas Mar 16, 2021
851cba9
Remove swag from deepbots repo
eakirtas Mar 16, 2021
d6550b3
Add docker folder with Dockerfile and readme
NikosKokkinis Jun 23, 2021
c82ec26
docs: update README.md [skip ci]
allcontributors[bot] Jul 6, 2021
e95a388
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Jul 6, 2021
5daf0cb
Manual fix of contributors badge number (#98)
tsampazk Sep 28, 2021
536dd56
Bump tensorflow from 2.5.0 to 2.5.1 in /docker
dependabot[bot] Aug 25, 2021
e592785
Bump tensorflow from 2.5.1 to 2.5.2 in /docker
dependabot[bot] Nov 10, 2021
bd8a0d6
Bump tensorflow from 2.5.2 to 2.6.4 in /docker
dependabot[bot] May 24, 2022
96828be
Removed python 3.5 that failed the test
tsampazk Jun 9, 2022
e7fc1ff
Fixed the deprecation warning
KelvinYang0320 Jun 9, 2022
bddc48c
Bump numpy from 1.19.2 to 1.22.0 in /docker
dependabot[bot] Jun 22, 2022
32a23b2
Bump tensorflow from 2.6.4 to 2.7.2 in /docker
dependabot[bot] Jun 22, 2022
bb595f5
Added requirements to setup
tsampazk Jun 28, 2022
bfc3b4e
Fix bumpversion and isort configs
eakirtas Jul 12, 2022
9c09c58
Deepbots version: 0.1.3-dev2 → 0.1.3-dev3
eakirtas Jul 12, 2022
6a26eeb
Bump tensorflow from 2.7.2 to 2.9.3 in /docker
dependabot[bot] Nov 21, 2022
1aa8e6c
Webots2023a: getData -> getString
KelvinYang0320 Dec 1, 2022
fcbebb5
Removed python 3.6 that failed the test
KelvinYang0320 Dec 9, 2022
4aee211
step the controller after applying the action
KelvinYang0320 Dec 9, 2022
3e9a2a6
added SupervisorEvolutionary
veds12 Jul 9, 2021
ed60875
update SUpervisorEvolutionary
veds12 Jul 21, 2021
a468edf
added kwargs
veds12 Aug 4, 2021
ff5a270
added cuda support, added docstrings
veds12 Aug 17, 2021
dbe86f6
added cuda support and logging
veds12 Aug 18, 2021
2e65778
save changes
veds12 Aug 18, 2021
6e4b860
added rectified GA
veds12 Sep 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"contributors": [
{
"login": "ManosMagnus",
"name": "Manos Kirtas",
"avatar_url": "https://avatars.githubusercontent.com/u/10010230?v=4",
"profile": "http://eakirtas.webpages.auth.gr/",
"contributions": [
"code"
]
},
{
"login": "tsampazk",
"name": "Kostas Tsampazis",
"avatar_url": "https://avatars.githubusercontent.com/u/27914645?v=4",
"profile": "https://github.com/tsampazk",
"contributions": [
"code"
]
},
{
"login": "KelvinYang0320",
"name": "Jiun Kai Yang",
"avatar_url": "https://avatars.githubusercontent.com/u/49781698?v=4",
"profile": "https://www.linkedin.com/in/kelvin-yang-b7b508198/",
"contributions": [
"code"
]
},
{
"login": "MentalGear",
"name": "MentalGear",
"avatar_url": "https://avatars.githubusercontent.com/u/2837147?v=4",
"profile": "https://github.com/MentalGear",
"contributions": [
"ideas"
]
},
{
"login": "DreamtaleCore",
"name": "Dreamtale",
"avatar_url": "https://avatars.githubusercontent.com/u/12713528?v=4",
"profile": "https://github.com/DreamtaleCore",
"contributions": [
"bug"
]
},
{
"login": "NickKok",
"name": "Nikolaos Kokkinis-Ntrenis",
"avatar_url": "https://avatars.githubusercontent.com/u/8222731?v=4",
"profile": "https://nickkok.github.io/my-website/",
"contributions": [
"code",
"doc",
"ideas"
]
}
],
"contributorsPerLine": 7,
"projectName": "deepbots",
"projectOwner": "aidudezzz",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
}
6 changes: 5 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.3-dev1
current_version = 0.1.3-dev3
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand All @@ -20,3 +20,7 @@ values =
[bumpversion:file:VERSION]

[bumpversion:file:setup.py]

[bumpversion:file:deepbots/__init__.py]
search = "{current_version}"
replace = "{new_version}"
2 changes: 1 addition & 1 deletion .github/workflows/python_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[settings]
known_third_party = controller,numpy,setuptools,tensorboardX
known_third_party = controller,cv2,gym,numpy,ray,setuptools,tensorboardX
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ repos:
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=79]
exclude: README.md

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
Expand Down
142 changes: 95 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# deepbots
<p align="left">
<img src="https://raw.githubusercontent.com/aidudezzz/deepbots-swag/main/logo/deepbots_full.png">
</p>

[![Version](https://img.shields.io/pypi/v/deepbots?color=green)](https://pypi.org/project/deepbots/)
[![Dev Version](https://img.shields.io/github/v/tag/aidudezzz/deepbots?include_prereleases&label=test-pypi&color=green)](https://test.pypi.org/project/deepbots/)
[![Downloads](https://static.pepy.tech/personalized-badge/deepbots?period=total&units=international_system&left_color=grey&right_color=green&left_text=Downloads)](https://pepy.tech/project/deepbots)
[![License](https://img.shields.io/github/license/aidudezzz/deepbots?color=green)](https://github.com/aidudezzz/deepbots/blob/dev/LICENSE)
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)

Deepbots is a simple framework which is used as "middleware" between the free
and open-source [Cyberbotics' Webots](https://cyberbotics.com/) robot simulator
Expand Down Expand Up @@ -60,16 +68,12 @@ https://link.springer.com/chapter/10.1007/978-3-030-49186-4_6
and Tsampazis, K.
and Passalis, N.
and Tefas, A.",
editor="Maglogiannis, Ilias
and Iliadis, Lazaros
and Pimenidis, Elias",
title="Deepbots: A Webots-Based Deep Reinforcement Learning Framework for Robotics",
booktitle="Artificial Intelligence Applications and Innovations",
year="2020",
publisher="Springer International Publishing",
address="Cham",
pages="64--75",
abstract="Deep Reinforcement Learning (DRL) is increasingly used to train robots to perform complex and delicate tasks, while the development of realistic simulators contributes to the acceleration of research on DRL for robotics. However, it is still not straightforward to employ such simulators in the typical DRL pipeline, since their steep learning curve and the enormous amount of development required to interface with DRL methods significantly restrict their use by researchers. To overcome these limitations, in this work we present an open-source framework that combines an established interface used by DRL researchers, the OpenAI Gym interface, with the state-of-the-art Webots robot simulator in order to provide a standardized way to employ DRL in various robotics scenarios. Deepbots aims to enable researchers to easily develop DRL methods in Webots by handling all the low-level details and reducing the required development effort. The effectiveness of the proposed framework is demonstrated through code examples, as well as using three use cases of varying difficulty.",
isbn="978-3-030-49186-4"
}

Expand Down Expand Up @@ -142,26 +146,27 @@ those who are familiar with the OpenAI gym environment. More specifically,
algorithms and follows the OpenAI Gym environment logic. The Deepbots framework
provides different levels of abstraction according to the user's needs.
Moreover, a goal of the framework is to provide different wrappers for a wide
range of robots.
range of robots.

Deepbots also provides a default implementation of the `reset()` method,
leveraging Webots' built-in simulation reset functions, removing the need
for the user to implement reset procedures for simpler use-cases. It is
always possible to override this method and implement any custom reset
procedure, as needed.
leveraging Webots' built-in simulation reset functions, removing the need for
the user to implement reset procedures for simpler use-cases. It is always
possible to override this method and implement any custom reset procedure, as
needed.

#### Emitter - receiver scheme

Currently, the communication between the `Supervisor` and the
`Robot` is achieved via an `emitter` and a `receiver`. Separating the `Supervisor`
from the `Robot`, deepbots can fit a variety of use-cases, e.g. multiple
`Robots` collecting experience and a `Supervisor` controlling them with a single
agent. The way Webots implements `emitter`/`receiver` communication requires messages
to be packed and unpacked, which introduces an overhead that becomes prohibiting in
use-cases where the observations are high-dimensional or long, such as camera images.
Deepbots provides another partially abstract class that combines the `Supervisor`
and the `Robot` into one controller and circumvents that issue, while being less
flexible, which is discussed [later](#combined-robot-supervisor-scheme).
Currently, the communication between the `Supervisor` and the `Robot` is
achieved via an `emitter` and a `receiver`. Separating the `Supervisor` from
the `Robot`, deepbots can fit a variety of use-cases, e.g. multiple `Robots`
collecting experience and a `Supervisor` controlling them with a single agent.
The way Webots implements `emitter`/`receiver` communication requires messages
to be packed and unpacked, which introduces an overhead that becomes
prohibiting in use-cases where the observations are high-dimensional or long,
such as camera images. Deepbots provides another partially abstract class that
combines the `Supervisor` and the `Robot` into one controller and circumvents
that issue, while being less flexible, which is discussed
[later](#combined-robot-supervisor-scheme).

<p align="center">
<img src="https://raw.githubusercontent.com/aidudezzz/deepbots/dev/doc/img/deepbots_overview.png">
Expand All @@ -170,31 +175,40 @@ flexible, which is discussed [later](#combined-robot-supervisor-scheme).
On one hand, the `emitter` is an entity which is provided by Webots, that
broadcasts messages to the world. On the other hand, the `receiver` is an
entity that is used to receive messages from the `World`. Consequently, the
agent-environment loop is transformed accordingly. Firstly, the `Robot` uses its
sensors to retrieve the observation from the `World` and in turn uses the `emitter`
component to broadcast this observation. Secondly, the `Supervisor` receives the
observation via the `receiver` component and in turn, the agent uses it to choose
an action. It should be noted that the observation the agent uses might be
extended from the `Supervisor`. For example, a model might use LiDAR sensors
installed on the `Robot`, but also the Euclidean distance between the `Robot` and
an object. As it is expected, the `Robot` does not know the Euclidean distance,
only the `Supervisor` can calculate it, because it has access to all entities in
the `World`.
agent-environment loop is transformed accordingly. Firstly, the `Robot` uses
its sensors to retrieve the observation from the `World` and in turn uses the
`emitter` component to broadcast this observation. Secondly, the `Supervisor`
receives the observation via the `receiver` component and in turn, the agent
uses it to choose an action. It should be noted that the observation the agent
uses might be extended from the `Supervisor`. For example, a model might use
LiDAR sensors installed on the `Robot`, but also the Euclidean distance between
the `Robot` and an object. As it is expected, the `Robot` does not know the
Euclidean distance, only the `Supervisor` can calculate it, because it has
access to all entities in the `World`.

You can follow the
[emitter-receiver scheme tutorial](https://github.com/aidudezzz/deepbots-tutorials/blob/master/emitterReceiverSchemeTutorial/README.md)
to get started and work your way up from there.

<p align="center">
<img src="https://raw.githubusercontent.com/aidudezzz/deepbots/dev/doc/img/workflow_diagram.png">
</p>

#### Combined Robot-Supervisor scheme

As mentioned earlier, in use-cases where the observation transmitted between
the `Robot` and the `Supervisor` is high-dimensional or long, e.g. high resolution
images taken from a camera, a significant overhead is introduced. This is circumvented
by inheriting and implementing the partially abstract `RobotSupervisor` that combines
the `Robot controller` and the `Supervisor Controller` into one, forgoing all
`emitter`/`receiver` communication. This new controller runs on the `Robot`, but
requires `Supervisor` privileges and is limited to one `Robot`, one `Supervisor`.
As mentioned earlier, in use-cases where the observation transmitted between
the `Robot` and the `Supervisor` is high-dimensional or long, e.g. high
resolution images taken from a camera, a significant overhead is introduced.
This is circumvented by inheriting and implementing the partially abstract
`RobotSupervisor` that combines the `Robot controller` and the
`Supervisor Controller` into one, forgoing all `emitter`/`receiver`
communication. This new controller runs on the `Robot`, but requires
`Supervisor` privileges and is limited to one `Robot`, one `Supervisor`.

You can follow the
[robot-supervisor scheme tutorial](https://github.com/aidudezzz/deepbots-tutorials/tree/master/robotSupervisorSchemeTutorial)
to get started and work your way up from there. We recommended this
tutorial to get started with deepbots.

### Abstraction Levels

Expand All @@ -203,15 +217,49 @@ aim of the framework is to enable people to use Reinforcement Learning in
Webots. More specifically, we can consider deepbots as a wrapper of Webots
exposing an OpenAI gym style interface. For this reason there are multiple
levels of abstraction. For example, a user can choose if they want to use CSV
`emitter`/`receiver` or if they want to make an implementation from scratch.
In the top level of the abstraction hierarchy is the `SupervisorEnv` which is the
`emitter`/`receiver` or if they want to make an implementation from scratch. In
the top level of the abstraction hierarchy is the `SupervisorEnv` which is the
OpenAI gym interface. Below that level there are partially implemented classes
with common functionality. These implementations aim to hide the communication
with common functionality. These implementations aim to hide the communication
between the `Supervisor` and the `Robot`, as described in the two different
schemes ealier. Similarly, in the `emitter`/`receiver` scheme the `Robot`
also has different abstraction levels. According to their needs, users can choose
either to process the messages received from the `Supervisor` themselves or
use the existing implementations.

### Acknowledgments
This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 871449 (OpenDR). This publication reflects the authors’ views only. The European Commission is not responsible for any use that may be made of the information it contains.
schemes ealier. Similarly, in the `emitter`/`receiver` scheme the `Robot` also
has different abstraction levels. According to their needs, users can choose
either to process the messages received from the `Supervisor` themselves or use
the existing implementations.

### Acknowledgments

This project has received funding from the European Union's Horizon 2020
research and innovation programme under grant agreement No 871449 (OpenDR).
This publication reflects the authors’ views only. The European Commission is
not responsible for any use that may be made of the information it contains.

## Contributors ✨

Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://eakirtas.webpages.auth.gr/"><img src="https://avatars.githubusercontent.com/u/10010230?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Manos Kirtas</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=ManosMagnus" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/tsampazk"><img src="https://avatars.githubusercontent.com/u/27914645?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kostas Tsampazis</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=tsampazk" title="Code">💻</a></td>
<td align="center"><a href="https://www.linkedin.com/in/kelvin-yang-b7b508198/"><img src="https://avatars.githubusercontent.com/u/49781698?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jiun Kai Yang</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=KelvinYang0320" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/MentalGear"><img src="https://avatars.githubusercontent.com/u/2837147?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MentalGear</b></sub></a><br /><a href="#ideas-MentalGear" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/DreamtaleCore"><img src="https://avatars.githubusercontent.com/u/12713528?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dreamtale</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/issues?q=author%3ADreamtaleCore" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://nickkok.github.io/my-website/"><img src="https://avatars.githubusercontent.com/u/8222731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikolaos Kokkinis-Ntrenis</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=NickKok" title="Code">💻</a> <a href="https://github.com/aidudezzz/deepbots/commits?author=NickKok" title="Documentation">📖</a> <a href="#ideas-NickKok" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!

<b> Special thanks to <a href='https://www.papanikolaouev.com/'>Papanikolaou Evangelia</a> </b> for designing project's logo! </b>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.3-dev1
0.1.3-dev3
2 changes: 1 addition & 1 deletion deepbots/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.0.11-pre"
__version__ = "0.1.3-dev3"
Loading