From a0ceb0e13b6d08ba861470b6ec1755759bc0616f Mon Sep 17 00:00:00 2001 From: Stefan Arndt Date: Sat, 12 Aug 2023 14:07:28 +0200 Subject: [PATCH] Some doc changes --- README.md | 2 +- examples/environment_features/GEM_cookbook.ipynb | 10 +++++----- gym_electric_motor/core.py | 9 +++++---- setup.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3e405829..c0eb937d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ## Overview The gym-electric-motor (GEM) package is a Python toolbox for the simulation and control of various electric motors. -It is built upon [OpenAI Gym Environments](https://gym.openai.com/), and, therefore, can be used for both, classical control simulation and [reinforcement learning](https://github.com/upb-lea/reinforcement_learning_course_materials) experiments. It allows you to construct a typical drive train with the usual building blocks, i.e., supply voltages, converters, electric motors and load models, and obtain not only a closed-loop simulation of this physical structure, but also a rich interface for plugging in any decision making algorithm, from linear feedback control to [Deep Deterministic Policy Gradient](https://spinningup.openai.com/en/latest/algorithms/ddpg.html) agents. +It is built upon [Faram Gymnasium Environments](https://gym.openai.com/), and, therefore, can be used for both, classical control simulation and [reinforcement learning](https://github.com/upb-lea/reinforcement_learning_course_materials) experiments. It allows you to construct a typical drive train with the usual building blocks, i.e., supply voltages, converters, electric motors and load models, and obtain not only a closed-loop simulation of this physical structure, but also a rich interface for plugging in any decision making algorithm, from linear feedback control to [Deep Deterministic Policy Gradient](https://spinningup.openai.com/en/latest/algorithms/ddpg.html) agents. ## Getting Started An easy way to get started with GEM is by playing around with the following interactive notebooks in Google Colaboratory. Most important features of GEM as well as application demonstrations are showcased, and give a kickstart for engineers in industry and academia. diff --git a/examples/environment_features/GEM_cookbook.ipynb b/examples/environment_features/GEM_cookbook.ipynb index 63a1d56d..176b4fd6 100644 --- a/examples/environment_features/GEM_cookbook.ipynb +++ b/examples/environment_features/GEM_cookbook.ipynb @@ -19,7 +19,7 @@ "\n", "The gym-electric-motor (GEM) package is a Python toolbox for the simulation and control of various electric motors.\n", "\n", - "It is built upon [OpenAI Gym Environments](https://gym.openai.com/), and, therefore, can be used for both, classical control simulation and reinforcement learning experiments. It allows you to construct a typical drive train with the usual building blocks, i.e. supply voltages, converters, electric motors and load models, and obtain not only a closed-loop simulation of this physical structure, but also a rich interface for plugging in any decision making algorithm, from PI-controllers to [Deep Deterministic Policy Gradient](https://spinningup.openai.com/en/latest/algorithms/ddpg.html) agents.\n", + "It is built upon [Farama Gymnasium Environments](https://gymnasium.farama.org/), and, therefore, can be used for both, classical control simulation and reinforcement learning experiments. It allows you to construct a typical drive train with the usual building blocks, i.e. supply voltages, converters, electric motors and load models, and obtain not only a closed-loop simulation of this physical structure, but also a rich interface for plugging in any decision making algorithm, from PI-controllers to [Deep Deterministic Policy Gradient](https://spinningup.openai.com/en/latest/algorithms/ddpg.html) agents.\n", "\n", "### 1.1 Installation\n", "Before you can start, you need to make sure that you have gym-electric-motor installed. You can install it easily using pip:\n", @@ -114,8 +114,8 @@ "Moreover, the angular velocity is the mechanical one and not the electrical:\n", "$p\\omega_{me} = p\\omega = \\omega_{el}$\n", "\n", - "### 1.3 OpenAI Gym Interface\n", - "Like every gym environment, the basic user interface consists of four main functions.\n", + "### 1.3 Farama Gymnasium Interface\n", + "Like every gymnasium environment, the basic user interface consists of four main functions.\n", "* `import gym_electric_motor as gem` \n", " Import the package. \n", "\n", @@ -123,11 +123,11 @@ " Returns an instantiated motor environment. Call this function at the beginning.\n", " The `gem.make()` method is equal to the `gym.make()`. By using `gem.make()`you can avoid importing gym additionally. \n", " \n", - "* `initial_observation = env.reset()` \n", + "* `initial_observation, info = env.reset()` \n", " Resets the motor. This includes a new initial state and new reference trajectories.\n", " Call this function before a new episode starts. \n", "\n", - "* `observation, reward, done, info = env.step(action)` \n", + "* `observation, reward, terminated, truncated, info = env.step(action)` \n", " This function performs one action on the environment for one time step.\n", " It simulates the motor and needs to be called in every time step.\n", " First, the voltage applied on the motor due to the converter output is determined and then an ODE solver is used to compute the next state. \n", diff --git a/gym_electric_motor/core.py b/gym_electric_motor/core.py index 91bbd4ce..36888069 100644 --- a/gym_electric_motor/core.py +++ b/gym_electric_motor/core.py @@ -272,6 +272,7 @@ def reset(self, seed = None,*_, **__): Returns: The initial observation consisting of the initial state and initial reference. + info(dict): Auxiliary information (optional) """ self._seed(seed) @@ -303,7 +304,7 @@ def step(self, action): observation(Tuple(ndarray(float),ndarray(float)): Tuple of the new state and the next reference. reward(float): Amount of reward received for the last step. terminated(bool): Flag, indicating if a reset is required before new steps can be taken. - {}: An empty dictionary for consistency with the OpenAi Gym interface. + info(dict): Auxiliary information (optional) """ assert not self._terminated, 'A reset is required before the environment can perform further steps' @@ -402,7 +403,7 @@ class ReferenceGenerator: """The abstract base class for reference generators in gym electric motor environments. reference_space: - Space of reference observations as defined in the OpenAI Gym Toolbox. + Space of reference observations as defined in the Farama Gymnasium Toolbox. The reference generator is called twice per step. @@ -636,7 +637,7 @@ def state_positions(self): def action_space(self): """ Returns: - gymnasium.Space: An OpenAI Gym Space that describes the possible actions on the system. + gymnasium.Space: An Farama Gymnasium Space that describes the possible actions on the system. """ return self._action_space @@ -644,7 +645,7 @@ def action_space(self): def state_space(self): """ Returns: - gymnasium.Space: An OpenAI Gym Space that describes the possible states of the system. + gymnasium.Space: An Farama Gymnasium Space that describes the possible states of the system. """ return self._state_space diff --git a/setup.py b/setup.py index 12b374b5..8f077072 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setuptools.setup( name='gym_electric_motor', version='1.1.0', - description='An OpenAI gym environment for electric motor control.', + description='An Farama Gymnasium environment for electric motor control.', packages=setuptools.find_packages(), install_requires=requirements, python_requires='>=3.6',