Skip to content

Commit

Permalink
Some doc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
devarndt committed Aug 12, 2023
1 parent 14a4554 commit a0ceb0e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions examples/environment_features/GEM_cookbook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -114,20 +114,20 @@
"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",
"* `env = gem.make(environment-id, **kwargs)` \n",
" 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",
Expand Down
9 changes: 5 additions & 4 deletions gym_electric_motor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -636,15 +637,15 @@ 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

@property
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

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a0ceb0e

Please sign in to comment.