3 releases

0.0.6 Sep 19, 2023
0.0.5 Jan 25, 2022
0.0.4 Jul 18, 2021

#492 in Science

26 downloads per month
Used in 2 crates

MIT/Apache

130KB
2.5K SLoC

A wrapper of Gymnasium environments on Python.

GymEnv is a wrapper of Gymnasium based on PyO3. It has been tested on some of classic control and Gymnasium-Robotics environments.

In a past, [`Atari`](https://gym.openai.com/envs/#atari), and
[`PyBullet`](https://github.com/benelot/pybullet-gym) environments were supported.
However, currently they are not tested.

This wrapper accepts array-like observation and action (Box spaces), and discrete action. In order to interact with Python interpreter where gym is running, GymObsFilter and GymActFilter provides interfaces for converting Python object (numpy array) to/from ndarrays in Rust. GymObsFilter, ContinuousActFilter and DiscreteActFilter do the conversion for environments where observation and action are arrays. In addition to the data conversion between Python and Rust, we can implements arbitrary preprocessing in these filters. For example, FrameStackFilter keeps four consevutive observation frames (images) and outputs a stack of these frames.

For Atari environments, a tweaked version of atari_wrapper.py is required to be in PYTHONPATH. The frame stacking preprocessing is implemented in FrameStackFilter as an GymObsFilter.

Examples with a random controller (Policy) are in examples directory. Examples with border-tch-agents, which are collections of RL agents implemented with tch-rs, are in here.

Dependencies

~34MB
~468K SLoC