fix:新增例程
This commit is contained in:
16
基础智能/e3.集群轨迹灯光展示实验/NightCitySwarm4.bat
Normal file
16
基础智能/e3.集群轨迹灯光展示实验/NightCitySwarm4.bat
Normal file
@@ -0,0 +1,16 @@
|
||||
@ECHO OFF
|
||||
|
||||
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 kill all applications when press a key
|
||||
tasklist|find /i "CopterSim.exe" && taskkill /im "CopterSim.exe"
|
||||
tasklist|find /i "QGroundControl.exe" && taskkill /f /im "QGroundControl.exe"
|
||||
tasklist|find /i "RflySim3D.exe" && taskkill /f /im "RflySim3D.exe"
|
||||
|
||||
REM UE4Path
|
||||
cd /d %PSP_PATH%\RflySim3D
|
||||
start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||
51
基础智能/e3.集群轨迹灯光展示实验/NightCitySwarm4.py
Normal file
51
基础智能/e3.集群轨迹灯光展示实验/NightCitySwarm4.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import time
|
||||
import os
|
||||
import math
|
||||
|
||||
import sys
|
||||
import PX4MavCtrlV4 as PX4MavCtrl
|
||||
import UE4CtrlAPI
|
||||
ue = UE4CtrlAPI.UE4CtrlAPI()
|
||||
|
||||
# Create a MAVLink communication instance with UDP
|
||||
# port 20100 (coresponding to the port on CopterSim)
|
||||
mav = PX4MavCtrl.PX4MavCtrler(1)
|
||||
time.sleep(1)
|
||||
|
||||
# Switch to a night scene
|
||||
#ue.sendUE4Cmd('RflyChangeMapbyName ModernCityNight')
|
||||
ue.sendUE4Cmd('RflyChangeMapbyName LightShow')
|
||||
time.sleep(4)
|
||||
|
||||
# send 100 vehicles to RflySim3D to form a helix
|
||||
z0 = -50
|
||||
x0 = 50
|
||||
y0 = 40
|
||||
for i in range(100):
|
||||
s = 1 + i/5.0
|
||||
th = math.pi/3 + math.pi/10*i
|
||||
y = s*math.cos(th)
|
||||
z = -s*math.sin(th)
|
||||
ue.sendUE4Pos(i+1,3,0,[x0,y+y0,z0+z],[0,0,0])
|
||||
|
||||
# Switch viewpoint target vehicle to vehicle 1
|
||||
ue.sendUE4Cmd('RflyChangeViewKeyCmd B 1')
|
||||
time.sleep(0.5)
|
||||
|
||||
# Switch to the N2 ground observation viewpoint for target vehicle
|
||||
ue.sendUE4Cmd('RflyChangeViewKeyCmd N 2')
|
||||
time.sleep(0.5)
|
||||
|
||||
# Set the observation position and angle, 1.7m above the ground, with 30 degree pitch
|
||||
ue.sendUE4Cmd('RflyCameraPosAng -10 40 -1.7 0 30 0')
|
||||
time.sleep(2)
|
||||
|
||||
idx=1
|
||||
while True:
|
||||
for i in range(100):
|
||||
str0 = "RflyChange3DModel "+str(i+1)+" -1"
|
||||
#print(str0)
|
||||
ue.sendUE4Cmd(str0.encode())
|
||||
time.sleep(0.05)
|
||||
|
||||
sys.exit()
|
||||
5
基础智能/e3.集群轨迹灯光展示实验/Python38Run.bat
Normal file
5
基础智能/e3.集群轨迹灯光展示实验/Python38Run.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
if not defined PSP_PATH (
|
||||
SET PSP_PATH=C:\PX4PSP
|
||||
SET PSP_PATH_LINUX=/mnt/c/PX4PSP
|
||||
)
|
||||
start 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 Python38Run.bat into your code folder && echo Use the command: 'python XXX.py' to run the script with Python && SET PATH=%PSP_PATH%\Python38;%PSP_PATH%\Python38\Scripts;%CD%;%PATH%"
|
||||
BIN
基础智能/e3.集群轨迹灯光展示实验/Readme.pdf
Normal file
BIN
基础智能/e3.集群轨迹灯光展示实验/Readme.pdf
Normal file
Binary file not shown.
0
基础智能/e3.集群轨迹灯光展示实验/名称-集群轨迹灯光展示实验.txt
Normal file
0
基础智能/e3.集群轨迹灯光展示实验/名称-集群轨迹灯光展示实验.txt
Normal file
Reference in New Issue
Block a user