Real-time simulations#
- module:
Perform an experiment in real-time#
- class RealTimeSimulation#
- Helper class to simulated a - navground.sim.Worldin real-time using an ayncio.- >>> word = ... >>> sim = RealTimeSimulation(world=world, time_step=0.1, web_ui=WebUI()) >>> await sim.run() - __init__(world: World, time_step: float, factor: float = 1.0, web_ui: WebUI | None = None, bounds: Rect | None = None)#
- Constructs a new instance. - Parameters:
- world – The world to simulate 
- time_step – The time step to apply 
- factor – The real-time factor 
- web_ui – An optional web user interface to sync with 
- bounds – The region to display in the web_ui. If not set, it will estimate it from the current world state. 
 
 
 - async run(until: Callable[[], bool] | None = None) → None#
- Simulate a world. - Parameters:
- until – an optional condition to terminate the simulation 
 
 - run_threaded(until: Callable[[], bool] | None) → None#
- Run a simulation in a thread. Blocks until the simulation is done. - Parameters:
- until – an optional condition to terminate the simulation 
 
 
Replay an experiment in real-time#
- class RealTimeReplay#
- Bases: - RealTimeSimulation- Helper class to replay an - navground.sim.RecordedExperimentalRunin real-time.- >>> # load a run from a recorded experiment >>> run = ... >>> sim = RealTimeSimulation(run=run, web_ui=WebUI()) >>> await sim.run() - __init__(run: RecordedExperimentalRun, factor: float = 1.0, web_ui: WebUI | None = None, bounds: Rect | None = None)#
- Constructs a new instance. - Parameters:
- run – The recorded run 
- factor – The real time factor 
- web_ui – An optional web user interface to sync with 
- bounds – The region to display in the web_ui. If not set, it will compute it from the recorded poses. 
 
 - The run should contain at least recorded poses, else it would be useless to replay it.