Try the example first
Run the incremental depth cookbook example to send one depth frame followed by groups of four, check the episode and step identifiers on each reply, verify the returned image hashes, and save every RGB PNG. It uses prepared test depth rather than running a simulator or evaluating a policy. Replace those test inputs with your simulator’s depth frames when building the loop below.Run the observation loop
- Render the initial simulator depth and call
initialize. Wait for its one-frame RGB result. - Let the policy consume that observation and choose actions.
- Advance the simulator for four render frames, recording the depth at each frame.
- Submit those four depth frames with
advance. Pause simulation time while rendering completes. - Match the result’s episode and step identifiers, consume its ordered RGB frames, and repeat.
step_result before using its
observations. The video preview can drop or repeat frames, so use the PNG results for policy input.
On timeout, check the episode state and retrieve or retry the same step before advancing simulation.
This tests policy behavior with generated visual observations. Compare against simulator RGB and
real-camera evaluation where available. Measure task outcomes from simulator state, and check
whether generated appearance preserves task-relevant geometry and objects. More realistic-looking
images alone do not establish that a policy will perform better on a physical robot.
Send depth and receive frames
Use a normal Reactor session with Python SDK 1.10.0 or JavaScript SDK 3.2.0. Register astep_result listener before submitting commands. These are session commands, not new REST
endpoints.
step_accepted confirms that the request was accepted. step_result contains episode_id,
step_index, first_frame, ordered frames_png_b64, corresponding sha256 hashes of decoded RGB
uint8 pixels in row-major order, and complete.
Match the episode and step identifiers, check that complete is true, and use each result once.
The same reply can arrive through both the command return value and the SDK message callback;
avoid processing it twice. If you receive step_failed, correct the input and initialize a new
episode.
Use prepared RGB 8-bit PNG depth visualizations, base64 encoded without a data-URL prefix. Metric
float arrays, 16-bit depth, and ordinary RGB footage are not accepted substitutes. The
metric-depth preparation example
shows how to convert distances to pixel values and handle invalid depths. Use the same near and far
distance bounds throughout the episode.
Each PNG must already match the selected output size: 832×480 for 16,9, 736×544 for 4,3, 640×640
for 1,1, 544×736 for 3,4, or 480×832 for 9,16. This mode does not resize or crop. Each encoded
input PNG is limited to 4 MiB. Only depth is supported in this mode.
total_frames is a finite 1 + 4N, from 1 through 597 (default 121). Prompt, framing, seed, and
preview selection remain fixed until reset. Set preview: false to receive PNG results without a
video preview. With preview enabled, the same generated frames also appear on main_video; use
step_result for complete observations. The SDK splits large results across data-channel messages;
older clients that limit messages to 256 KiB without reassembly are unsupported.
Keep one step outstanding at a time. Retrying the most recent completed advance with exactly the
same input returns its saved result; changing that input is rejected. Only the latest completed
result is retained.
If a request times out, use get_episode_state to check its status. Retrieve the latest completed
result with get_step_result, or retry the same input. Do not increase step_index just because
the request timed out. If the session is lost, start a new episode; you cannot resume the old one.
Reset before switching between this workflow and uploaded-video rendering.