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

Updating master #26

Merged
merged 58 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
59464f5
make grid configurable from text file
marcofavorito Dec 11, 2020
774e8e0
fix linting
marcofavorito Dec 11, 2020
baca34b
fix missed reset of bip counts
marcofavorito Dec 12, 2020
e6f2bae
add docs on custom map
marcofavorito Dec 12, 2020
c8f545b
Merge pull request #6 from whitemech/multinav
cipollone Dec 12, 2020
fdfc0cf
add continuous state space; add docs
marcofavorito Dec 12, 2020
1aa8c9c
fix tests on rollout and rendering
marcofavorito Dec 13, 2020
940f744
add --ci option to pytest
marcofavorito Dec 13, 2020
1ea46d0
Merge pull request #7 from whitemech/multinav
marcofavorito Dec 13, 2020
695d924
Initial-positions.
cipollone Jul 8, 2021
4b7f324
Added walls and continuous actions fix.
cipollone Jul 9, 2021
7bb6d9d
Removed todos.
cipollone Jul 10, 2021
ccb0862
Tiny black fix.
cipollone Jul 10, 2021
42cf23d
Using apply_velocity instead of manually doing the movement.
cipollone Jul 10, 2021
cfafa14
Added new actions module.
cipollone Jul 10, 2021
29297f2
Removed all old action classes.
cipollone Jul 10, 2021
69a432a
Small fixes and type checking; new version.
cipollone Jul 10, 2021
175ce91
Merge branch 'walls' into action-spaces
cipollone Jul 10, 2021
aaae81c
Added definitions of observation spaces.
cipollone Jul 12, 2021
b7b3cb0
Moved tests to tests/src because I'm adding resources.
cipollone Jul 12, 2021
5a65b81
Moved tests back: there's already one default map.
cipollone Jul 12, 2021
03aa394
Writing tests.
cipollone Jul 12, 2021
0255512
Working initial tests.
cipollone Jul 12, 2021
e0b00fd
Map is now str, working tests.
cipollone Jul 12, 2021
d7e9486
Added tests for action spaces.
cipollone Jul 12, 2021
dc94036
Added new tests and fixes.
cipollone Jul 12, 2021
1ae890a
Small fix.
cipollone Jul 12, 2021
f17da3b
Added roberto (myself) as author, not license.
cipollone Jul 12, 2021
f3fb790
Each agent at its own speed.
cipollone Jul 12, 2021
1a643e0
Generic orientations; tested with 45deg.
cipollone Jul 12, 2021
66b968a
Lints and checks.
cipollone Jul 12, 2021
8b8a81f
Copyright updated on new files.
cipollone Jul 12, 2021
757008b
Try render.
cipollone Jul 12, 2021
91f6530
Merge pull request #18 from whitemech/observation-space
cipollone Jul 13, 2021
dfe2227
Bugfix.
cipollone Jul 18, 2021
6baa751
Added a field where to store persitent data for robots.
cipollone Jul 19, 2021
22eaac1
Fix.
cipollone Jul 19, 2021
9a084cb
Tiny modification: rember last unprocessed observation.
cipollone Jul 28, 2021
e3f95ec
Tiny: typing.
cipollone Aug 3, 2022
7c6cea9
Style and tools fix.
cipollone Aug 3, 2022
b694500
Removed storage, not allowed by style checks in dataclass.
cipollone Aug 3, 2022
afc4d2a
Version 3.0
cipollone Aug 3, 2022
de38ca3
Big package bump: from gym to gynmasium.
cipollone Nov 10, 2023
6333b10
Batch of updates gym->gymnasium.
cipollone Nov 14, 2023
d033083
Solved Bandit errors.
cipollone Nov 15, 2023
7ca5aac
Fixed Check-copyright and added Roberto.
cipollone Nov 15, 2023
3ca282c
Black fix.
cipollone Nov 15, 2023
0432fc3
Isort fix.
cipollone Nov 15, 2023
ab7a719
Mypy and isort fix.
cipollone Nov 15, 2023
4f329e3
Everything passing.
cipollone Nov 15, 2023
cb86e40
dependencies update.
cipollone Jan 31, 2024
f110485
Renamed Sapientino to SapientinoBase and SapientinoDictSpace to Sapie…
cipollone Jan 31, 2024
4f58478
Moved Sapientino (old DictSpace) to sapientino_env module (not a wrap…
cipollone Jan 31, 2024
44d7c14
Passing Tests; black is almost ok.
cipollone Jan 31, 2024
c88e5d6
Tox clean.
cipollone Apr 9, 2024
9519126
Updated doc.
cipollone Apr 9, 2024
21f1701
Merge branch 'updates-and-tests' into develop
cipollone Apr 9, 2024
bda2656
Updated worksflows.
cipollone Apr 9, 2024
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
29 changes: 0 additions & 29 deletions .github/workflows/docs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7]
python-version: [3.9]

timeout-minutes: 30

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8]
python-version: [3.9]

timeout-minutes: 30

Expand All @@ -27,7 +27,7 @@ jobs:
run: pip install tox poetry
- name: Unit tests and coverage
run: |
tox -e py${{ matrix.python-version }}
tox -e py${{ matrix.python-version }} -- --ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,9 @@ Sessionx.vim
# Ignore all local history of files
.history

# Vim configs
/.vim/

# End of https://www.toptal.com/developers/gitignore/api/tex,vim,tags,latex,linux,macos,python,textmate,sublimetext,pycharm+all,intellij+all,visualstudiocode


Expand Down
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# History

## 0.4.0 (2023-11-10)

* Updated from gym to gymnasium
* Many other package updates

## 0.2.0 (2020-10-11)

* Add support for a multi-agent scenario
Expand Down
92 changes: 42 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,104 +54,96 @@
</a>
</p>

OpenAI Gym Sapientino environment using Pygame.

<p align="center">
<img src="https://raw.githubusercontent.com/whitemech/gym-sapientino/master/docs/sapientino-homepage.gif" />
</p>

## Description

The environment is inspired by a game for kids called
[_Sapientino_](https://it.wikipedia.org/wiki/Sapientino).

A robot moves on a gridworld-like environment,
where each cell can be coloured.
When a robot is on a coloured cell, it can
run a _beep_, meaning it has visited the cell.
This is a configurable Gynmasium environment that implements one or more agents moving in a plane.
The software was originally inspired by a game for kids called
[_Sapientino_](https://it.wikipedia.org/wiki/Sapientino), but it has been extended in various ways.

The environment is compliant with the
[OpenAI Gym](https://github.com/openai/gym/) APIs.
The idea is that the designer of the experiment
should implement the actual reward by wrapping the environment.
Each agent moves on a 2D environment,
where each cell can be coloured or blank.
When a robot is on a coloured cell, it can
execute a _beep_ action, meaning it has visited the cell (this is meant to represent any interaction with the current location).

## Dependencies
### Features

The environment is implemented using Pygame.
The environment is compliant with the `Gymnasium` APIs.

On Ubuntu, you need the following libraries:
```
sudo apt-get install python3-dev \
libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev
```
**Agents** There can be one or more agents in the same map. Each agent has its own action space.

**Actions** There are three default action spaces. The first allows the agent to move in the four cardinal directions. The second requires the agent to rotate by 90°, then move in discrete steps. The third instead allows the agent to accellerate and decelerate both in the angular and linear coordinates. This last modality does not implement a grid-world environment. For these actions, and how to implement your own, you can see `gym_sapientino/core/actions.py`.

**Observations** The `Sapientino` class has a dictionary observation space that contains all the current information. For personalizing the observation space you can subclass the `Features` class in `gym_sapientino/wrappers/observations.py`. We provide discrete and continuous features wrappers.

**Rewards** It is possible to specify per-step rewards, but for general reward functions, the user should wrap this environment.

**Map** The map can be easily configured using ASCII strings. For example, combining

|P bB g |
| bp G r|
|G pg |
| rpG PB|
|rP Bg b|

with `ContinuousCommand` generates:

![continuous control gif](/docs/continuous.gif)

For a more complete documentation of how to use the environment, and the available options see this [notebook](docs/quickstart.ipynb).

On MacOS (not tested):
```
brew install sdl sdl_ttf sdl_image sdl_mixer portmidi # brew or use equivalent means
conda install -c https://conda.binstar.org/quasiben pygame # using Anaconda
```

## Install

Install with `pip`:

pip install gym_sapientino
Or, install from source:

Or, for a more updated version, install from github:

git clone https://github.com/whitemech/gym-sapientino.git
cd gym-sapientino
pip install .

## Development

- clone the repo:
- Clone the repo:
```bash
git clone https://github.com/whitemech/gym-sapientino.git
cd gym-sapientino
```

- Create/activate the virtual environment:

- Install [Poetry](https://python-poetry.org/)
- Optionally select the Python version:
```bash
poetry shell --python=python3.7
poetry env use python3.9
```

- Install development dependencies:
- Install with development dependencies:
```bash
poetry install
```

## Tests

To run tests: `tox`

To run only the code tests: `tox -e py3.7`

To run only the linters:
- `tox -e flake8`
- `tox -e mypy`
- `tox -e black-check`
- `tox -e isort-check`

Please look at the `tox.ini` file for the full list of supported commands.

## Docs

To build the docs: `mkdocs build`
Please look at the `tox.ini` file for the full list of supported commands and tests.

To view documentation in a browser: `mkdocs serve`
and then go to [http://localhost:8000](http://localhost:8000)

## License

gym-sapientino is released under the GNU General Public License v3.0 or later (GPLv3+).

Copyright 2019-2020 Marco Favorito, Luca Iocchi
Copyright 2019-2020 Marco Favorito, Roberto Cipollone, Luca Iocchi

## Authors

- [Luca Iocchi](https://sites.google.com/a/dis.uniroma1.it/iocchi/home)
- [Roberto Cipollone](https://cipollone.github.io/)
- [Marco Favorito](https://marcofavorito.github.io/)

## Credits
Expand Down
Binary file added docs/continuous.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading