fix:新增例程
This commit is contained in:
37
人工智能/e3.双目视觉人脸识别实验/Config.json
Normal file
37
人工智能/e3.双目视觉人脸识别实验/Config.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"VisionSensors":[
|
||||||
|
{
|
||||||
|
"SeqID":0, //视觉传感器序号0 1 2 3 ...排序。如果填0,则自动递增排序。
|
||||||
|
"TypeID":1, //视觉传感器类型,1:RGB,2:深度,3:灰度,4:分割,5:测距,7:深度转点云,20-23:激光雷达,40-41:热力红外(收费版)
|
||||||
|
"TargetCopter":1, //传感器绑定的CopterID号,注:免费版只支持绑定1号飞机
|
||||||
|
"TargetMountType":0, //绑定方式,0:固定飞机几何中心, 1:固定飞机底部中心,2:固定地面上,3:弱固定飞机上姿态不随动,4:绑定其他视觉传感器上
|
||||||
|
"DataWidth":640, //图像像素长度
|
||||||
|
"DataHeight":480,//图像像素宽度
|
||||||
|
"DataCheckFreq":30,//图像检查更新频率,如果发现UE渲染更新了(取决于UE刷新帧率),会立刻发出数据。UE刷新率+DataCheckFreq检查频率,共同决定图像延迟。
|
||||||
|
"SendProtocol":[1,0,0,0,0,0,0,0],// SendProtocol[0],表示传输协议,0:共享内存(仅限Windows下获取图像),1:UDP网络传输模式(图片使用jpeg压缩,点云直传),2:UDP直传图片不压缩,3:UDP直传图片png压缩。注:0-1适用所有传感器,2-3选项仅限图像类传感器。
|
||||||
|
//SendProtocol[1-4]位对应,IP地址位,表示请求返回的IP地址。默认都填0(或127.0.0.1),会自动请求UE返回图像到本电脑;SendProtocol[5]端口位,指定传感器图像回传端口,需要为每个传感器设置不同端口。默认填0,会自动使用9999+SeqID的递增端口号。
|
||||||
|
"CameraFOV":90, //视觉传感器的FOV视场角,和焦距呈现一定数值关系,能间接修改焦距。
|
||||||
|
"EularOrQuat":0, //使用欧拉角SensorAngEular还是四元数SensorAngQuat来设置视觉传感器姿态,默认使用0欧拉角。
|
||||||
|
"SensorPosXYZ":[0.3,-0.15,0], //视觉传感器的安装位置,和TargetMountType对应偏移中心,单位米
|
||||||
|
"SensorAngQuat":[0,0,0,0], // 视觉传感器的安装姿态,用四元数方式表示
|
||||||
|
"SensorAngEular":[0,0,0],// 视觉传感器的安装姿态,用欧拉角方式表示,单位角度制
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] //其他参数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SeqID":0, //自动确认序号,这里会自动识别为1
|
||||||
|
"TypeID":1,
|
||||||
|
"TargetCopter":1,
|
||||||
|
"TargetMountType":0,
|
||||||
|
"DataWidth":640,
|
||||||
|
"DataHeight":480,
|
||||||
|
"DataCheckFreq":30,
|
||||||
|
"EularOrQuat":0,
|
||||||
|
"SendProtocol":[1,0,0,0,0,0,0,0], //自动确定IP和端口号
|
||||||
|
"CameraFOV":90,
|
||||||
|
"SensorPosXYZ":[0.3,0.15,0],
|
||||||
|
"SensorAngQuat":[0,0,0,0],
|
||||||
|
"SensorAngEular":[0,0,0],
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
102
人工智能/e3.双目视觉人脸识别实验/ManDetect3.py
Normal file
102
人工智能/e3.双目视觉人脸识别实验/ManDetect3.py
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# import required libraries
|
||||||
|
import cv2
|
||||||
|
import time
|
||||||
|
import math
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
|
||||||
|
# import RflySim APIs
|
||||||
|
import PX4MavCtrlV4 as PX4MavCtrl
|
||||||
|
|
||||||
|
import VisionCaptureApi
|
||||||
|
import UE4CtrlAPI
|
||||||
|
ue = UE4CtrlAPI.UE4CtrlAPI()
|
||||||
|
|
||||||
|
vis = VisionCaptureApi.VisionCaptureApi()
|
||||||
|
|
||||||
|
# VisionCaptureApi 中的配置函数
|
||||||
|
vis.jsonLoad() # 加载Config.json中的传感器配置文件
|
||||||
|
|
||||||
|
isSuss = vis.sendReqToUE4() # 向RflySim3D发送取图请求,并验证
|
||||||
|
if not isSuss: # 如果请求取图失败,则退出
|
||||||
|
sys.exit(0)
|
||||||
|
vis.startImgCap(True) # 开启取图,并启用共享内存图像转发,转发到填写的目录
|
||||||
|
|
||||||
|
# Send command to UE4 Window 1 to change resolution
|
||||||
|
ue.sendUE4Cmd('r.setres 720x405w',0) # 设置UE4窗口分辨率,注意本窗口仅限于显示,取图分辨率在json中配置,本窗口设置越小,资源需求越少。
|
||||||
|
ue.sendUE4Cmd('t.MaxFPS 30',0) # 设置UE4最大刷新频率,同时也是取图频率
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# Create MAVLink control API instance
|
||||||
|
mav = PX4MavCtrl.PX4MavCtrler(1)
|
||||||
|
# Init MAVLink data receiving loop
|
||||||
|
mav.InitMavLoop()
|
||||||
|
|
||||||
|
|
||||||
|
# send vehicle position command to create a man, with copterID=100
|
||||||
|
# the man is located before the drone, and rotated to 180 degree (face the drone)
|
||||||
|
ue.sendUE4Pos(100,30,0,[1,0,-8.086],[0,0,math.pi])
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# send command to change object with copterID=100 (the man just created) to a walking style
|
||||||
|
ue.sendUE4Cmd('RflyChange3DModel 100 16')
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# send command to the first RflySim3D window, to switch to vehicle 1
|
||||||
|
ue.sendUE4Cmd('RflyChangeViewKeyCmd B 1',0)
|
||||||
|
|
||||||
|
print("5s, Arm the drone")
|
||||||
|
mav.initOffboard()
|
||||||
|
time.sleep(0.5)
|
||||||
|
mav.SendMavArm(True) # Arm the drone
|
||||||
|
print("Arm the drone!, and fly to NED 0,0,-5")
|
||||||
|
time.sleep(0.5)
|
||||||
|
mav.SendPosNED(0, 0, -1.7, 0) # Fly to target position 0,0,-1.5
|
||||||
|
|
||||||
|
# Process the image in the following timer
|
||||||
|
startTime = time.time()
|
||||||
|
lastTime = time.time()
|
||||||
|
timeInterval = 1/30.0 # time interval of the timer
|
||||||
|
face_cascade=cv2.CascadeClassifier(sys.path[0]+'\cascades\haarcascade_frontalface_default.xml')
|
||||||
|
|
||||||
|
num=0
|
||||||
|
lastClock=time.time()
|
||||||
|
while True:
|
||||||
|
#gImgList = sca.getCVImgList(ImgInfoList)
|
||||||
|
#img1=sca.getCVImg(ImgInfo1)
|
||||||
|
# Get the first camera view and change to gray
|
||||||
|
|
||||||
|
if vis.hasData[0]:
|
||||||
|
pic1=cv2.cvtColor(vis.Img[0], cv2.COLOR_BGR2GRAY)
|
||||||
|
faces1=face_cascade.detectMultiScale(pic1,1.3,5) # face recognition for the first camera
|
||||||
|
for (x,y,w,h) in faces1:
|
||||||
|
pic1=cv2.rectangle(pic1,(x,y),(x+w,y+h),(255,0,0),1) # Draw a rectangle to mark the face
|
||||||
|
cv2.imshow("pic1",pic1) # Show the processed image
|
||||||
|
|
||||||
|
if vis.hasData[1]:
|
||||||
|
#img2=sca.getCVImg(ImgInfo2)
|
||||||
|
# Get the second camera view and change to gray
|
||||||
|
pic2=cv2.cvtColor(vis.Img[1], cv2.COLOR_BGR2GRAY)
|
||||||
|
faces2=face_cascade.detectMultiScale(pic2,1.3,5) # face recognition for the second camera
|
||||||
|
for (x,y,w,h) in faces2:
|
||||||
|
pic2=cv2.rectangle(pic2,(x,y),(x+w,y+h),(255,0,0),1)
|
||||||
|
cv2.imshow("pic2",pic2)
|
||||||
|
|
||||||
|
|
||||||
|
# add target tracking algorithm here with mav.SendVelNED or SendVelFRD API
|
||||||
|
|
||||||
|
cv2.waitKey(1)
|
||||||
|
|
||||||
|
num=num+1
|
||||||
|
if num%100==0:
|
||||||
|
tiem=time.time()
|
||||||
|
print('MainThreadFPS: '+str(100/(tiem-lastClock)))
|
||||||
|
lastClock=tiem
|
||||||
|
|
||||||
|
# The above code will be executed 30Hz (0.033333s)
|
||||||
|
lastTime = lastTime + timeInterval
|
||||||
|
sleepTime = lastTime - time.time()
|
||||||
|
if sleepTime > 0:
|
||||||
|
time.sleep(sleepTime)
|
||||||
|
else:
|
||||||
|
lastTime = time.time()
|
||||||
177
人工智能/e3.双目视觉人脸识别实验/ManDetect3HITL.bat
Normal file
177
人工智能/e3.双目视觉人脸识别实验/ManDetect3HITL.bat
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Run script as administrator
|
||||||
|
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~s0"" ::","","runas",1)(window.close)&&exit
|
||||||
|
|
||||||
|
|
||||||
|
REM The text start with 'REM' is annotation, the following options are corresponding to Options on CopterSim
|
||||||
|
|
||||||
|
REM Start index of vehicle number (should larger than 0)
|
||||||
|
REM This option is useful for simulation with multi-computers
|
||||||
|
SET /a START_INDEX=1
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the vehicleType/ClassID of vehicle 3D display in RflySim3D
|
||||||
|
SET /a CLASS_3D_ID=-1
|
||||||
|
|
||||||
|
REM Set use DLL model name or not, use number index or name string
|
||||||
|
REM This option is useful for simulation with other types of vehicles instead of multicopters
|
||||||
|
set DLLModel=0
|
||||||
|
|
||||||
|
REM Set the simulation mode on CopterSim, use number index or name string
|
||||||
|
REM e.g., 0:PX4_HITL, 1:PX4_SITL, 2:PX4_SITL_RFLY, 3:"Simulink&DLL_SIL", 4:PX4_HITL_NET, 5:EXT_HITL_COM, 6:EXT_SIM_NET
|
||||||
|
set SimMode=0
|
||||||
|
|
||||||
|
REM SET the baudrate for Pixhawk COM
|
||||||
|
SET /a BaudRate=921600
|
||||||
|
|
||||||
|
REM Set the map, use index or name of the map on CopterSim
|
||||||
|
REM e.g., UE4_MAP=1 equals to UE4_MAP=Grasslands
|
||||||
|
SET UE4_MAP=Grasslands
|
||||||
|
|
||||||
|
REM Set the origin x,y position (m) and yaw angle (degree) at the map
|
||||||
|
SET /a ORIGIN_POS_X=0
|
||||||
|
SET /a ORIGIN_POS_Y=0
|
||||||
|
SET /a ORIGIN_YAW=0
|
||||||
|
|
||||||
|
REM Set the interval between two vehicle, unit:m
|
||||||
|
SET /a VEHICLE_INTERVAL=2
|
||||||
|
|
||||||
|
|
||||||
|
REM Set broadcast to other computer; 0: only this computer, 1: broadcast; or use IP address to increase speed
|
||||||
|
REM e.g., IS_BROADCAST=0 equals to IS_BROADCAST=127.0.0.1, IS_BROADCAST=1 equals to IS_BROADCAST=255.255.255.255
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
|
||||||
|
REM Set UDP data mode; 0: UDP_FULL, 1:UDP_Simple, 2: Mavlink_Full, 3: Mavlink_simple. input number or string
|
||||||
|
REM 4:Mavlink_NoSend, 5:Mavlink_NoGPS, 6:Mavlink_Vision (NoGPS and set PX4 EKF)
|
||||||
|
SET UDPSIMMODE=2
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
REM Get the Com port number
|
||||||
|
for /f "delims=" %%t in ('%PSP_PATH%\CopterSim\GetComList.exe 3 %BaudRate%') do set ComInfoStr=%%t
|
||||||
|
|
||||||
|
for /f "tokens=1,2,3 delims=#" %%a in ("%ComInfoStr%") do (
|
||||||
|
set ComNumExe=%%a
|
||||||
|
set ComNameList=%%b
|
||||||
|
set ComInfoList=%%c
|
||||||
|
)
|
||||||
|
echo Please input the Pixhawk COM port list for HIL
|
||||||
|
echo Use ',' as the separator if more than one Pixhawk
|
||||||
|
echo E.g., input 3 for COM3 of Pixhawk on the computer
|
||||||
|
echo Input 3,6,7 for COM3, COM6 and COM7 of Pixhawks
|
||||||
|
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
set remain=%ComInfoList%
|
||||||
|
echo All COM ports on this computer are:
|
||||||
|
echo.
|
||||||
|
:loopInfo
|
||||||
|
for /f "tokens=1* delims=;" %%a in ("%remain%") do (
|
||||||
|
echo %%a
|
||||||
|
set remain=%%b
|
||||||
|
)
|
||||||
|
if defined remain goto :loopInfo
|
||||||
|
echo.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
|
||||||
|
if %ComNumExe% EQU 0 (
|
||||||
|
echo Warning: there is no available COM port
|
||||||
|
) else (
|
||||||
|
echo Recommended COM list input is: %ComNameList%
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
SET /P ComNum=My COM list for HITL simulation is:
|
||||||
|
SET string=%ComNum%
|
||||||
|
set subStr = ""
|
||||||
|
set /a VehicleNum=0
|
||||||
|
:split
|
||||||
|
for /f "tokens=1,* delims=," %%i in ("%string%") do (
|
||||||
|
set subStr=%%i
|
||||||
|
set string=%%j
|
||||||
|
)
|
||||||
|
set /a eValue=subStr
|
||||||
|
if not %eValue% EQU %subStr% (
|
||||||
|
echo Error: Input '%subStr%' is not a integer!
|
||||||
|
goto EOF
|
||||||
|
)
|
||||||
|
set /a VehicleNum = VehicleNum +1
|
||||||
|
if not "%string%"=="" goto split
|
||||||
|
REM cho total com number is %VehicleNum%
|
||||||
|
|
||||||
|
SET /A VehicleTotalNum=%VehicleNum% + %START_INDEX% - 1
|
||||||
|
if not defined TOTOAL_COPTER (
|
||||||
|
SET /A TOTOAL_COPTER=%VehicleTotalNum%
|
||||||
|
)
|
||||||
|
|
||||||
|
set /a sqrtNum=1
|
||||||
|
set /a squareNum=1
|
||||||
|
:loopSqrt
|
||||||
|
set /a squareNum=%sqrtNum% * %sqrtNum%
|
||||||
|
if %squareNum% EQU %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
if %squareNum% GTR %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
set /a sqrtNum=%sqrtNum%+1
|
||||||
|
goto loopSqrt
|
||||||
|
:loopSqrtEnd
|
||||||
|
|
||||||
|
|
||||||
|
REM UE4Path
|
||||||
|
cd /d %PSP_PATH%\RflySim3D
|
||||||
|
tasklist|find /i "RflySim3D.exe" || start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
choice /t 5 /d y /n >nul
|
||||||
|
|
||||||
|
|
||||||
|
tasklist|find /i "CopterSim.exe" && taskkill /im "CopterSim.exe"
|
||||||
|
ECHO Kill all CopterSims
|
||||||
|
|
||||||
|
|
||||||
|
REM CptSmPath
|
||||||
|
cd /d %PSP_PATH%\CopterSim
|
||||||
|
|
||||||
|
set /a cntr = %START_INDEX%
|
||||||
|
set /a endNum = %VehicleTotalNum% +1
|
||||||
|
|
||||||
|
SET string=%ComNum%
|
||||||
|
:split1
|
||||||
|
for /f "tokens=1,* delims=," %%i in ("%string%") do (
|
||||||
|
set subStr=%%i
|
||||||
|
set string=%%j
|
||||||
|
)
|
||||||
|
set /a PosXX=((%cntr%-1) / %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_X%
|
||||||
|
set /a PosYY=((%cntr%-1) %% %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_Y%
|
||||||
|
REM echo start CopterSim
|
||||||
|
start /realtime CopterSim.exe 1 %cntr% %CLASS_3D_ID% %DLLModel% %SimMode% %UE4_MAP% %IS_BROADCAST% %PosXX% %PosYY% %ORIGIN_YAW% %subStr%:%BaudRate% %UDPSIMMODE%
|
||||||
|
choice /t 2 /d y /n >nul
|
||||||
|
set /a cntr=%cntr%+1
|
||||||
|
|
||||||
|
REM TIMEOUT /T 1
|
||||||
|
if not "%string%"=="" goto split1
|
||||||
|
|
||||||
|
REM QGCPath
|
||||||
|
tasklist|find /i "QGroundControl.exe" || start %PSP_PATH%\QGroundControl\QGroundControl.exe -noComPix
|
||||||
|
ECHO Start QGroundControl
|
||||||
|
|
||||||
|
pause
|
||||||
|
|
||||||
|
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"
|
||||||
|
tasklist|find /i "python.exe" && taskkill /f /im "python.exe"
|
||||||
|
tasklist|find /i "cmd.exe" && taskkill /f /im "cmd.exe"
|
||||||
|
|
||||||
|
ECHO Start End.
|
||||||
162
人工智能/e3.双目视觉人脸识别实验/ManDetect3SITL.bat
Normal file
162
人工智能/e3.双目视觉人脸识别实验/ManDetect3SITL.bat
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Run script as administrator
|
||||||
|
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~s0"" ::","","runas",1)(window.close)&&exit
|
||||||
|
|
||||||
|
|
||||||
|
REM The text start with 'REM' is annotation, the following options are corresponding to Options on CopterSim
|
||||||
|
|
||||||
|
REM Start index of vehicle number (should larger than 0)
|
||||||
|
REM This option is useful for simulation with multi-computers
|
||||||
|
SET /a START_INDEX=1
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the vehicleType/ClassID of vehicle 3D display in RflySim3D
|
||||||
|
SET /a CLASS_3D_ID=-1
|
||||||
|
|
||||||
|
REM Set use DLL model name or not, use number index or name string
|
||||||
|
REM This option is useful for simulation with other types of vehicles instead of multicopters
|
||||||
|
set DLLModel=0
|
||||||
|
|
||||||
|
REM Set the simulation mode on CopterSim, use number index or name string
|
||||||
|
REM e.g., SimMode=2 equals to SimMode=PX4_SITL_RFLY
|
||||||
|
set SimMode=2
|
||||||
|
|
||||||
|
REM Set the vehicle-model (airframe) of PX4 SITL simulation, the default airframe is a quadcopter: iris
|
||||||
|
REM Check folder Firmware\ROMFS\px4fmu_common\init.d-posix for supported airframes (Note: You can also create your airframe file here)
|
||||||
|
REM E.g., fixed-wing aircraft: PX4SitlFrame=plane; small cars: PX4SitlFrame=rover
|
||||||
|
set PX4SitlFrame=iris
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the map, use index or name of the map on CopterSim
|
||||||
|
REM e.g., UE4_MAP=1 equals to UE4_MAP=Grasslands
|
||||||
|
SET UE4_MAP=Grasslands
|
||||||
|
|
||||||
|
REM Set the origin x,y position (m) and yaw angle (degree) at the map
|
||||||
|
SET /a ORIGIN_POS_X=0
|
||||||
|
SET /a ORIGIN_POS_Y=0
|
||||||
|
SET /a ORIGIN_YAW=0
|
||||||
|
|
||||||
|
REM Set the interval between two vehicle, unit:m
|
||||||
|
SET /a VEHICLE_INTERVAL=2
|
||||||
|
|
||||||
|
|
||||||
|
REM Set broadcast to other computer; 0: only this computer, 1: broadcast; or use IP address to increase speed
|
||||||
|
REM e.g., IS_BROADCAST=0 equals to IS_BROADCAST=127.0.0.1, IS_BROADCAST=1 equals to IS_BROADCAST=255.255.255.255
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
|
||||||
|
REM Set UDP data mode; 0: UDP_FULL, 1:UDP_Simple, 2: Mavlink_Full, 3: Mavlink_simple. input number or string
|
||||||
|
REM 4:Mavlink_NoSend, 5:Mavlink_NoGPS, 6:Mavlink_Vision (NoGPS and set PX4 EKF)
|
||||||
|
SET UDPSIMMODE=2
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
:Top
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
REM Max vehicle number 50
|
||||||
|
SET /a MAX_VEHICLE=50
|
||||||
|
REM SET /P VehicleNum=Please input UAV swarm number:
|
||||||
|
SET /A VehicleNum=1
|
||||||
|
SET /A Evaluated=VehicleNum
|
||||||
|
if %Evaluated% EQU %VehicleNum% (
|
||||||
|
IF %VehicleNum% GTR 0 (
|
||||||
|
IF %VehicleNum% GTR %MAX_VEHICLE% (
|
||||||
|
ECHO The vehicle number is too large, which may cause a crash
|
||||||
|
pause
|
||||||
|
)
|
||||||
|
GOTO StartSim
|
||||||
|
)
|
||||||
|
ECHO Not a positive integer
|
||||||
|
GOTO Top
|
||||||
|
) ELSE (
|
||||||
|
ECHO Not a integer
|
||||||
|
GOTO Top
|
||||||
|
)
|
||||||
|
:StartSim
|
||||||
|
|
||||||
|
SET /A VehicleTotalNum=%VehicleNum% + %START_INDEX% - 1
|
||||||
|
if not defined TOTOAL_COPTER (
|
||||||
|
SET /A TOTOAL_COPTER=%VehicleTotalNum%
|
||||||
|
)
|
||||||
|
|
||||||
|
set /a sqrtNum=1
|
||||||
|
set /a squareNum=1
|
||||||
|
:loopSqrt
|
||||||
|
set /a squareNum=%sqrtNum% * %sqrtNum%
|
||||||
|
if %squareNum% EQU %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
if %squareNum% GTR %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
set /a sqrtNum=%sqrtNum%+1
|
||||||
|
goto loopSqrt
|
||||||
|
:loopSqrtEnd
|
||||||
|
|
||||||
|
|
||||||
|
REM QGCPath
|
||||||
|
tasklist|find /i "QGroundControl.exe" || start %PSP_PATH%\QGroundControl\QGroundControl.exe -noComPix
|
||||||
|
ECHO Start QGroundControl
|
||||||
|
|
||||||
|
REM UE4Path
|
||||||
|
cd /d %PSP_PATH%\RflySim3D
|
||||||
|
tasklist|find /i "RflySim3D.exe" || start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
choice /t 5 /d y /n >nul
|
||||||
|
|
||||||
|
|
||||||
|
tasklist|find /i "CopterSim.exe" && taskkill /im "CopterSim.exe"
|
||||||
|
ECHO Kill all CopterSims
|
||||||
|
|
||||||
|
|
||||||
|
REM CptSmPath
|
||||||
|
cd /d %PSP_PATH%\CopterSim
|
||||||
|
|
||||||
|
|
||||||
|
set /a cntr=%START_INDEX%
|
||||||
|
set /a endNum=%VehicleTotalNum%+1
|
||||||
|
|
||||||
|
:loopBegin
|
||||||
|
set /a PosXX=((%cntr%-1) / %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_X%
|
||||||
|
set /a PosYY=((%cntr%-1) %% %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_Y%
|
||||||
|
start /realtime CopterSim.exe 1 %cntr% %CLASS_3D_ID% %DLLModel% %SimMode% %UE4_MAP% %IS_BROADCAST% %PosXX% %PosYY% %ORIGIN_YAW% 1 %UDPSIMMODE%
|
||||||
|
choice /t 1 /d y /n >nul
|
||||||
|
set /a cntr=%cntr%+1
|
||||||
|
|
||||||
|
if %cntr% EQU %endNum% goto loopEnd
|
||||||
|
goto loopBegin
|
||||||
|
:loopEnd
|
||||||
|
|
||||||
|
REM Set ToolChainType 1:Win10WSL 3:Cygwin
|
||||||
|
SET /a ToolChainType=1
|
||||||
|
|
||||||
|
if "%IS_BROADCAST%" == "0" (
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
) else (
|
||||||
|
SET IS_BROADCAST=1
|
||||||
|
)
|
||||||
|
|
||||||
|
SET WINDOWSPATH=%PATH%
|
||||||
|
if %ToolChainType% EQU 1 (
|
||||||
|
wsl -d RflySim-20.04 echo Starting PX4 Build; cd %PSP_PATH_LINUX%/Firmware; ./BkFile/EnvOri.sh; export PATH=$HOME/ninja:$HOME/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH;make px4_sitl_default; ./Tools/sitl_multiple_run_rfly.sh %VehicleNum% %START_INDEX% %PX4SitlFrame%;echo Press any key to exit; read -n 1
|
||||||
|
) else (
|
||||||
|
REM CYGPath
|
||||||
|
cd /d %PSP_PATH%\CygwinToolchain
|
||||||
|
CALL setPX4Env.bat
|
||||||
|
bash -l -i -c 'echo Starting SITL SIMULATION; cd %PSP_PATH_LINUX%/Firmware; ./BkFile/EnvOri.sh; pwd; make px4_sitl_default; ./Tools/sitl_multiple_run_rfly.sh %VehicleNum% %START_INDEX% %PX4SitlFrame%;echo Press any key to exit; read -n 1; pkill -x px4 || true;'
|
||||||
|
)
|
||||||
|
SET PATH=%WINDOWSPATH%
|
||||||
|
|
||||||
|
|
||||||
|
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"
|
||||||
|
tasklist|find /i "python.exe" && taskkill /f /im "python.exe"
|
||||||
|
tasklist|find /i "cmd.exe" && taskkill /f /im "cmd.exe"
|
||||||
|
|
||||||
|
ECHO Start End.
|
||||||
68
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/Config.json
Normal file
68
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/Config.json
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"VisionSensors":[
|
||||||
|
{
|
||||||
|
"SeqID":0,
|
||||||
|
"TypeID":1,
|
||||||
|
"TargetCopter":1,
|
||||||
|
"TargetMountType":0,
|
||||||
|
"DataWidth":640,
|
||||||
|
"DataHeight":480,
|
||||||
|
"DataCheckFreq":30,
|
||||||
|
"SendProtocol":[0,127,0,0,1,9999,0,0],
|
||||||
|
"CameraFOV":90,
|
||||||
|
"EularOrQuat":0,
|
||||||
|
"SensorPosXYZ":[0.3,-0.15,0],
|
||||||
|
"SensorAngQuat":[0,0,0,0],
|
||||||
|
"SensorAngEular":[0,0,0],
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SeqID":1,
|
||||||
|
"TypeID":1,
|
||||||
|
"TargetCopter":1,
|
||||||
|
"TargetMountType":0,
|
||||||
|
"DataWidth":640,
|
||||||
|
"DataHeight":480,
|
||||||
|
"DataCheckFreq":30,
|
||||||
|
"SendProtocol":[0,127,0,0,1,10000,0,0],
|
||||||
|
"CameraFOV":90,
|
||||||
|
"EularOrQuat":0,
|
||||||
|
"SensorPosXYZ":[0.3,0.15,0],
|
||||||
|
"SensorAngQuat":[0,0,0,0],
|
||||||
|
"SensorAngEular":[0,0,0],
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SeqID":2,
|
||||||
|
"TypeID":1,
|
||||||
|
"TargetCopter":2,
|
||||||
|
"TargetMountType":0,
|
||||||
|
"DataWidth":640,
|
||||||
|
"DataHeight":480,
|
||||||
|
"DataCheckFreq":30,
|
||||||
|
"SendProtocol":[0,127,0,0,1,10001,0,0],
|
||||||
|
"CameraFOV":90,
|
||||||
|
"EularOrQuat":0,
|
||||||
|
"SensorPosXYZ":[0.3,-0.15,0],
|
||||||
|
"SensorAngQuat":[0,0,0,0],
|
||||||
|
"SensorAngEular":[0,0,0],
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SeqID":3,
|
||||||
|
"TypeID":1,
|
||||||
|
"TargetCopter":2,
|
||||||
|
"TargetMountType":0,
|
||||||
|
"DataWidth":640,
|
||||||
|
"DataHeight":480,
|
||||||
|
"DataCheckFreq":30,
|
||||||
|
"SendProtocol":[0,127,0,0,1,10002,0,0],
|
||||||
|
"CameraFOV":90,
|
||||||
|
"EularOrQuat":0,
|
||||||
|
"SensorPosXYZ":[0.3,0.15,0],
|
||||||
|
"SensorAngQuat":[0,0,0,0],
|
||||||
|
"SensorAngEular":[0,0,0],
|
||||||
|
"otherParams":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
104
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemo.py
Normal file
104
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemo.py
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# import required libraries
|
||||||
|
import cv2
|
||||||
|
import time
|
||||||
|
import math
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# import RflySim APIs
|
||||||
|
import PX4MavCtrlV4 as PX4MavCtrl
|
||||||
|
|
||||||
|
# import RflySim APIs
|
||||||
|
import PX4MavCtrlV4 as PX4MavCtrl
|
||||||
|
|
||||||
|
import VisionCaptureApi
|
||||||
|
import UE4CtrlAPI
|
||||||
|
ue = UE4CtrlAPI.UE4CtrlAPI()
|
||||||
|
|
||||||
|
vis = VisionCaptureApi.VisionCaptureApi()
|
||||||
|
|
||||||
|
# VisionCaptureApi 中的配置函数
|
||||||
|
vis.jsonLoad() # 加载Config.json中的传感器配置文件
|
||||||
|
|
||||||
|
isSuss = vis.sendReqToUE4() # 向RflySim3D发送取图请求,并验证
|
||||||
|
if not isSuss: # 如果请求取图失败,则退出
|
||||||
|
sys.exit(0)
|
||||||
|
vis.startImgCap(True) # 开启取图,并启用共享内存图像转发,转发到填写的目录
|
||||||
|
|
||||||
|
# Send command to UE4 Window 1 to change resolution
|
||||||
|
ue.sendUE4Cmd('r.setres 720x405w',0) # 设置UE4窗口分辨率,注意本窗口仅限于显示,取图分辨率在json中配置,本窗口设置越小,资源需求越少。
|
||||||
|
ue.sendUE4Cmd('t.MaxFPS 30',0) # 设置UE4最大刷新频率,同时也是取图频率
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# Create MAVLink control API instance
|
||||||
|
mav = PX4MavCtrl.PX4MavCtrler(1)
|
||||||
|
mav2 = PX4MavCtrl.PX4MavCtrler(2)
|
||||||
|
# Init MAVLink data receiving loop
|
||||||
|
mav.InitMavLoop()
|
||||||
|
mav2.InitMavLoop()
|
||||||
|
|
||||||
|
|
||||||
|
# send vehicle position command to create a man, with copterID=100
|
||||||
|
# the man is located before the drone, and rotated to 180 degree (face the drone)
|
||||||
|
ue.sendUE4Pos(100,30,0,[1,0,-8.086],[0,0,math.pi])
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# send command to change object with copterID=100 (the man just created) to a walking style
|
||||||
|
ue.sendUE4Cmd('RflyChange3DModel 100 16')
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# send command to the first RflySim3D window, to switch to vehicle 1
|
||||||
|
ue.sendUE4Cmd('RflyChangeViewKeyCmd B 1',0)
|
||||||
|
time.sleep(0.5)
|
||||||
|
# change the first window to size 720x405
|
||||||
|
ue.sendUE4Cmd('r.setres 720x405w',0)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
|
#send command to the second RflySim3D window to configure camera's position
|
||||||
|
ue.sendUE4Cmd('RflyChangeViewKeyCmd B 2',1)
|
||||||
|
time.sleep(0.5)
|
||||||
|
ue.sendUE4Cmd('r.setres 720x405w',1)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
print("5s, Arm the drone")
|
||||||
|
mav.initOffboard()
|
||||||
|
mav2.initOffboard()
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
|
mav.SendMavArm(True) # Arm the drone
|
||||||
|
mav2.SendMavArm(True) # Arm the drone
|
||||||
|
print("Arm the drone!, and fly to NED 0,0,-5")
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
mav.SendPosNED(0, 0, -1.7, 0) # Fly to target position 0,0,-1.5
|
||||||
|
mav2.SendPosNED(0, 0, -1.7, 0) # Fly to target position 0,0,-1.5
|
||||||
|
|
||||||
|
# Process the image in the following timer
|
||||||
|
startTime = time.time()
|
||||||
|
lastTime = time.time()
|
||||||
|
timeInterval = 1/30.0 # time interval of the timer
|
||||||
|
num=0
|
||||||
|
lastClock=time.time()
|
||||||
|
while True:
|
||||||
|
# The above code will be executed 30Hz (0.033333s)
|
||||||
|
lastTime = lastTime + timeInterval
|
||||||
|
sleepTime = lastTime - time.time()
|
||||||
|
if sleepTime > 0:
|
||||||
|
time.sleep(sleepTime)
|
||||||
|
else:
|
||||||
|
lastTime = time.time()
|
||||||
|
|
||||||
|
for i in range(4):
|
||||||
|
if vis.hasData[i]:
|
||||||
|
img = vis.Img[i]
|
||||||
|
cv2.imshow("pic"+str(i),img)
|
||||||
|
cv2.waitKey(1)
|
||||||
|
# add target tracking algorithm here with mav.SendVelNED or SendVelFRD API
|
||||||
|
|
||||||
|
num=num+1
|
||||||
|
if num%100==0:
|
||||||
|
tiem=time.time()
|
||||||
|
print(100/(tiem-lastClock))
|
||||||
|
lastClock=tiem
|
||||||
|
|
||||||
|
|
||||||
178
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemoHITL.bat
Normal file
178
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemoHITL.bat
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Run script as administrator
|
||||||
|
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~s0"" ::","","runas",1)(window.close)&&exit
|
||||||
|
|
||||||
|
|
||||||
|
REM The text start with 'REM' is annotation, the following options are corresponding to Options on CopterSim
|
||||||
|
|
||||||
|
REM Start index of vehicle number (should larger than 0)
|
||||||
|
REM This option is useful for simulation with multi-computers
|
||||||
|
SET /a START_INDEX=1
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the vehicleType/ClassID of vehicle 3D display in RflySim3D
|
||||||
|
SET /a CLASS_3D_ID=-1
|
||||||
|
|
||||||
|
REM Set use DLL model name or not, use number index or name string
|
||||||
|
REM This option is useful for simulation with other types of vehicles instead of multicopters
|
||||||
|
set DLLModel=0
|
||||||
|
|
||||||
|
REM Set the simulation mode on CopterSim, use number index or name string
|
||||||
|
REM e.g., 0:PX4_HITL, 1:PX4_SITL, 2:PX4_SITL_RFLY, 3:"Simulink&DLL_SIL", 4:PX4_HITL_NET, 5:EXT_HITL_COM, 6:EXT_SIM_NET
|
||||||
|
set SimMode=0
|
||||||
|
|
||||||
|
REM SET the baudrate for Pixhawk COM
|
||||||
|
SET /a BaudRate=921600
|
||||||
|
|
||||||
|
REM Set the map, use index or name of the map on CopterSim
|
||||||
|
REM e.g., UE4_MAP=1 equals to UE4_MAP=Grasslands
|
||||||
|
SET UE4_MAP=Grasslands
|
||||||
|
|
||||||
|
REM Set the origin x,y position (m) and yaw angle (degree) at the map
|
||||||
|
SET /a ORIGIN_POS_X=0
|
||||||
|
SET /a ORIGIN_POS_Y=0
|
||||||
|
SET /a ORIGIN_YAW=0
|
||||||
|
|
||||||
|
REM Set the interval between two vehicle, unit:m
|
||||||
|
SET /a VEHICLE_INTERVAL=2
|
||||||
|
|
||||||
|
|
||||||
|
REM Set broadcast to other computer; 0: only this computer, 1: broadcast; or use IP address to increase speed
|
||||||
|
REM e.g., IS_BROADCAST=0 equals to IS_BROADCAST=127.0.0.1, IS_BROADCAST=1 equals to IS_BROADCAST=255.255.255.255
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
|
||||||
|
REM Set UDP data mode; 0: UDP_FULL, 1:UDP_Simple, 2: Mavlink_Full, 3: Mavlink_simple. input number or string
|
||||||
|
REM 4:Mavlink_NoSend, 5:Mavlink_NoGPS, 6:Mavlink_Vision (NoGPS and set PX4 EKF)
|
||||||
|
SET UDPSIMMODE=2
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
REM Get the Com port number
|
||||||
|
for /f "delims=" %%t in ('%PSP_PATH%\CopterSim\GetComList.exe 3 %BaudRate%') do set ComInfoStr=%%t
|
||||||
|
|
||||||
|
for /f "tokens=1,2,3 delims=#" %%a in ("%ComInfoStr%") do (
|
||||||
|
set ComNumExe=%%a
|
||||||
|
set ComNameList=%%b
|
||||||
|
set ComInfoList=%%c
|
||||||
|
)
|
||||||
|
echo Please input the Pixhawk COM port list for HIL
|
||||||
|
echo Use ',' as the separator if more than one Pixhawk
|
||||||
|
echo E.g., input 3 for COM3 of Pixhawk on the computer
|
||||||
|
echo Input 3,6,7 for COM3, COM6 and COM7 of Pixhawks
|
||||||
|
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
set remain=%ComInfoList%
|
||||||
|
echo All COM ports on this computer are:
|
||||||
|
echo.
|
||||||
|
:loopInfo
|
||||||
|
for /f "tokens=1* delims=;" %%a in ("%remain%") do (
|
||||||
|
echo %%a
|
||||||
|
set remain=%%b
|
||||||
|
)
|
||||||
|
if defined remain goto :loopInfo
|
||||||
|
echo.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
|
||||||
|
if %ComNumExe% EQU 0 (
|
||||||
|
echo Warning: there is no available COM port
|
||||||
|
) else (
|
||||||
|
echo Recommended COM list input is: %ComNameList%
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
SET /P ComNum=My COM list for HITL simulation is:
|
||||||
|
SET string=%ComNum%
|
||||||
|
set subStr = ""
|
||||||
|
set /a VehicleNum=0
|
||||||
|
:split
|
||||||
|
for /f "tokens=1,* delims=," %%i in ("%string%") do (
|
||||||
|
set subStr=%%i
|
||||||
|
set string=%%j
|
||||||
|
)
|
||||||
|
set /a eValue=subStr
|
||||||
|
if not %eValue% EQU %subStr% (
|
||||||
|
echo Error: Input '%subStr%' is not a integer!
|
||||||
|
goto EOF
|
||||||
|
)
|
||||||
|
set /a VehicleNum = VehicleNum +1
|
||||||
|
if not "%string%"=="" goto split
|
||||||
|
REM cho total com number is %VehicleNum%
|
||||||
|
|
||||||
|
SET /A VehicleTotalNum=%VehicleNum% + %START_INDEX% - 1
|
||||||
|
if not defined TOTOAL_COPTER (
|
||||||
|
SET /A TOTOAL_COPTER=%VehicleTotalNum%
|
||||||
|
)
|
||||||
|
|
||||||
|
set /a sqrtNum=1
|
||||||
|
set /a squareNum=1
|
||||||
|
:loopSqrt
|
||||||
|
set /a squareNum=%sqrtNum% * %sqrtNum%
|
||||||
|
if %squareNum% EQU %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
if %squareNum% GTR %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
set /a sqrtNum=%sqrtNum%+1
|
||||||
|
goto loopSqrt
|
||||||
|
:loopSqrtEnd
|
||||||
|
|
||||||
|
|
||||||
|
REM UE4Path
|
||||||
|
cd /d %PSP_PATH%\RflySim3D
|
||||||
|
tasklist|find /i "RflySim3D.exe" || start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
choice /t 5 /d y /n >nul
|
||||||
|
|
||||||
|
|
||||||
|
tasklist|find /i "CopterSim.exe" && taskkill /im "CopterSim.exe"
|
||||||
|
ECHO Kill all CopterSims
|
||||||
|
|
||||||
|
|
||||||
|
REM CptSmPath
|
||||||
|
cd /d %PSP_PATH%\CopterSim
|
||||||
|
|
||||||
|
set /a cntr = %START_INDEX%
|
||||||
|
set /a endNum = %VehicleTotalNum% +1
|
||||||
|
|
||||||
|
SET string=%ComNum%
|
||||||
|
:split1
|
||||||
|
for /f "tokens=1,* delims=," %%i in ("%string%") do (
|
||||||
|
set subStr=%%i
|
||||||
|
set string=%%j
|
||||||
|
)
|
||||||
|
set /a PosXX=((%cntr%-1) / %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_X%
|
||||||
|
set /a PosYY=((%cntr%-1) %% %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_Y%
|
||||||
|
REM echo start CopterSim
|
||||||
|
start /realtime CopterSim.exe 1 %cntr% %CLASS_3D_ID% %DLLModel% %SimMode% %UE4_MAP% %IS_BROADCAST% %PosXX% %PosYY% %ORIGIN_YAW% %subStr%:%BaudRate% %UDPSIMMODE%
|
||||||
|
choice /t 2 /d y /n >nul
|
||||||
|
set /a cntr=%cntr%+1
|
||||||
|
|
||||||
|
REM TIMEOUT /T 1
|
||||||
|
if not "%string%"=="" goto split1
|
||||||
|
|
||||||
|
REM QGCPath
|
||||||
|
tasklist|find /i "QGroundControl.exe" || start %PSP_PATH%\QGroundControl\QGroundControl.exe -noComPix
|
||||||
|
ECHO Start QGroundControl
|
||||||
|
|
||||||
|
pause
|
||||||
|
|
||||||
|
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"
|
||||||
|
tasklist|find /i "python.exe" && taskkill /f /im "python.exe"
|
||||||
|
tasklist|find /i "cmd.exe" && taskkill /f /im "cmd.exe"
|
||||||
|
|
||||||
|
ECHO Start End.
|
||||||
163
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemoSITL.bat
Normal file
163
人工智能/e3.双目视觉人脸识别实验/MultiCameraDemo/MultiCameraDemoSITL.bat
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Run script as administrator
|
||||||
|
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~s0"" ::","","runas",1)(window.close)&&exit
|
||||||
|
|
||||||
|
|
||||||
|
REM The text start with 'REM' is annotation, the following options are corresponding to Options on CopterSim
|
||||||
|
|
||||||
|
REM Start index of vehicle number (should larger than 0)
|
||||||
|
REM This option is useful for simulation with multi-computers
|
||||||
|
SET /a START_INDEX=1
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the vehicleType/ClassID of vehicle 3D display in RflySim3D
|
||||||
|
SET /a CLASS_3D_ID=-1
|
||||||
|
|
||||||
|
REM Set use DLL model name or not, use number index or name string
|
||||||
|
REM This option is useful for simulation with other types of vehicles instead of multicopters
|
||||||
|
set DLLModel=0
|
||||||
|
|
||||||
|
REM Set the simulation mode on CopterSim, use number index or name string
|
||||||
|
REM e.g., SimMode=2 equals to SimMode=PX4_SITL_RFLY
|
||||||
|
set SimMode=2
|
||||||
|
|
||||||
|
REM Set the vehicle-model (airframe) of PX4 SITL simulation, the default airframe is a quadcopter: iris
|
||||||
|
REM Check folder Firmware\ROMFS\px4fmu_common\init.d-posix for supported airframes (Note: You can also create your airframe file here)
|
||||||
|
REM E.g., fixed-wing aircraft: PX4SitlFrame=plane; small cars: PX4SitlFrame=rover
|
||||||
|
set PX4SitlFrame=iris
|
||||||
|
|
||||||
|
|
||||||
|
REM Set the map, use index or name of the map on CopterSim
|
||||||
|
REM e.g., UE4_MAP=1 equals to UE4_MAP=Grasslands
|
||||||
|
SET UE4_MAP=Grasslands
|
||||||
|
|
||||||
|
REM Set the origin x,y position (m) and yaw angle (degree) at the map
|
||||||
|
SET /a ORIGIN_POS_X=0
|
||||||
|
SET /a ORIGIN_POS_Y=0
|
||||||
|
SET /a ORIGIN_YAW=0
|
||||||
|
|
||||||
|
REM Set the interval between two vehicle, unit:m
|
||||||
|
SET /a VEHICLE_INTERVAL=2
|
||||||
|
|
||||||
|
|
||||||
|
REM Set broadcast to other computer; 0: only this computer, 1: broadcast; or use IP address to increase speed
|
||||||
|
REM e.g., IS_BROADCAST=0 equals to IS_BROADCAST=127.0.0.1, IS_BROADCAST=1 equals to IS_BROADCAST=255.255.255.255
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
|
||||||
|
REM Set UDP data mode; 0: UDP_FULL, 1:UDP_Simple, 2: Mavlink_Full, 3: Mavlink_simple. input number or string
|
||||||
|
REM 4:Mavlink_NoSend, 5:Mavlink_NoGPS, 6:Mavlink_Vision (NoGPS and set PX4 EKF)
|
||||||
|
SET UDPSIMMODE=2
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
:Top
|
||||||
|
ECHO.
|
||||||
|
ECHO ---------------------------------------
|
||||||
|
REM Max vehicle number 50
|
||||||
|
SET /a MAX_VEHICLE=50
|
||||||
|
REM SET /P VehicleNum=Please input UAV swarm number:
|
||||||
|
SET /A VehicleNum=2
|
||||||
|
SET /A Evaluated=VehicleNum
|
||||||
|
if %Evaluated% EQU %VehicleNum% (
|
||||||
|
IF %VehicleNum% GTR 0 (
|
||||||
|
IF %VehicleNum% GTR %MAX_VEHICLE% (
|
||||||
|
ECHO The vehicle number is too large, which may cause a crash
|
||||||
|
pause
|
||||||
|
)
|
||||||
|
GOTO StartSim
|
||||||
|
)
|
||||||
|
ECHO Not a positive integer
|
||||||
|
GOTO Top
|
||||||
|
) ELSE (
|
||||||
|
ECHO Not a integer
|
||||||
|
GOTO Top
|
||||||
|
)
|
||||||
|
:StartSim
|
||||||
|
|
||||||
|
SET /A VehicleTotalNum=%VehicleNum% + %START_INDEX% - 1
|
||||||
|
if not defined TOTOAL_COPTER (
|
||||||
|
SET /A TOTOAL_COPTER=%VehicleTotalNum%
|
||||||
|
)
|
||||||
|
|
||||||
|
set /a sqrtNum=1
|
||||||
|
set /a squareNum=1
|
||||||
|
:loopSqrt
|
||||||
|
set /a squareNum=%sqrtNum% * %sqrtNum%
|
||||||
|
if %squareNum% EQU %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
if %squareNum% GTR %TOTOAL_COPTER% (
|
||||||
|
goto loopSqrtEnd
|
||||||
|
)
|
||||||
|
set /a sqrtNum=%sqrtNum%+1
|
||||||
|
goto loopSqrt
|
||||||
|
:loopSqrtEnd
|
||||||
|
|
||||||
|
|
||||||
|
REM QGCPath
|
||||||
|
tasklist|find /i "QGroundControl.exe" || start %PSP_PATH%\QGroundControl\QGroundControl.exe -noComPix
|
||||||
|
ECHO Start QGroundControl
|
||||||
|
|
||||||
|
REM UE4Path
|
||||||
|
cd /d %PSP_PATH%\RflySim3D
|
||||||
|
tasklist|find /i "RflySim3D.exe" || start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
start %PSP_PATH%\RflySim3D\RflySim3D.exe
|
||||||
|
choice /t 5 /d y /n >nul
|
||||||
|
|
||||||
|
|
||||||
|
tasklist|find /i "CopterSim.exe" && taskkill /im "CopterSim.exe"
|
||||||
|
ECHO Kill all CopterSims
|
||||||
|
|
||||||
|
|
||||||
|
REM CptSmPath
|
||||||
|
cd /d %PSP_PATH%\CopterSim
|
||||||
|
|
||||||
|
|
||||||
|
set /a cntr=%START_INDEX%
|
||||||
|
set /a endNum=%VehicleTotalNum%+1
|
||||||
|
|
||||||
|
:loopBegin
|
||||||
|
set /a PosXX=((%cntr%-1) / %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_X%
|
||||||
|
set /a PosYY=((%cntr%-1) %% %sqrtNum%)*%VEHICLE_INTERVAL% + %ORIGIN_POS_Y%
|
||||||
|
start /realtime CopterSim.exe 1 %cntr% %CLASS_3D_ID% %DLLModel% %SimMode% %UE4_MAP% %IS_BROADCAST% %PosXX% %PosYY% %ORIGIN_YAW% 1 %UDPSIMMODE%
|
||||||
|
choice /t 1 /d y /n >nul
|
||||||
|
set /a cntr=%cntr%+1
|
||||||
|
|
||||||
|
if %cntr% EQU %endNum% goto loopEnd
|
||||||
|
goto loopBegin
|
||||||
|
:loopEnd
|
||||||
|
|
||||||
|
REM Set ToolChainType 1:Win10WSL 3:Cygwin
|
||||||
|
SET /a ToolChainType=1
|
||||||
|
|
||||||
|
if "%IS_BROADCAST%" == "0" (
|
||||||
|
SET IS_BROADCAST=0
|
||||||
|
) else (
|
||||||
|
SET IS_BROADCAST=1
|
||||||
|
)
|
||||||
|
|
||||||
|
SET WINDOWSPATH=%PATH%
|
||||||
|
if %ToolChainType% EQU 1 (
|
||||||
|
wsl -d RflySim-20.04 echo Starting PX4 Build; cd %PSP_PATH_LINUX%/Firmware; ./BkFile/EnvOri.sh; export PATH=$HOME/ninja:$HOME/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH;make px4_sitl_default; ./Tools/sitl_multiple_run_rfly.sh %VehicleNum% %START_INDEX% %PX4SitlFrame%;echo Press any key to exit; read -n 1
|
||||||
|
) else (
|
||||||
|
REM CYGPath
|
||||||
|
cd /d %PSP_PATH%\CygwinToolchain
|
||||||
|
CALL setPX4Env.bat
|
||||||
|
bash -l -i -c 'echo Starting SITL SIMULATION; cd %PSP_PATH_LINUX%/Firmware; ./BkFile/EnvOri.sh; pwd; make px4_sitl_default; ./Tools/sitl_multiple_run_rfly.sh %VehicleNum% %START_INDEX% %PX4SitlFrame%;echo Press any key to exit; read -n 1; pkill -x px4 || true;'
|
||||||
|
)
|
||||||
|
SET PATH=%WINDOWSPATH%
|
||||||
|
|
||||||
|
|
||||||
|
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"
|
||||||
|
tasklist|find /i "python.exe" && taskkill /f /im "python.exe"
|
||||||
|
tasklist|find /i "cmd.exe" && taskkill /f /im "cmd.exe"
|
||||||
|
|
||||||
|
ECHO Start End.
|
||||||
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.
12
人工智能/e3.双目视觉人脸识别实验/WinWSL.bat
Normal file
12
人工智能/e3.双目视觉人脸识别实验/WinWSL.bat
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
@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
|
||||||
|
)
|
||||||
|
cd /d %PSP_PATH%\VcXsrv
|
||||||
|
tasklist|find /i "vcxsrv.exe" >nul || Xlaunch.exe -run config1.xlaunch
|
||||||
|
|
||||||
|
cd /d %~dp0
|
||||||
|
wsl -d RflySim-20.04
|
||||||
|
|
||||||
20
人工智能/e3.双目视觉人脸识别实验/WslGUI.bat
Normal file
20
人工智能/e3.双目视觉人脸识别实验/WslGUI.bat
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@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
|
||||||
|
)
|
||||||
|
|
||||||
|
tasklist|find /i "vcxsrv.exe" >nul && taskkill /f /IM "vcxsrv.exe" >nul
|
||||||
|
tasklist|find /i "vcxsrv.exe" >nul && taskkill /f /IM "vcxsrv.exe" >nul
|
||||||
|
|
||||||
|
cd /d %PSP_PATH%\VcXsrv
|
||||||
|
Xlaunch.exe -run config.xlaunch
|
||||||
|
|
||||||
|
choice /t 1 /d y /n >nul
|
||||||
|
|
||||||
|
cd /d %~dp0
|
||||||
|
wsl -d RflySim-20.04 ~/StartUI.sh
|
||||||
|
choice /t 1 /d y /n >nul
|
||||||
|
tasklist|find /i "vcxsrv.exe" && taskkill /f /IM "vcxsrv.exe"
|
||||||
12213
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_eye.xml
Normal file
12213
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_eye.xml
Normal file
File diff suppressed because it is too large
Load Diff
22619
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_eye_tree_eyeglasses.xml
Normal file
22619
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_eye_tree_eyeglasses.xml
Normal file
File diff suppressed because it is too large
Load Diff
24350
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt.xml
Normal file
24350
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt.xml
Normal file
File diff suppressed because it is too large
Load Diff
20719
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt2.xml
Normal file
20719
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt2.xml
Normal file
File diff suppressed because it is too large
Load Diff
96484
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt_tree.xml
Normal file
96484
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_alt_tree.xml
Normal file
File diff suppressed because it is too large
Load Diff
33314
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_default.xml
Normal file
33314
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_frontalface_default.xml
Normal file
File diff suppressed because it is too large
Load Diff
17030
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_fullbody.xml
Normal file
17030
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_fullbody.xml
Normal file
File diff suppressed because it is too large
Load Diff
7390
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_lefteye_2splits.xml
Normal file
7390
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_lefteye_2splits.xml
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
14056
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_lowerbody.xml
Normal file
14056
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_lowerbody.xml
Normal file
File diff suppressed because it is too large
Load Diff
29690
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_profileface.xml
Normal file
29690
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_profileface.xml
Normal file
File diff suppressed because it is too large
Load Diff
7407
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_righteye_2splits.xml
Normal file
7407
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_righteye_2splits.xml
Normal file
File diff suppressed because it is too large
Load Diff
2656
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_russian_plate_number.xml
Normal file
2656
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_russian_plate_number.xml
Normal file
File diff suppressed because it is too large
Load Diff
6729
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_smile.xml
Normal file
6729
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_smile.xml
Normal file
File diff suppressed because it is too large
Load Diff
28134
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_upperbody.xml
Normal file
28134
人工智能/e3.双目视觉人脸识别实验/cascades/haarcascade_upperbody.xml
Normal file
File diff suppressed because it is too large
Load Diff
0
人工智能/e3.双目视觉人脸识别实验/名称-双目视觉人脸识别实验.txt
Normal file
0
人工智能/e3.双目视觉人脸识别实验/名称-双目视觉人脸识别实验.txt
Normal file
Reference in New Issue
Block a user