Synchronous Client API

The UESynthClient provides a synchronous, blocking API that's perfect for simple scripts, prototyping, and single-shot data capture tasks.

Overview

The synchronous client offers:

  • Simple, linear execution - Each call blocks until completion

  • Easy error handling - Exceptions are raised immediately

  • Straightforward debugging - Stack traces point to exact issues

  • Perfect for scripting - Ideal for batch processing and automation

Getting Started

from uesynth import UESynthClient

# Connect to UESynth
client = UESynthClient()

# Your code here...

# Always disconnect when done
client.disconnect()

Client Configuration

Basic Connection

Advanced Options

Core Methods

Connection Management

connect()

Establish connection to the UESynth server.

disconnect()

Close the connection and clean up resources.

is_connected()

Check if the client is currently connected.

ping()

Test server responsiveness.

Camera Control

Position and Rotation

camera.set_location(x, y, z)

Set the camera position in world coordinates.

Parameters:

  • x (float): X coordinate in world space

  • y (float): Y coordinate in world space

  • z (float): Z coordinate in world space

camera.set_rotation(pitch, yaw, roll)

Set the camera rotation in degrees.

Parameters:

  • pitch (float): Pitch rotation in degrees (-90 to 90)

  • yaw (float): Yaw rotation in degrees (0 to 360)

  • roll (float): Roll rotation in degrees (-180 to 180)

camera.get_location()

Get the current camera position.

Returns: Location object with .x, .y, .z attributes

camera.get_rotation()

Get the current camera rotation.

Returns: Rotation object with .pitch, .yaw, .roll attributes

Camera Settings

camera.set_fov(fov)

Set the camera field of view.

Parameters:

  • fov (float): Field of view in degrees (10-180)

camera.get_fov()

Get the current field of view.

Data Capture

Image Capture

capture.rgb(width=None, height=None)

Capture an RGB image from the current camera view.

Parameters:

  • width (int, optional): Image width in pixels

  • height (int, optional): Image height in pixels

Returns: numpy.ndarray with shape (height, width, 3) and dtype uint8

capture.depth(width=None, height=None)

Capture a depth map from the current camera view.

Returns: numpy.ndarray with shape (height, width) and dtype float32

capture.segmentation(width=None, height=None)

Capture a segmentation mask with object IDs.

Returns: numpy.ndarray with shape (height, width) and dtype uint32

capture.normals(width=None, height=None)

Capture surface normals.

Returns: numpy.ndarray with shape (height, width, 3) and dtype float32

Multi-Modal Capture

capture.all_modalities(width=None, height=None)

Capture all available data types in a single call.

Returns: Dictionary with keys: 'rgb', 'depth', 'segmentation', 'normals'

Object Manipulation

Transform Control

objects.set_location(name, x, y, z)

Move an object to a specific world position.

objects.set_rotation(name, pitch, yaw, roll)

Set an object's rotation.

objects.set_scale(name, x, y, z)

Set an object's scale.

objects.get_transform(name)

Get an object's complete transform information.

Object Queries

objects.list_all()

Get a list of all available objects in the scene.

objects.find_by_class(class_name)

Find objects by their Unreal Engine class.

Scene Control

Lighting

scene.set_time_of_day(hour, minute=0)

Control the time of day for dynamic lighting.

scene.set_sun_intensity(intensity)

Control the directional light intensity.

Weather and Environment

scene.set_weather(weather_type)

Set weather conditions.

Error Handling

The synchronous client uses standard Python exceptions:

Performance Considerations

Batching Operations

For better performance, minimize round trips:

Context Manager

Use the context manager for automatic cleanup:

Complete Example

Next Steps

Last updated