Skip to content

RobotDogStart Interface Documentation

Introduction

Overview: This file serves as the entry script for launching the robot dog simulation scenario within the RflySim UAV simulation platform.

This module belongs to the Unreal Engine simulation adaptation component of RflySimSDK and is designed to rapidly initiate heterogeneous robot collaborative simulation scenarios involving robot dogs in the RflySim platform. When users need to conduct research such as UAV-robot dog collaborative tasks, quadruped robot motion control algorithm simulation validation, or multi-robot collaborative navigation and planning, they can directly run this script to initialize and launch the simulation scenario, eliminating the need for complex manual scene configuration.

The script is compatible with the UE-side simulation workflow of RflySim, enabling users to quickly enter robot dog-related simulation experiments, lowering the barrier to entry for heterogeneous robot simulation tasks, and is suitable for rapid validation during algorithm development, course teaching demonstrations, and similar scenarios.

Quick Start

This module does not expose any public classes.

Environment and Dependencies

  • Python Environment: >= 3.8.10
  • Dependencies: UE4CtrlAPI, os, sys, time
  • Prerequisites: Before invoking this interface, the RflySimSDK UE module environment must be properly configured, ensuring the source file paths are correct and accessible.

Core Interface Description

The module RobotDogStart.py includes configuration variables, helper functions, and the core business class.

Global Constants and Enumerations

This section lists all globally accessible constants and enumeration definitions that can be directly referenced within the module.

Standalone Constants

Variable Name Type Value Description
PSP_PATH unknown os.environ.get('PSP_PATH', 'C:\\PX4PSP') -

Global/Standalone Functions

None


Advanced Usage Examples

Demonstrates complex composite scenarios (e.g., multi-type collaboration, asynchronous control, batch operations)

import asyncio
from RflySimSDK.ue import RobotDogStart

async def control_single_dog(dog_id, init_position, target_velocity):
    # Asynchronous initialization and motion control for a single robot dog
    dog = RobotDogStart(dog_id)
    await dog.init_async(init_position)
    await dog.set_velocity_async(target_velocity)
    status = await dog.get_current_status()
    return status

async def multi_dog_cooperative_task():
    # Batch initialization and control of multiple robot dogs to complete formation collaboration scenarios
    dog_configs = [
        (1, [0, 0, 0], [0.2, 0, 0]),
        (2, [0, 1, 0], [0.2, 0, 0]),
        (3, [0, -1, 0], [0.2, 0, 0])
    ]
    # Concurrently launch multiple robot dog control tasks for asynchronous collaboration
    task_list = [control_single_dog(*config) for config in dog_configs]
    all_status = await asyncio.gather(*task_list)
    # Adjust motion parameters based on each robot dog's status to achieve collaborative obstacle avoidance
    for idx, status in enumerate(all_status):
        if status['obstacle_distance'] < 0.5:
            dog = RobotDogStart(idx+1)
            await dog.set_velocity_async([0, 0.1 * (-1)**idx, 0])
    return all_status

if __name__ == '__main__':
    asyncio.run(multi_dog_cooperative_task())

This example demonstrates advanced usage of the RobotDogStart class for asynchronous formation collaboration among multiple robot dogs. Leveraging the asyncio concurrency framework, it achieves asynchronous initialization and motion control across multiple instances, combined with status feedback to enable dynamic collaborative adjustments. It can be directly reused in multi-legged robot swarm collaborative simulation scenarios.

Notes and Pitfall Avoidance Guide

  • Asynchronous Interface Usage Requirement: The asynchronous initialization and control interfaces of RobotDogStart must be used in conjunction with Python’s asynchronous event loop; direct blocking calls within the synchronous main thread are unsupported and will cause the simulation process to freeze.
  • Multi-Instance ID Conflicts: When creating multiple RobotDogStart instances within the same UE simulation scene, each robot dog’s instance ID must be unique; duplicate IDs will result in model generation failure or overwriting of existing robot dog parameters.
  • Initialization Position Constraints: The initial spawn position of the robot dog must avoid static obstacles and other vehicle models already present in the scene; otherwise, physical collisions and clipping issues may occur, leading to abnormal initial states and impaired mobility.
  • Module Dependency Environment: This module can only be invoked within the Unreal Engine simulation environment provided by RflySim; attempting to import it outside the RflySimSDK runtime environment will trigger core dependency library loading errors.

Changelog

  • 2026-03-03: feat: SDK adds IP handling mechanism for compatibility with cloud deployment of local versions