unreal.LearningAgentsController

class unreal.LearningAgentsController(outer: Object | None = None, name: Name | str = 'None')

Bases: LearningAgentsManagerListener

A controller is an object that can be used to construct actions from observations - essentially a hand-made Policy. This can be useful for making a learning agents system that uses some other existing behavior, e.g. we may want to gather demonstrations from a human or AI behavior tree controlling our agent(s) for imitation learning purposes.

C++ Source:

  • Plugin: LearningAgents

  • Module: LearningAgents

  • File: LearningAgentsController.h

Editor Properties: (see get_editor_property/set_editor_property)

  • interactor (LearningAgentsInteractor): [Read-Only] The agent interactor this controller is associated with.

  • is_setup (bool): [Read-Only] True if this object has been setup. Otherwise, false.

  • manager (LearningAgentsManager): [Read-Only] The manager this object is associated with.

  • visual_logger_objects (Map[Name, LearningAgentsVisualLoggerObject]): [Read-Only] The visual logger objects associated with this listener.

evaluate_agent_controller(action_object, observation_object, observation_object_element, agent_id) LearningAgentsActionObjectElement

This callback should be overridden by the Controller and produces an Action Object Element from an Observation Object Element.

Parameters:
Returns:

out_action_object_element (LearningAgentsActionObjectElement): Output Action Object Element.

Return type:

LearningAgentsActionObjectElement

evaluate_agent_controllers(action_object, observation_object, observation_object_elements, agent_ids) Array[LearningAgentsActionObjectElement]

This callback can be overridden by the Controller and produces an array of Action Object Elements, from an array of Observation Object Elements. By default this will call EvaluateAgentController for each agent.

Parameters:
Returns:

out_action_object_elements (Array[LearningAgentsActionObjectElement]): Output Action Object Elements. This should be the same size as the input AgentIds and InObservationObjectElements arrays.

Return type:

Array[LearningAgentsActionObjectElement]

evaluate_controller() None

Call this function when it is time to evaluate the controller and produce the actions for the agents. This should be called after GatherObservations but before PerformActions. This will call this controller’s EvaluateAgentController event.

get_interactor(interactor_class) LearningAgentsInteractor

Gets the agent interactor associated with this component.

Parameters:

interactor_class (type(Class)) –

Return type:

LearningAgentsInteractor

classmethod make_controller(manager, interactor, class_, name='Controller') LearningAgentsController

Constructs a new controller for the given agent interactor.

Parameters:
Return type:

LearningAgentsController

run_controller() None

Calls GatherObservations, followed by EvaluateController, followed by PerformActions

setup_controller(manager, interactor) None

Initializes this object to be used with the given agent interactor.

Parameters: