Hello World¶
With your project open in Unreal Editor, you'll start the simulation, add a sensor to the world, stream images from it, change one of its properties while it streams, and step time — all from outside the engine.
1. Get a Python client¶
You have two options. Either works for everything on this page.
The build already generated the tempo_sim package and a virtual environment for you at
<project_root>/TempoEnv, with tempo_sim — and your project's own client package, if your
project defines services — already installed. Nothing to install.
# Linux / macOS
source ./TempoEnv/bin/activate
python
# Windows
source ./TempoEnv/Scripts/activate
winpty python
This is the option that always matches the server you just built, so it is the one to use while developing.
tempo_sim is also published to PyPI, so you can install it into any environment you like —
on this machine or another one:
python -m venv .venv
source .venv/bin/activate # .venv/Scripts/activate on Windows
pip install tempo-sim
Keep the installed version matched to the Tempo version your server runs.
The published package knows only Tempo's built-in services
Everything on this page works, because it only uses Tempo's own RPCs. If your project
defines its own services, the published tempo-sim has no knowledge of them — use the
generated environment, or publish your project's own
package.
2. Start the simulation¶
3. Spawn a sensor rig¶
An actor with a tripod mesh appears. It carries a TempoCamera on top — which may not be
visible, since a camera component has no mesh of its own.
BP_SensorRig ships in TempoSensors/Content/SensorRig/, so it is available in any project
using Tempo. See TempoWorld for what else spawn_actor can do —
deferred spawns, relative transforms, and spawning any C++ or Blueprint class in your project.
4. Stream images¶
From another terminal (leave the Python REPL open), run the included SensorPlayground example client:
Use it to list the available sensors and start streaming color images from the TempoCamera.
If you installed tempo-sim yourself
The example clients need the visualization extras, which the generated environment already
has: pip install "tempo-sim[examples]".
5. Change a property while it streams¶
Back in the Python REPL:
tw.set_float_property(actor="BP_SensorRig", component="TempoCamera",
property="FOVAngle", value=60.0)
The field of view of your streaming images should narrow immediately. FOVAngle is not a
Tempo-specific API — it is an ordinary UPROPERTY reached through Unreal's reflection system,
which is how TempoWorld can get or set any property on any actor or component. See
Getting and setting properties.
6. Control time¶
import tempo_sim.tempo_core as tc
import tempo_sim.TempoCore.Time_pb2 as Time
tc.pause() # time stops
tc.play() # time resumes
tc.set_time_mode(Time.TM_FIXED_STEP) # switch to Fixed Step; the sim runs faster than real time
tc.step() # advance to the next whole fixed step (0.1 s by default)
tc.step() # advance exactly one step — and get exactly one new image
That last pair is the point of Fixed Step mode: one step, one frame, one sensor measurement, every time, regardless of how fast the machine renders. See Time for what each mode guarantees and why the first step after switching is a partial one.
You're up and running¶
Congratulations. Keep experimenting: create new scenes, stream more sensor types, and vary the many properties of your simulation at runtime.