unreal.LearningAgentsManagerListener

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

Bases: Object

Base class for objects which can be added to a ULearningAgentsManager to receive callbacks whenever agents are added, remove or reset.

C++ Source:

  • Plugin: LearningAgents

  • Module: LearningAgents

  • File: LearningAgentsManagerListener.h

Editor Properties: (see get_editor_property/set_editor_property)

  • 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.

get_agent(agent_id=-1, agent_class) Object

Gets the agent with the given id from the manager. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type. If not in a blueprint, you should call the manager’s GetAgent methods directly.

Parameters:
  • agent_id (int32) – The id of the agent to get.

  • agent_class (type(Class)) – The class to cast the agent object to (in blueprint).

Returns:

The agent object.

Return type:

Object

get_agent_manager() LearningAgentsManager

Gets the agent manager associated with this object.

Return type:

LearningAgentsManager

get_agents(agent_ids, agent_class) Array[Object]

Gets the agents associated with a set of ids from the manager. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type. If not in a blueprint, you should call the manager’s GetAgents method directly.

Parameters:
  • agent_ids (Array[int32]) – The ids of the agents to get.

  • agent_class (type(Class)) – The class to cast the agent objects to (in blueprint).

Returns:

out_agents (Array[Object]): The output array of agent objects.

Return type:

Array[Object]

get_all_agents(agent_class) -> (out_agents=Array[Object], out_agent_ids=Array[int32])

Gets all added agents from the manager. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type.

Parameters:

agent_class (type(Class)) – The class to cast the agent objects to (in blueprint).

Returns:

out_agents (Array[Object]): The output array of agent objects.

out_agent_ids (Array[int32]): The output array of agent ids.

Return type:

tuple

is_setup() bool

Returns true if this object has been setup. Otherwise, false.

Return type:

bool

on_agents_added(agent_ids) None

Called whenever agents are added to the manager.

Parameters:

agent_ids (Array[int32]) – Array of agent ids which have been added

on_agents_manager_tick(agent_ids, delta_time) None
Called whenever the manager object is ticked.

.

Parameters:
  • agent_ids (Array[int32]) – Array of agent ids which have been ticked

  • delta_time (float) – The delta time associated with the tick

on_agents_removed(agent_ids) None

Called whenever agents are removed from the manager.

Parameters:

agent_ids (Array[int32]) – Array of agent ids which have been removed

on_agents_reset(agent_ids) None

Called whenever agents are reset on the manager.

Parameters:

agent_ids (Array[int32]) – Array of agent ids which have been reset