ue (UE Engine)¶
The ue module provides control interfaces for the Unreal Engine simulation engine, including scene resource management, 3D model control, weather and time control, camera view control, and sensor data acquisition.
Module Functions¶
| Function | Description |
|---|---|
| Scene Resource Management | Loading, switching, and managing resources in UE scenes |
| 3D Model Control | Position, orientation, and scaling control of 3D models in the scene |
| Weather and Time Control | Setting weather, lighting, and time in the simulation environment |
| Camera View Control | Switching, tracking, and recording of observation viewpoints |
| Sensor Data Acquisition | Acquisition of sensor data such as depth maps, segmentation maps, and normal maps |
Core Classes and Interfaces¶
| Class/Interface | Description |
|---|---|
UE4CtrlApi |
Core class for UE4 engine control, supporting scene and model control |
UE5CtrlApi |
Core class for UE5 engine control, supporting Nanite and Lumen |
UEMapServe |
UE map service management, supporting scene switching |
SceneObj |
Scene object management, supporting 3D model control |
WeatherCtrl |
Weather control system |
CameraCtrl |
Camera view control system |
SensorCapture |
Sensor data acquisition interface |
Usage Scenarios¶
Scene Simulation¶
- Loading and switching of UE scenes
- Configuration of environmental elements such as terrain, buildings, and vegetation
- Streaming load optimization for large-scale scenes
Model Control¶
- Pose control of drone 3D models
- Adding and removing dynamic objects
- Collision detection and physics simulation
Environment Rendering¶
- Real-time switching of weather effects (clear, rainy, snowy, foggy)
- Day-night cycle and lighting changes
- Simulation of seasonal and climatic effects
Visual Capture¶
- Real-time acquisition of camera images
- Generation of depth maps and segmentation maps
- Synchronized acquisition of multi-view data
Code Example¶
from RflySimSDK.ue import UE4CtrlApi
# Create a UE4 control instance
ue = UE4CtrlApi()
# Connect to the UE4 engine
ue.connect('127.0.0.1', 8888)
# Load a scene
ue.loadScene('CityMap')
# Set weather
ue.setWeather('Cloudy')
# Set time (14:00)
ue.setTime(14, 0)
# Spawn a drone model at a specified position
drone = ue.spawnObject(
object_type='Quadcopter',
position=[0, 0, 5],
rotation=[0, 0, 0],
scale=[1, 1, 1]
)
# Control the drone to move to a specified position
drone.moveTo([10, 10, 5], speed=5)
# Set camera to follow the drone
camera = ue.getCamera()
camera.follow(drone, offset=[-5, -5, 3])
# Capture camera image
image = camera.capture()
image.save('screenshot.png')
Related Resources¶
Note: This document serves as the index page for the
uemodule. For detailed API descriptions of individual interfaces, please refer to their respective standalone documentation pages.