diff --git a/.gitignore b/.gitignore index a08a1252..8423ebc2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ docs/output/ docs/source/generated/ docs/build/ +docs/source/sg_execution_times.rst ### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider diff --git a/docs/requirements.txt b/docs/requirements.txt index 82be9167..36f75228 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,5 @@ torch pyglet<=1.5.27 gym six +sphinx-gallery +memory_profiler diff --git a/docs/source/conf.py b/docs/source/conf.py index 19983c59..9e9bd7e6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -29,6 +29,7 @@ "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", + "sphinx_gallery.gen_gallery", "patch", ] @@ -36,6 +37,25 @@ autodoc_member_order = "bysource" toc_object_entries = False +sphinx_gallery_conf = { + "examples_dirs": [ + "../../tutorials", + "../../tutorials/environment", + "../../tutorials/scenario", + "../../tutorials/simulator", + ], # path to your example scripts + "gallery_dirs": [ + "generated/tutorials", + "generated/tutorials/environment", + "generated/tutorials/scenario", + "generated/tutorials/simulator", + ], # path to where to save gallery generated output + "doc_module": ("vmas",), + "filename_pattern": ".*", # files to parse + # "notebook_images": "reference/generated/tutorials/media/", # images to parse + "show_memory": True, +} + intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), "sphinx": ("https://www.sphinx-doc.org/en/master/", None), diff --git a/docs/source/index.rst b/docs/source/index.rst index b6169908..becfd6b9 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -43,9 +43,15 @@ Forthcoming doc sections: usage/running usage/citing + .. toctree:: :maxdepth: 1 - :caption: Concepts + :caption: Tutorials + + generated/tutorials/index + generated/tutorials/environment/index + generated/tutorials/scenario/index + generated/tutorials/simulator/index .. toctree:: diff --git a/tutorials/README.rst b/tutorials/README.rst new file mode 100644 index 00000000..92beee62 --- /dev/null +++ b/tutorials/README.rst @@ -0,0 +1,4 @@ +All tutorials +============= + +Below is a gallery of examples diff --git a/tutorials/environment/README.rst b/tutorials/environment/README.rst new file mode 100644 index 00000000..b0db2ab6 --- /dev/null +++ b/tutorials/environment/README.rst @@ -0,0 +1,4 @@ +Environment +----------- + +Below is a gallery of examples diff --git a/tutorials/environment/communication_actions.py b/tutorials/environment/communication_actions.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/communication_actions.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/differentiability.py b/tutorials/environment/differentiability.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/differentiability.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/interactive_rendering.py b/tutorials/environment/interactive_rendering.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/interactive_rendering.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/plot_under_rendering.py b/tutorials/environment/plot_under_rendering.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/plot_under_rendering.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/rendering.py b/tutorials/environment/rendering.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/rendering.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/spaces.py b/tutorials/environment/spaces.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/spaces.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/use_vmas.py b/tutorials/environment/use_vmas.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/use_vmas.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/environment/vectorization.py b/tutorials/environment/vectorization.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/environment/vectorization.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/scenario/README.rst b/tutorials/scenario/README.rst new file mode 100644 index 00000000..482bd781 --- /dev/null +++ b/tutorials/scenario/README.rst @@ -0,0 +1,4 @@ +Scenario +-------- + +Below is a gallery of examples diff --git a/tutorials/scenario/extra_actions.py b/tutorials/scenario/extra_actions.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/scenario/extra_actions.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/scenario/extra_render.py b/tutorials/scenario/extra_render.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/scenario/extra_render.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/scenario/implementing_a_scenario.py b/tutorials/scenario/implementing_a_scenario.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/scenario/implementing_a_scenario.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/simulator/README.rst b/tutorials/simulator/README.rst new file mode 100644 index 00000000..a6fc0969 --- /dev/null +++ b/tutorials/simulator/README.rst @@ -0,0 +1,2 @@ +Simulator +--------- diff --git a/tutorials/simulator/controllers.py b/tutorials/simulator/controllers.py new file mode 100644 index 00000000..73be4a61 --- /dev/null +++ b/tutorials/simulator/controllers.py @@ -0,0 +1,27 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Baby +==== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +print(env.reset()) +env.reset() diff --git a/tutorials/simulator/customizing_agents.py b/tutorials/simulator/customizing_agents.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/simulator/customizing_agents.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/simulator/customizing_entities.py b/tutorials/simulator/customizing_entities.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/simulator/customizing_entities.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() diff --git a/tutorials/simulator/customizing_the_world.py b/tutorials/simulator/customizing_the_world.py new file mode 100644 index 00000000..3e11b9fd --- /dev/null +++ b/tutorials/simulator/customizing_the_world.py @@ -0,0 +1,27 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Baby 2 +====== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +print(env.reset()) +env.reset() diff --git a/tutorials/simulator/dynamics.py b/tutorials/simulator/dynamics.py new file mode 100644 index 00000000..73be4a61 --- /dev/null +++ b/tutorials/simulator/dynamics.py @@ -0,0 +1,27 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Baby +==== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +print(env.reset()) +env.reset() diff --git a/tutorials/simulator/joints.py b/tutorials/simulator/joints.py new file mode 100644 index 00000000..73be4a61 --- /dev/null +++ b/tutorials/simulator/joints.py @@ -0,0 +1,27 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Baby +==== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +print(env.reset()) +env.reset() diff --git a/tutorials/simulator/sensors.py b/tutorials/simulator/sensors.py new file mode 100644 index 00000000..e92fd956 --- /dev/null +++ b/tutorials/simulator/sensors.py @@ -0,0 +1,52 @@ +# Copyright (c) 2024. +# ProrokLab (https://www.proroklab.org/) +# All rights reserved. + +""" +Data download example +===================== + +This example shows one way of dealing with large data files required for your +examples. + +The ``download_data`` function first checks if the data has already been +downloaded, looking in either the data directory saved the configuration file +(by default ``~/.sg_template``) or the default data directory. If the data has +not already been downloaded, it downloads the data from the url and saves the +data directory to the configuration file. This allows you to use the data +again in a different example without downloading it again. + +Note that examples in the gallery are ordered according to their filenames, thus +the number after 'plot_' dictates the order the example appears in the gallery. +""" + + +###################################################################### +# Define Hyperparameters +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +import vmas + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions() + +###################################################################### +# Define dwdwd +# ---------------------- +# +# We set the hyperparameters for our tutorial. +# Depending on the resources +# available, one may choose to execute the policy and the simulator on GPU or on another +# device. +# You can tune some of these values to adjust the computational requirements. +# + +env = vmas.make_env("dispersion", num_envs=3) +env.get_random_actions()