gym_ignition_environments.tasks

gym_ignition_environments.tasks.cartpole_continuous_balancing

class gym_ignition_environments.tasks.cartpole_continuous_balancing.CartPoleContinuousBalancing(agent_rate, reward_cart_at_center=True, **kwargs)

Bases: gym_ignition.base.task.Task, abc.ABC

create_spaces()

Create the action and observations spaces.

Note

This method does not currently have access to the Models part of the environment. If the Task is meant to work on different models, we recommend using their URDF / SDF model to extract the information you need (e.g. number of DoFs, joint position limits, etc). Since actions and observations are often normalized, in many cases there’s no need to extract a lot of information from the model file.

Raises

RuntimeError – In case of failure.

Return type

Tuple[ActionSpace, ObservationSpace]

Returns

A tuple containing the action and observation spaces.

get_observation()

Return the task observation.

This method contains the logic for constructing the environment observation. It is called in the end of both gym.Env.reset() and gym.Env.step() methods.

Raises

RuntimeError – In case of failure.

Return type

Observation

Returns

The task observation.

get_reward()

Return the task reward.

This method contains the logic for computing the environment reward. It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

Reward

Returns

The scalar reward.

is_done()

Return the task termination flag.

This method contains the logic for defining when the environment has terminated. Subsequent calls to Task.set_action() should be preceded by a task reset through Task.reset_task().

It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

bool

Returns

True if the environment terminated, False otherwise.

reset_task()

Reset the task.

This method contains the logic for resetting the task. It is called in the gym.Env.reset() method of the corresponding environment.

Raises

RuntimeError – In case of failure.

Return type

None

set_action(action)

Set the task action.

This method contains the logic for setting the environment action. It is called in the beginning of the gym.Env.step() method.

Parameters

action (Action) – The action to set.

Raises

RuntimeError – In case of failure.

Return type

None

gym_ignition_environments.tasks.cartpole_continuous_swingup

class gym_ignition_environments.tasks.cartpole_continuous_swingup.CartPoleContinuousSwingup(agent_rate, reward_cart_at_center=True, **kwargs)

Bases: gym_ignition.base.task.Task, abc.ABC

create_spaces()

Create the action and observations spaces.

Note

This method does not currently have access to the Models part of the environment. If the Task is meant to work on different models, we recommend using their URDF / SDF model to extract the information you need (e.g. number of DoFs, joint position limits, etc). Since actions and observations are often normalized, in many cases there’s no need to extract a lot of information from the model file.

Raises

RuntimeError – In case of failure.

Return type

Tuple[ActionSpace, ObservationSpace]

Returns

A tuple containing the action and observation spaces.

get_observation()

Return the task observation.

This method contains the logic for constructing the environment observation. It is called in the end of both gym.Env.reset() and gym.Env.step() methods.

Raises

RuntimeError – In case of failure.

Return type

Observation

Returns

The task observation.

get_reward()

Return the task reward.

This method contains the logic for computing the environment reward. It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

Reward

Returns

The scalar reward.

is_done()

Return the task termination flag.

This method contains the logic for defining when the environment has terminated. Subsequent calls to Task.set_action() should be preceded by a task reset through Task.reset_task().

It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

bool

Returns

True if the environment terminated, False otherwise.

reset_task()

Reset the task.

This method contains the logic for resetting the task. It is called in the gym.Env.reset() method of the corresponding environment.

Raises

RuntimeError – In case of failure.

Return type

None

set_action(action)

Set the task action.

This method contains the logic for setting the environment action. It is called in the beginning of the gym.Env.step() method.

Parameters

action (Action) – The action to set.

Raises

RuntimeError – In case of failure.

Return type

None

gym_ignition_environments.tasks.cartpole_discrete_balancing

class gym_ignition_environments.tasks.cartpole_discrete_balancing.CartPoleDiscreteBalancing(agent_rate, reward_cart_at_center=True, **kwargs)

Bases: gym_ignition.base.task.Task, abc.ABC

create_spaces()

Create the action and observations spaces.

Note

This method does not currently have access to the Models part of the environment. If the Task is meant to work on different models, we recommend using their URDF / SDF model to extract the information you need (e.g. number of DoFs, joint position limits, etc). Since actions and observations are often normalized, in many cases there’s no need to extract a lot of information from the model file.

Raises

RuntimeError – In case of failure.

Return type

Tuple[ActionSpace, ObservationSpace]

Returns

A tuple containing the action and observation spaces.

get_observation()

Return the task observation.

This method contains the logic for constructing the environment observation. It is called in the end of both gym.Env.reset() and gym.Env.step() methods.

Raises

RuntimeError – In case of failure.

Return type

Observation

Returns

The task observation.

get_reward()

Return the task reward.

This method contains the logic for computing the environment reward. It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

Reward

Returns

The scalar reward.

is_done()

Return the task termination flag.

This method contains the logic for defining when the environment has terminated. Subsequent calls to Task.set_action() should be preceded by a task reset through Task.reset_task().

It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

bool

Returns

True if the environment terminated, False otherwise.

reset_task()

Reset the task.

This method contains the logic for resetting the task. It is called in the gym.Env.reset() method of the corresponding environment.

Raises

RuntimeError – In case of failure.

Return type

None

set_action(action)

Set the task action.

This method contains the logic for setting the environment action. It is called in the beginning of the gym.Env.step() method.

Parameters

action (Action) – The action to set.

Raises

RuntimeError – In case of failure.

Return type

None

gym_ignition_environments.tasks.pendulum_swingup

class gym_ignition_environments.tasks.pendulum_swingup.PendulumSwingUp(agent_rate, **kwargs)

Bases: gym_ignition.base.task.Task, abc.ABC

create_spaces()

Create the action and observations spaces.

Note

This method does not currently have access to the Models part of the environment. If the Task is meant to work on different models, we recommend using their URDF / SDF model to extract the information you need (e.g. number of DoFs, joint position limits, etc). Since actions and observations are often normalized, in many cases there’s no need to extract a lot of information from the model file.

Raises

RuntimeError – In case of failure.

Return type

Tuple[ActionSpace, ObservationSpace]

Returns

A tuple containing the action and observation spaces.

get_observation()

Return the task observation.

This method contains the logic for constructing the environment observation. It is called in the end of both gym.Env.reset() and gym.Env.step() methods.

Raises

RuntimeError – In case of failure.

Return type

Observation

Returns

The task observation.

get_reward()

Return the task reward.

This method contains the logic for computing the environment reward. It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

Reward

Returns

The scalar reward.

is_done()

Return the task termination flag.

This method contains the logic for defining when the environment has terminated. Subsequent calls to Task.set_action() should be preceded by a task reset through Task.reset_task().

It is called in the end of the gym.Env.step() method.

Raises

RuntimeError – In case of failure.

Return type

bool

Returns

True if the environment terminated, False otherwise.

reset_task()

Reset the task.

This method contains the logic for resetting the task. It is called in the gym.Env.reset() method of the corresponding environment.

Raises

RuntimeError – In case of failure.

Return type

None

set_action(action)

Set the task action.

This method contains the logic for setting the environment action. It is called in the beginning of the gym.Env.step() method.

Parameters

action (Action) – The action to set.

Raises

RuntimeError – In case of failure.

Return type

None