Skip to content

ExternalAgentRegistry

static class ยท namespace Hazel

public static class ExternalAgentRegistry

Methods

ClearGrpcClientFlag()

static

public static void ClearGrpcClientFlag()

ClearNegotiatedSession()

static

public static void ClearNegotiatedSession()

Clear the active negotiated session. Called on scene stop.

CommitPendingGroups()

static

public static bool CommitPendingGroups()

Merge all pending action groups into the action buffer and signal the gate. Uses DefaultJointPosBuffer as the base for any indices not covered by groups. Called by Step() when action_groups are provided but no flat actions vector.

GetAgentName(int)

static

public static string GetAgentName(int agentIndex)

GetCurrentFrameNumber()

static

public static long GetCurrentFrameNumber()

GetNegotiator()

static

public static ContractNegotiator GetNegotiator()

Get or create the contract negotiator singleton.

GetOwnedActuatorIndices()

static

public static System.Collections.Generic.HashSet<int> GetOwnedActuatorIndices()

GetReadinessDiagnostic()

static

public static string GetReadinessDiagnostic()

Returns a human-readable diagnostic string describing why the external agent batch is not ready, or empty string if ready. Thread-safe โ€” intended for polling from the editor UI and gRPC responses.

HasGrpcClient()

static

public static bool HasGrpcClient()

HasPendingGroups()

static

public static bool HasPendingGroups()

Check if any action groups have been preloaded but not yet committed.

InvalidateBatch()

static

public static void InvalidateBatch()

IsExternalBatchReady()

static

public static bool IsExternalBatchReady()

MarkGrpcClientConnected()

static

public static void MarkGrpcClientConnected()

NotifyExternalBatchSetupComplete(RobotManager)

static

public static void NotifyExternalBatchSetupComplete(RobotManager manager)

PreloadActionGroup(string, float[], int[])

static

public static bool PreloadActionGroup(string groupName, float[] actions, int[] indices)

Preload actions for a named group. Does NOT trigger a physics step. Multiple groups accumulate until CommitPendingGroups() or a flat TrySetExternalActions() call merges and signals the gate. Thread-safe โ€” called from gRPC handler threads.

Register(RobotManager, RobotEnv, Entity)

static

public static void Register(RobotManager manager, RobotEnv env, Entity mujocoEntity)

SetResetCallback(Action?)

static

public static void SetResetCallback(Action? callback)

TryCopyActionSlice(int, float[], long)

static

public static bool TryCopyActionSlice(int agentIndex, float[] destination, out long version)

TryCopyEnrichedStepData(Dictionary?, Dictionary?, bool, bool)

static

public static bool TryCopyEnrichedStepData(out Dictionary<string, float>? rewardSignals, out Dictionary<string, bool>? terminationFlags, out bool terminated, out bool truncated)

Copy the latest enriched step data for the gRPC response. Returns false if no enriched data is available.

TryCopyStateSlice(int, float[], long)

static

public static bool TryCopyStateSlice(int agentIndex, float[] destination, out long version)

TryGetAgentByName(string, RobotAgent?, int)

static

public static bool TryGetAgentByName(string agentName, out RobotAgent? agent, out int agentIndex)

TryGetAgentSizes(int, int, int)

static

public static bool TryGetAgentSizes(int agentIndex, out int stateSize, out int actionSize)

TryGetExternalActionLayout(int, int, int)

static

public static bool TryGetExternalActionLayout(out int agentCount, out int actionSize, out int totalActionSize)

TryGetMujocoEntity(Entity)

static

public static bool TryGetMujocoEntity(out Entity entity)

TryResetAgentByName(string, Hazel.Rpc.SimulationContract?, string)

static

public static bool TryResetAgentByName(string agentName, Hazel.Rpc.SimulationContract? simulationContract, out string message)

TrySetExternalActions(IReadOnlyList)

static

public static bool TrySetExternalActions(IReadOnlyList<float> controls)

Unregister(RobotManager)

static

public static void Unregister(RobotManager manager)

WaitForFrameAsync(long, CancellationToken, float)

static

public static Task<long> WaitForFrameAsync(long currentFrame, CancellationToken cancellationToken, float timeoutS = 0.1f)

Source: Hazel/Learn/Utilities/ExternalAgentRegistry.cs