Skip to content

FURLabRpcDispatcher

Transport-agnostic step-server core.

Owns session id, mode state, step counter, request queues, and all the Handle* / dispatch logic. Knows nothing about ZMQ, SHM, msgpack, or any specific wire transport. Multiple transports (ZMQ, SHM) call into the same dispatcher; they only differ in how bytes get from the wire to Dispatch() and back. Lives on AAMjManager so all transports share one instance; the dispatcher's serializing mutex makes concurrent dispatches from multiple transports safe.

Attribute Value
Kind Class

Properties

Public Properties

Property Type Description
minimal ``
standard ``
changes Called when a PIE cycle ends or the editor level *
URLabVersion FString Wire format echoed to the client as the urlab plugin version.
FJsonObject Returns the reply as an

minimal

  • Type:

standard

  • Type:

changes

  • Type: Called when a PIE cycle ends or the editor level *

URLabVersion

Wire format echoed to the client as the urlab plugin version.

  • Type: FString

FJsonObject

  • Type: Returns the reply as an

Private Properties

Property Type Description
Dispatch ** Inner body of
OwnerMgr TWeakObjectPtr<AAMjManager> Weak so stale-manager bugs return nullptr on .Get() instead of
DispatchMutex FCriticalSection Guards ActiveSessionId + step-handler install/uninstall. NOT held
ActiveSessionId FString
CachedReplayManager TWeakObjectPtr<AMjReplayManager>
StepQueue TQueue<TSharedPtr<FMjDirectStepCommand>, EQueueMode::Spsc> SPSC. Shared ownership so both RPC + physics threads can drop their
PushStateQueue TQueue<FMjPushStateRequest, EQueueMode::Spsc> Puppet-mode request queue.
PuppetStepHandler UMjPhysicsEngine::FMujocoStepCallback Custom step handlers installed on the engine for Direct / Puppet.
DirectStepHandler UMjPhysicsEngine::FMujocoStepCallback
bPuppetHandlerInstalled bool
bDirectHandlerInstalled bool
RegisteredOpNames TArray<FString>

Dispatch

  • Type: ** Inner body of

OwnerMgr

Weak so stale-manager bugs return nullptr on .Get() instead of

DispatchMutex

Guards ActiveSessionId + step-handler install/uninstall. NOT held

  • Type: FCriticalSection

ActiveSessionId

  • Type: FString

CachedReplayManager

StepQueue

SPSC. Shared ownership so both RPC + physics threads can drop their

PushStateQueue

Puppet-mode request queue.

PuppetStepHandler

Custom step handlers installed on the engine for Direct / Puppet.

DirectStepHandler

bPuppetHandlerInstalled

  • Type: bool

bDirectHandlerInstalled

  • Type: bool

RegisteredOpNames

  • Type: TArray

Functions

Public Functions

General

Function Returns Description
Init() void Bind the dispatcher to a manager (game thread, called from BeginPlay).
OnManagerGone() void Per-manager teardown: drop the manager pointer, uninstall step
Shutdown() void Full bridge-server teardown. Resets everything OnManagerGone
SetDraining() void Cooperative shutdown signal. Set by BridgeServer::Stop() so blocking
Dispatch() TSharedPtr<FJsonObject> Parse one inbound (already-decoded) request and run the matching
SetCachedReplayManager() void Worker threads read the replay manager via this cache instead of
BuildHandshakePayload() TSharedPtr<FJsonObject> Build the hello-reply payload. When bIncludeAssets is true (caller
AppendClockFields() void Stamps sim_time + wall_time blocks (ROS builtin_interfaces/Time
Init

Bind the dispatcher to a manager (game thread, called from BeginPlay).

OnManagerGone

Per-manager teardown: drop the manager pointer, uninstall step

  • Signature: OnManagerGone()
Shutdown

Full bridge-server teardown. Resets everything OnManagerGone

  • Signature: Shutdown()
SetDraining

Cooperative shutdown signal. Set by BridgeServer::Stop() so blocking

  • Signature: SetDraining(bool bIn)
Dispatch

Parse one inbound (already-decoded) request and run the matching

  • Signature: Dispatch(const TSharedPtr<FJsonObject>& Req)
  • Returns: TSharedPtr
SetCachedReplayManager

Worker threads read the replay manager via this cache instead of

BuildHandshakePayload

Build the hello-reply payload. When bIncludeAssets is true (caller

  • Signature: BuildHandshakePayload(AAMjManager* Manager, const FString& SessionId, const FString& URLabVer, bool bIncludeAssets)
  • Returns: TSharedPtr
AppendClockFields

Stamps sim_time + wall_time blocks (ROS builtin_interfaces/Time

  • Signature: AppendClockFields(TSharedPtr<FJsonObject>& Reply, double SimTimeSec)

Private Functions

General

Function Returns Description
DispatchInternal() TSharedPtr<FJsonObject> Inner body of Dispatch; wrapped by the public method so every
RegisterDispatcherOps() void Register every dispatcher-owned op (manager-required +
DispatchInternal

Inner body of Dispatch; wrapped by the public method so every

  • Signature: DispatchInternal(const TSharedPtr<FJsonObject>& Req)
  • Returns: TSharedPtr
RegisterDispatcherOps

Register every dispatcher-owned op (manager-required +

  • Signature: RegisterDispatcherOps()