unreal.LearningAgentsController

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

Bases: LearningAgentsManagerComponent

A controller provides a method for injecting actions into the learning agents system from 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)

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • helper_objects (Array[LearningAgentsHelper]): [Read-Only] The list of current helper objects.

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

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

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

  • manager (LearningAgentsManager): [Read-Only] The associated manager this component is attached to.

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

encode_actions() None

Call this function when it is time to gather all the actions for your agents. This should be called roughly whenever you are calling ULearningAgentsInteractor::EncodeObservations. This will call this controller’s SetActions event.

get_interactor(interactor_class) LearningAgentsInteractor

Gets the agent interactor associated with this component.

Parameters:

interactor_class (type(Class)) –

Return type:

LearningAgentsInteractor

run_controller() None

Calls EncodeObservations, followed by EncodeActions, followed by DecodeActions

set_actions(agent_ids) None

During this event, you should set the actions of your agents.

Parameters:

agent_ids (Array[int32]) – The list of agent ids to set actions for. See: LearningAgentsActions.h for the list of available actions. See: ULearningAgentsInteractor::GetAgent to get the agent corresponding to each id.

setup_controller(interactor) None

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

Parameters:

interactor (LearningAgentsInteractor) –