Pendulum

Pendulum task adapted from: https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py

class ivy_gym.Pendulum[source]

Bases: Env

__init__()[source]

Initialize Pendulum environment

action_space: Space[ActType]
close()[source]

Close environment.

get_observation()[source]

Get observation from environment.

Returns

ret – observation array

get_reward()[source]

Get reward based on current state

Returns

ret – Reward array

get_state()[source]

Get current state in environment.

Returns

ret – angle and angular velocity arrays

metadata: Dict[str, Any] = {'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 30}
observation_space: Space[ObsType]
render(mode='human')[source]

Renders the environment. The set of supported modes varies per environment. (And some environments do not support rendering at all.) By convention, if mode is:

  • human: render to the current display or terminal and return nothing. Usually for human consumption.

  • rgb_array: Return an numpy.ndarray with shape (x, y, 3), representing RGB values for an x-by-y pixel image, suitable for turning into a video.

  • ansi: Return a string (str) or StringIO.StringIO containing a terminal-style text representation. The text can include newlines and ANSI escape sequences (e.g. for colors).

Parameters

mode – Render mode, one of [human|rgb_array], default human

Returns

ret – Rendered image.

reset()[source]
set_state(state)[source]

Set current state in environment.

Parameters

state – tuple of angle and angular_velocity

Returns

ret – observation array

step(action)[source]
Parameters

action