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:
action_object (LearningAgentsActionObject) – Action object used to construct the output Action Object Element.
observation_object (LearningAgentsObservationObject) – Input Observation Object.
observation_object_element (LearningAgentsObservationObjectElement) – Input Observation Object Element.
agent_id (int32) – Agent id associated with the observation.
- Returns:
out_action_object_element (LearningAgentsActionObjectElement): Output Action Object Element.
- Return type:
- 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:
action_object (LearningAgentsActionObject) – Action object used to construct output elements.
observation_object (LearningAgentsObservationObject) – Input Observation Object.
observation_object_elements (Array[LearningAgentsObservationObjectElement]) – Input Observation Object Elements.
agent_ids (Array[int32]) – Agent ids associated with each observation.
- 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:
- 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:
- Return type:
- classmethod make_controller(manager, interactor, class_, name='Controller') LearningAgentsController ¶
Constructs a new controller for the given agent interactor.
- Parameters:
manager (LearningAgentsManager) – The input Manager
interactor (LearningAgentsInteractor) – The input Interactor component
name (Name) – The controller name
- Return type:
- 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:
manager (LearningAgentsManager) –
interactor (LearningAgentsInteractor) –