Asynchronous Client API
Overview
Performance Comparison
Feature
Sync Client
Async Client
Getting Started
import asyncio
from uesynth import AsyncUESynthClient
async def main():
# Connect to UESynth
client = AsyncUESynthClient()
await client.connect()
try:
# Your async code here...
pass
finally:
# Always disconnect
await client.disconnect()
# Run the async function
asyncio.run(main())Client Configuration
Basic Connection
Advanced Options
Core Methods
Connection Management
connect()
connect()disconnect()
disconnect()is_connected()
is_connected()ping()
ping()Request Modes
1. Streaming Mode (Non-blocking)
2. Direct Mode (Blocking)
Camera Control (Streaming)
Position and Rotation
camera.set_location(x, y, z)
camera.set_location(x, y, z)camera.set_rotation(pitch, yaw, roll)
camera.set_rotation(pitch, yaw, roll)Camera Settings
camera.set_fov(fov)
camera.set_fov(fov)Camera Control (Direct)
Position and Rotation
camera.get_location_direct()
camera.get_location_direct()camera.get_rotation_direct()
camera.get_rotation_direct()camera.set_location_direct(x, y, z)
camera.set_location_direct(x, y, z)Data Capture (Streaming)
Image Capture
capture.rgb(width=None, height=None)
capture.rgb(width=None, height=None)capture.depth(width=None, height=None)
capture.depth(width=None, height=None)capture.segmentation(width=None, height=None)
capture.segmentation(width=None, height=None)Data Capture (Direct)
Image Capture
capture.rgb_direct(width=None, height=None)
capture.rgb_direct(width=None, height=None)capture.depth_direct(width=None, height=None)
capture.depth_direct(width=None, height=None)capture.all_modalities_direct(width=None, height=None)
capture.all_modalities_direct(width=None, height=None)Frame Management
Getting Captured Data
get_latest_frame()
get_latest_frame()get_frame_by_id(request_id)
get_frame_by_id(request_id)wait_for_frame(request_id, timeout=5.0)
wait_for_frame(request_id, timeout=5.0)Object Manipulation
Transform Control (Streaming)
objects.set_location(name, x, y, z)
objects.set_location(name, x, y, z)objects.set_rotation(name, pitch, yaw, roll)
objects.set_rotation(name, pitch, yaw, roll)Transform Control (Direct)
objects.set_transform_direct(name, x, y, z, pitch=0, yaw=0, roll=0)
objects.set_transform_direct(name, x, y, z, pitch=0, yaw=0, roll=0)objects.get_transform_direct(name)
objects.get_transform_direct(name)High-Performance Patterns
Concurrent Operations
Real-time Simulation Loop
Batch Processing
Error Handling
Context Manager
Performance Tips
1. Use Streaming for High Throughput
2. Minimize Await Points
3. Configure Buffer Sizes
Complete Example
Next Steps
Last updated