a2rl.SimulatorWrapper#

class a2rl.SimulatorWrapper(env)[source]#

Bases: ActionWrapper

Make a2rl.Simulator accept tokenized actions only, to conform to the gym-style which requires discrete actions as integers.

The gym-style requires the external agent to perform integer-encoded actions such as [0, 1, 2]. On the other hand, Whatif Simulator expects the original actions which may be non-integer (e.g., left). To bridge these two styles, this wrapper automatically transforms the gym-style actions into Whatif-style actions, e.g., [0, 1, 2] into ['left' , 'right', 'up'].

Parameters:

env (Simulator) – Whatif simulator which accept raw actions.

Wraps an environment to allow a modular transformation of the step() and reset() methods.

Parameters:
  • env (Simulator) – The environment to wrap

  • new_step_api – Whether the wrapper’s step method will output in new or old step API

Methods

action(action)

Convert gym-style actions to their respective Whatif actions.

reverse_action(action)

Returns a reversed action.

Attributes

gym_action_to_enc