-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simplify extras_require * Rm gym-robotics ; gym -> gymnasium * Python 3.10 * new extra dependency in CI * `import gym` -> `import gymnasium as gym` * render.modes -> render_modes * reset returns info * black and isort * Fix CI extra requires * Remove SB3 and numpgw extra dependency * obs or state -> observation * black * replavec done by trun and term when appeled * black * gym -> gymnasium * Step return trunc and term * compute_reward returns float32, is_success returns bool * float64 -> float32 * fix typing * black * Allow return tuple documentation * Fix doc * Remove unused import * panda_tasks in a single file * black * fix pip install notebook * improve save_restore documentation * documentation save and restore state * Python version in CI: 3.X to '3.X' * profile black to isort * typo * fix reset arg and dtype * Fix CI because pytype can't be installed on windows * v3 * Clean notebook
- Loading branch information
1 parent
bdc9ae1
commit e23e0c9
Showing
42 changed files
with
578 additions
and
593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,157 +1,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"colab_type": "text", | ||
"id": "view-in-github" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/qgallouedec/panda-gym/blob/colab/PickAndPlace.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "TFFVaHq_7fSe" | ||
}, | ||
"source": [ | ||
"# `panda-gym` code example\n", | ||
"\n", | ||
"## Install `panda-gym`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/" | ||
}, | ||
"id": "gvS3_Wp_6rqE", | ||
"outputId": "0c25d21e-d823-4b4c-88bd-6eb1a0425acd" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install panda-gym" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "qE8atPQm870Q" | ||
}, | ||
"source": [ | ||
"## Interract" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "gLQSKOE_8_kB" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import gym\n", | ||
"import panda_gym\n", | ||
"\n", | ||
"env = gym.make('PandaPickAndPlace-v2', render=True)\n", | ||
"state = env.reset()\n", | ||
"\n", | ||
"done = False\n", | ||
"images = [env.render('rgb_array')]\n", | ||
"while not done:\n", | ||
" action = env.action_space.sample()\n", | ||
" state, reward, done, info = env.step(action)\n", | ||
" images.append(env.render('rgb_array'))\n", | ||
"\n", | ||
"env.close()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "Nkl-EtEZ_EQH" | ||
}, | ||
"source": [ | ||
"## Convert into animation\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/" | ||
}, | ||
"id": "E2eWDjPZsQc5", | ||
"outputId": "83bb407d-ea87-49a3-e61d-291f7db7f824" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip3 install numpngw\n", | ||
"from numpngw import write_apng\n", | ||
"\n", | ||
"write_apng('anim.png', images, delay=40) # real-time rendering = 40 ms between frames" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "dFadL1ne_NG8" | ||
}, | ||
"source": [ | ||
"## Show animation" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 737 | ||
}, | ||
"id": "5mJ2AQYN-22E", | ||
"outputId": "620d7be1-13cf-4c60-a934-a1806e1bc4a9" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from IPython.display import Image\n", | ||
"\n", | ||
"Image(filename=\"anim.png\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"colab": { | ||
"authorship_tag": "ABX9TyPoojQ0oWlcLJWd6nANAzj6", | ||
"collapsed_sections": [], | ||
"include_colab_link": true, | ||
"name": "PickAndPlace.ipynb", | ||
"provenance": [] | ||
}, | ||
"interpreter": { | ||
"hash": "8e193b2e5d21c2e374c02529de74b36a677b513007ad2ca2b9715beb5c35b2ac" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3.7.5 64-bit ('env': venv)", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.9" | ||
} | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"colab_type": "text", | ||
"id": "view-in-github" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/qgallouedec/panda-gym/blob/colab/PickAndPlace.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "TFFVaHq_7fSe" | ||
}, | ||
"source": [ | ||
"# `panda-gym` code example\n", | ||
"\n", | ||
"## Install `panda-gym`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install panda-gym" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "qE8atPQm870Q" | ||
}, | ||
"source": [ | ||
"## Interract" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import gymnasium as gym\n", | ||
"import panda_gym\n", | ||
"\n", | ||
"env = gym.make(\"PandaPickAndPlace-v3\", render=True)\n", | ||
"observation, info = env.reset()\n", | ||
"\n", | ||
"images = [env.render(\"rgb_array\")]\n", | ||
"for _ in range(1000):\n", | ||
" action = env.action_space.sample()\n", | ||
" observation, reward, terminated, truncated, info = env.step(action)\n", | ||
" images.append(env.render(\"rgb_array\"))\n", | ||
"\n", | ||
" if terminated or truncated:\n", | ||
" observation, info = env.reset()\n", | ||
" images.append(env.render(\"rgb_array\"))\n", | ||
"\n", | ||
"env.close()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "Nkl-EtEZ_EQH" | ||
}, | ||
"source": [ | ||
"## Convert into animation\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip3 install numpngw\n", | ||
"from numpngw import write_apng\n", | ||
"\n", | ||
"write_apng(\"anim.png\", images, delay=40) # real-time rendering = 40 ms between frames" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "dFadL1ne_NG8" | ||
}, | ||
"source": [ | ||
"## Show animation" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from IPython.display import Image\n", | ||
"\n", | ||
"Image(filename=\"anim.png\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.