Session
API Reference - session
This module allows you to get the state and interact with the simulation.
session.run([speed])
Starts or resumes simulation with a given speed. If no speed is provided, simulation will run with speed=1. You can use large number (f32::MAX or Infinity) to run with unlimited speed.
await client.rpc('session.run')await client.rpc('session.run', { speed: 4.0 })
Work in Progress
session.run()session.run(4.0)
session.pause()
Pauses simulation.
await client.rpc('session.pause')
Work in Progress
session.pause()
session.step()
Runs one step, then pauses simulation.
await client.rpc('session.step')
Work in Progress
session.step()
session.restart()
Restarts simulation from the beginning. Map will also be reset, so you need to spawn objects again if needed.
await client.rpc('session.restart')
Work in Progress
session.restart()
session.exit([code])
Exits simulator with a given code (in [0-255] range, 0 by default).
await client.rpc('session.exit')await client.rpc('session.exit', { code: 1 })
Work in Progress
session.exit()session.exit(1)
session.state()
Returns current simulation state (time elapsed, current sim-to-real speed).
let state = await client.rpc('session.state')// or subscribelet sub = client.newSubscription('session.state')
Work in Progress
local state = session.state()
Return value is a table with two fields:
time_us
(u64) - time elapsed since start of simulation in microsecondsspeed
(f32) - current sim-to-real speed