stable_learning_control.disturbers.action_impulse_disturber

Contains a small gymnasium wrapper that can be used to disturb the action of a gymnasium environment with a impulse applied at a certain time step (i.e. magnitude and time).

Module Contents

Classes

ActionImpulseDisturber

A gymnasium wrapper that can be used to disturb the action of a gymnasium

Functions

get_time_attribute(env)

Get the time attribute of the environment.

get_time_step_attribute(env)

Get the time step attribute of the environment.

stable_learning_control.disturbers.action_impulse_disturber.get_time_attribute(env)[source]

Get the time attribute of the environment.

Parameters:

env (gym.Env) – The gymnasium environment.

Returns:

The time attribute of the environment.

Return type:

str

stable_learning_control.disturbers.action_impulse_disturber.get_time_step_attribute(env)[source]

Get the time step attribute of the environment.

Parameters:

env (gym.Env) – The gymnasium environment.

Returns:

The time step attribute of the environment.

Return type:

str

class stable_learning_control.disturbers.action_impulse_disturber.ActionImpulseDisturber(env, magnitude, time)[source]

Bases: gymnasium.ActionWrapper

A gymnasium wrapper that can be used to disturb the action of a gymnasium environment with a impulse applied at a certain time step.

impulse_magnitude

The magnitude of the impulse.

Type:

float

impulse_time

The time (s) at which to apply the impulse.

Type:

float

Initialise the ActionImpulseDisturber object.

Parameters:
  • env (gym.Env) – The gymnasium environment.

  • magnitude (float) – The impulse magnitude to apply.

  • time (float) – The time (s) at which to apply the impulse.

time_warning = False[source]
time_step_warning = False[source]
track_time()[source]

Track the time of the environment.

action(action)[source]

Add a impulse to the action.

Parameters:

action (np.ndarray) – The action.

Returns:

The action with added impulse.

Return type:

np.ndarray