fix:新增例程
This commit is contained in:
21
基础使用/e5.RflySim3D载具样式切换实验/code/LoadModelsByTxt.py
Normal file
21
基础使用/e5.RflySim3D载具样式切换实验/code/LoadModelsByTxt.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import time
|
||||
import math
|
||||
import sys
|
||||
import os
|
||||
import UE4CtrlAPI as UE4CtrlAPI
|
||||
#Create a new MAVLink communication instance, UDP sending port (CopterSim’s receving port) is 20100
|
||||
ue = UE4CtrlAPI.UE4CtrlAPI()
|
||||
# sendUE4Cmd: RflySim3D API to modify scene display style
|
||||
# Format: ue.sendUE4Cmd(cmd,windowID=-1), where cmd is a command string, windowID is the received window number (assuming multiple RflySim3D windows are opened at the same time), windowID =-1 means sent to all windows
|
||||
# Augument: RflyChangeMapbyName command means to switch the map (scene), the following string is the map name, here will switch all open windows to the grass map
|
||||
ue.sendUE4Cmd('RflyChangeMapbyName Grasslands')
|
||||
|
||||
|
||||
time.sleep(2)
|
||||
imPath = os.path.join(sys.path[0],'Grasslands.txt')
|
||||
# 此处使用RflyLoad3DFile命令来加载txt格式场景创建文件
|
||||
str = 'RflyLoad3DFile ' + imPath
|
||||
print(str)
|
||||
ue.sendUE4Cmd(str.encode())
|
||||
print(str.encode())
|
||||
|
||||
Reference in New Issue
Block a user