Skip to main content

Module realtime

Module realtime 

Source
Expand description

User-facing RealtimeAsyncWorld API and shutdown state machine.

This is the primary mode for RL training: the tick engine runs on a dedicated background thread at a configurable rate (default 60 Hz), while an egress thread pool serves observation requests concurrently.

§Architecture

User Thread(s)              Tick Thread              Egress Workers (N)
    |                           |                         |
    |--submit_commands()------->| cmd_rx.try_recv()       |
    |   [cmd_tx: bounded(64)]   | engine.submit_commands()|
    |<--receipts via reply_tx---| engine.execute_tick()   |
    |                           | ring.push(snap)         |
    |                           | epoch_counter.advance() |
    |                           | check_stalled_workers() |
    |                           | sleep(budget - elapsed) |
    |                           |                         |
    |--observe()------------------------------------->    |
    |   [obs_tx: bounded(N*4)]               task_rx.recv()
    |   blocks on reply_rx                   ring.latest()
    |                                        pin epoch
    |                                        execute ObsPlan
    |                                        unpin epoch
    |<--result via reply_tx--------------------------    |

Structs§

RealtimeAsyncWorld
Realtime asynchronous simulation world.
ShutdownReport
Report from the shutdown state machine.

Enums§

SubmitError
Error submitting commands to the tick thread.