fix:新增例程
This commit is contained in:
BIN
基础使用/e5.RflySim3D载具样式切换实验/Readme.docx
Normal file
BIN
基础使用/e5.RflySim3D载具样式切换实验/Readme.docx
Normal file
Binary file not shown.
BIN
基础使用/e5.RflySim3D载具样式切换实验/Readme.pdf
Normal file
BIN
基础使用/e5.RflySim3D载具样式切换实验/Readme.pdf
Normal file
Binary file not shown.
6
基础使用/e5.RflySim3D载具样式切换实验/code/Grasslands.txt
Normal file
6
基础使用/e5.RflySim3D载具样式切换实验/code/Grasslands.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
2022.09.14-19.44.54, Unit:m or rad, Frame: NED, MapName:3DDisplay
|
||||
CMD:CreateVehicle|Rfly***, copterID, vehicleType, PosE[0], PosE[1], PosE[2], AngEuler[0], AngEuler[1], AngEuler[2]
|
||||
CreateVehicle, 1000, 3, 0.66, -0.11, -8.15, 0.00, 0.00, -0.09
|
||||
CreateVehicle, 1001, 30, 1.88, -0.60, -8.23, 0.00, 0.00, -0.24
|
||||
CreateVehicle, 1002, 50, 3.56, 1.65, -8.12, 0.00, 0.00, 0.10
|
||||
RflyMoveVehiclePosAng 1000 1 0.00 2.00 0.00 0.00 0.00
|
||||
21
基础使用/e5.RflySim3D载具样式切换实验/code/LoadModelsByTxt.bat
Normal file
21
基础使用/e5.RflySim3D载具样式切换实验/code/LoadModelsByTxt.bat
Normal file
@@ -0,0 +1,21 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Run script as administrator
|
||||
REM %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
|
||||
|
||||
REM Set the path of the RflySim tools
|
||||
if not defined PSP_PATH (
|
||||
SET PSP_PATH=C:\PX4PSP
|
||||
SET PSP_PATH_LINUX=/mnt/c/PX4PSP
|
||||
)
|
||||
|
||||
REM UE4Path
|
||||
cd /d %PSP_PATH%\RflySim3D
|
||||
tasklist|find /i "RflySim3D.exe" || start %PSP_PATH%\Rflysim3D\RflySim3D.exe
|
||||
|
||||
if not defined PSP_PATH (
|
||||
SET PSP_PATH=D:\PX4PSP
|
||||
SET PSP_PATH_LINUX=/mnt/d/PX4PSP
|
||||
)
|
||||
cd /d %PSP_PATH%
|
||||
cmd.exe /k "echo Python3.8 environment has been set with openCV+pymavlink+numpy+pyulog etc. && echo You can use pip or pip3 command to install other libraries && echo Put your python scripts 'XXX.py' into the folder '%PSP_PATH%\RflySimAPIs\Python38Scripts' && echo Use the command: 'python XXX.py' to run the script with Python && echo For example, try entering 'python ImgCVShow.py' below to use OpenCV to read and show a image && echo You can also use pyulog (see https://github.com/PX4/pyulog) to convert PX4 log file && echo For example, try entering 'ulog2csv log.ulg' to convert ulg file to excel files for MATLAB && cd /d %PSP_PATH%\RflySimAPIs\Python38Scripts && SET PATH=%PSP_PATH%\Python38;%PSP_PATH%\Python38\Scripts;%PATH%"
|
||||
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