GEM Adapter

class gem_controllers.gem_adapter.GymElectricMotorAdapter(_env: (<class 'gym_electric_motor.core.ElectricMotorEnvironment'>, None) = None, env_id: (<class 'str'>, None) = None, controller: (<class 'gem_controllers.gem_controller.GemController'>, None) = None)[source]

The GymElectricMotorAdapter wraps a GemController to map the inputs and outputs to the environment.

Parameters
  • _env (ElectricMotorEnvironment) – The GEM-Environment that the controller shall be created for.

  • env_id (str) – The corresponding environment-id to specify the concrete environment.

  • controller (gc.GemController) – The GemController that should be wrapped.

control(state, reference)[source]

Function to calculate the action of the controller for the environment.

Parameters
  • state (np.array) – Array of the state of the environment.

  • reference (np.array) – Array of the references of the referenced states.

Returns

action

property controller

Wrapped GemController

property input_stage

Input stage of the controller

property output_stage

Output stage of the controller

reset()[source]

Reset all stages of the controller.

tune(env, env_id, tune_controller=True, **kwargs)[source]

Function to set the parameters of the controller stages.

Parameters
  • env (ElectricMotorEnvironment) – The GEM-Environment that the controller shall be tuned for.

  • env_id (str) – ID of the ElectricMotorEnvironment.

  • tune_controller (bool) – Flag, if the controller should be tuned.