Skip to content

gRPCImitationProtocol

Full path: schola.core.protocols.protobuf.offlinegRPC.gRPCImitationProtocol

schola.core.protocols.protobuf.offlinegRPC.gRPCImitationProtocol

gRPCImitationProtocol

gRPCImitationProtocol(url, port=None, protocol_start_timeout=45)

Bases: BaseImitationProtocol, SocketProtocolMixin

Methods

ItemDescription
init
closeClose the Unreal Connection.
get_dataGet demonstration data from the environment.
get_definitionGet the environment definition for imitation learning.
on_close()Close the Unreal Connection.
on_start()Bind the tcp_socket
send_startup_msgSend the startup message for imitation learning data collection.
startOpen the Connection to Unreal Engine.

Attributes

ItemDescription
addressReturns the address of the connection
channel_connectedReturns whether the connection is active or not
has_socketReturns whether the connection is active or not
mixin_propertiesGet mixin-specific properties.
propertiesGet protocol-specific properties.

Parameters

url (str)

port (int)

protocol_start_timeout (int)

init

__init__(url, port=None, protocol_start_timeout=45)

Parameters

url (str)

port (int)

protocol_start_timeout (int)


channel_connected

channel_connected: bool

Returns whether the connection is active or not


close

close()

Close the Unreal Connection. Method must be safe to call multiple times.

Returns

None


get_data

get_data()

Get demonstration data from the environment.

Returns

A tuple containing:

  • Observations for each timestep
  • Rewards for each timestep
  • Termination flags
  • Truncation flags
  • Info dicts
  • Initial agent observations
  • Initial agent info dicts
  • Demonstration actions

Return type: Tuple[List[Dict[str,Any]], List[float], List[Dict[str,bool]], List[Dict[str,bool]], List[Dict[str,str]], Dict[int,Dict[str, Any]], Dict[int,Dict[str, str]], Dict[int, Dict[str,Any]]]


get_definition

get_definition()

Get the environment definition for imitation learning.

Returns

A tuple containing:

  • List of agent IDs per environment
  • Agent types indexed by environment and agent
  • Observation spaces indexed by environment and agent
  • Action spaces indexed by environment and agent

Return type: Tuple[List[List[str]], Dict[int, Dict[str, str]], Dict[int,Dict[str,gym.Space]], Dict[int,Dict[str,gym.Space]]]


properties

properties: Dict[str, Any]

Get protocol-specific properties.


send_startup_msg

send_startup_msg(seeds=None, options=None)

Send the startup message for imitation learning data collection.

Parameters

seeds (List, optional) : List of random seeds for each environment.

options (List, optional) : List of startup options for each environment.


start

start()

Open the Connection to Unreal Engine.

Returns

None