AcresSimControl.h#
Acres/Source/Acres/AcresSimControl.h Generated
Simulator control: the session-wide channel the ROS 2 side (ROS/acres_sim) and learners use to pause, play and step the world in lockstep, reset it, move and spawn entities, change the conditions and the vehicles' hardware shifts, record the episode log and replay one. Protocol: Documentation/Reference/sim-control.md (newline-delimited JSON on 127.0.0.1, -SimControl=<port>); episode log: Documentation/Reference/episode-log.md.
-SimControl=<port> the control channel
-Lockstep start held: the world advances only on step requests
-EpisodeLog=<file.mcap> record the episode log from the first physics step
-EpisodeReplay=<file.mcap> replay an episode log (the agents follow their logged poses; -EpisodeReplayExit
quits when it ends)
Agent 0 (the game mode's pawn) creates the one instance at the end of its BeginPlay when any of these flags is given, after it spawned the other agents, and deletes it in EndPlay.
Lockstep: a step request switches the engine to a fixed frame time of exactly one physics step (FApp fixed time step at the async physics step, 1/120 s: the Chaos solver then runs exactly one step per frame), releases the world (AWorldSettings pauser cleared) for N frames and holds it again (pauser set) before the next frame's world tick. While held, the world does not tick (no physics, game time, NPC or timer), but frames keep rendering and the vehicle pawns keep ticking (bTickEvenWhenPaused): their sensors finish the scans and images that fell due and their bridges flush reports. The reply is sent when the physics has done N steps and every agent's sensors are idle, after a barrier went into each connected sensor stream and RL bridge.
Threads: everything runs on the game thread (FWorldDelegates::OnWorldTickStart for the socket and the step scheduling, FCoreDelegates::OnEndFrame for completion, recording and replay bookkeeping) except RecordStep and ReplayState, which the pawns call from their physics steps.
FAcresSimControl#
Opens the channel and the log or replay the command line asks for.
| Argument | Description |
|---|---|
InAgent0 |
The session's agent 0 (the game mode's pawn); must outlive this object. |
~FAcresSimControl#
Closes the socket and the episode log, restores the engine's frame timing.
Get#
The session's instance, or null. Game thread (and the pawns' physics steps, which only use the thread-safe members).
IsRequested#
True when the command line asks for simulator control (any of the flags above).
IsLockstep#
True while the world is in lockstep (held or stepping): the RL bridge then does not brake a client that is slow in wall-clock time.
RecordStep#
Physics thread, end of every agent's step: queues the agent's state for the episode log. Cheap when not recording.
| Argument | Description |
|---|---|
Agent |
The pawn. |
State |
Its episode-log state after the step (base_footprint pose in the world frame, ...). |
WorldTimeS |
World time of the step, s. |
IsRecording#
True while an episode log is being recorded. Any thread.
IsReplaying#
True while an episode log is being replayed (the pawns then follow it instead of simulating).
ReplayState#
Physics thread: the logged state of an agent at a replay step.
| Argument | Description |
|---|---|
AgentName |
The agent's name. |
ReplayStep |
Physics steps since the replay started (0 = the first logged step). |
Out |
The logged state (the last one once the log has ended). |
OutWorldTimeS |
The logged world time of that step, s. |
Returns: False when the log has no such agent.