Real-time simulations#

module:

navground.sim.real_time

Perform an experiment in real-time#

Helper class to simulated a navground.sim.World in real-time using an ayncio.

>>> word = ...
>>> sim = RealTimeSimulation(world=world, time_step=0.1, web_ui=WebUI())
>>> await sim.run()

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.

Initializes the simulation and the UI

Simulate a world.

Parameters:

until – an optional condition to terminate the simulation

Run a simulation in a thread. Blocks until the simulation is done.

Parameters:

until – an optional condition to terminate the simulation

Perform a simulation step.

Returns:

Whether the step could be performed or not.

Signals to stop the simulation

Updates the UI with the world state.

Replay an experiment in real-time#

Bases: RealTimeSimulation

Helper class to replay an navground.sim.RecordedExperimentalRun in real-time.

>>> # load a run from a recorded experiment
>>> run = ...
>>> sim = RealTimeSimulation(run=run, web_ui=WebUI())
>>> await sim.run()

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.