main
parent
587eea23d0
commit
ee1f74a1d8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,206 @@
|
|||||||
|
@startuml 代码组织结构图
|
||||||
|
title 基于空地协同的战场环境探索系统 - 代码组织结构图
|
||||||
|
skinparam packageStyle rectangle
|
||||||
|
skinparam packageFontSize 10
|
||||||
|
skinparam packageFontStyle bold
|
||||||
|
skinparam classFontSize 8
|
||||||
|
skinparam classFontStyle normal
|
||||||
|
|
||||||
|
package "src/" {
|
||||||
|
package "Client/ (Qt客户端应用)" {
|
||||||
|
package "核心应用层" {
|
||||||
|
file "main.cpp" as main
|
||||||
|
file "BattlefieldExplorationSystem.pro" as proj
|
||||||
|
file "Makefile" as make
|
||||||
|
}
|
||||||
|
|
||||||
|
package "include/ (头文件)" {
|
||||||
|
package "ui/ (用户界面)" {
|
||||||
|
package "main/" {
|
||||||
|
file "MainWindow.h" as mainH
|
||||||
|
}
|
||||||
|
package "components/ (组件)" {
|
||||||
|
file "RightFunctionPanel.h" as rightPanelH
|
||||||
|
file "DeviceListPanel.h" as deviceListH
|
||||||
|
file "DeviceCard.h" as deviceCardH
|
||||||
|
file "SystemLogPanel.h" as logPanelH
|
||||||
|
}
|
||||||
|
package "dialogs/ (对话框)" {
|
||||||
|
file "RobotDogControlDialog.h" as dogDialogH
|
||||||
|
file "EnemyStatsDialog.h" as enemyDialogH
|
||||||
|
file "DroneControlDialog.h" as droneDialogH
|
||||||
|
file "DeviceDialog.h" as deviceDialogH
|
||||||
|
}
|
||||||
|
file "UIInitializationManager.h" as uiInitH
|
||||||
|
}
|
||||||
|
|
||||||
|
package "utils/ (工具类)" {
|
||||||
|
file "ConfigManager.h" as configH
|
||||||
|
file "SystemLogger.h" as loggerH
|
||||||
|
}
|
||||||
|
|
||||||
|
package "core/ (核心功能)" {
|
||||||
|
package "database/ (数据库)" {
|
||||||
|
file "DatabaseManager.h" as dbManagerH
|
||||||
|
file "DatabaseHelper.h" as dbHelperH
|
||||||
|
file "DatabaseConfig.h" as dbConfigH
|
||||||
|
file "EnemyDatabase.h" as enemyDbH
|
||||||
|
file "DogDatabase.h" as dogDbH
|
||||||
|
file "UAVDatabase.h" as uavDbH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "src/ (源文件)" {
|
||||||
|
package "ui/ (用户界面实现)" {
|
||||||
|
package "main/" {
|
||||||
|
file "MainWindow.cpp" as mainCpp
|
||||||
|
}
|
||||||
|
package "components/ (组件实现)" {
|
||||||
|
file "RightFunctionPanel.cpp" as rightPanelCpp
|
||||||
|
file "DeviceListPanel.cpp" as deviceListCpp
|
||||||
|
file "DeviceCard.cpp" as deviceCardCpp
|
||||||
|
file "SystemLogPanel.cpp" as logPanelCpp
|
||||||
|
}
|
||||||
|
package "dialogs/ (对话框实现)" {
|
||||||
|
file "RobotDogControlDialog.cpp" as dogDialogCpp
|
||||||
|
file "EnemyStatsDialog.cpp" as enemyDialogCpp
|
||||||
|
file "DroneControlDialog.cpp" as droneDialogCpp
|
||||||
|
file "DeviceDialog.cpp" as deviceDialogCpp
|
||||||
|
}
|
||||||
|
file "UIInitializationManager.cpp" as uiInitCpp
|
||||||
|
}
|
||||||
|
|
||||||
|
package "utils/ (工具类实现)" {
|
||||||
|
file "ConfigManager.cpp" as configCpp
|
||||||
|
file "SystemLogger.cpp" as loggerCpp
|
||||||
|
}
|
||||||
|
|
||||||
|
package "core/ (核心功能实现)" {
|
||||||
|
package "database/ (数据库实现)" {
|
||||||
|
file "DatabaseManager.cpp" as dbManagerCpp
|
||||||
|
file "DatabaseHelper.cpp" as dbHelperCpp
|
||||||
|
file "DatabaseConfig.cpp" as dbConfigCpp
|
||||||
|
file "EnemyDatabase.cpp" as enemyDbCpp
|
||||||
|
file "DogDatabase.cpp" as dogDbCpp
|
||||||
|
file "UAVDatabase.cpp" as uavDbCpp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "forms/ (UI设计文件)" {
|
||||||
|
package "main/" {
|
||||||
|
file "MainWindow.ui" as mainUi
|
||||||
|
}
|
||||||
|
package "dialogs/" {
|
||||||
|
file "DeviceDialog.ui" as deviceUi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "AudioModule/ (音频模块)" {
|
||||||
|
file "IntelligenceUI.h" as audioH
|
||||||
|
file "IntelligenceUI.cpp" as audioCpp
|
||||||
|
file "IntelligenceUI.ui" as audioUi
|
||||||
|
}
|
||||||
|
|
||||||
|
package "FaceLightModule/ (面部识别模块)" {
|
||||||
|
file "FaceLightControl.h" as faceH
|
||||||
|
file "FaceLightControl.cpp" as faceCpp
|
||||||
|
file "FaceLightControl.ui" as faceUi
|
||||||
|
}
|
||||||
|
|
||||||
|
package "config/ (配置文件)" {
|
||||||
|
file "database.ini" as dbIni
|
||||||
|
file "database.ini.example" as dbIniEx
|
||||||
|
file "README.md" as configReadme
|
||||||
|
}
|
||||||
|
|
||||||
|
package "database/ (数据库脚本)" {
|
||||||
|
file "enemy_database_schema.sql" as enemySchema
|
||||||
|
file "insert_additional_enemy_data.sql" as enemyData
|
||||||
|
file "test_enemy_database.sql" as enemyTest
|
||||||
|
file "update_enemy_locations.sql" as enemyUpdate
|
||||||
|
}
|
||||||
|
|
||||||
|
package "其他资源" {
|
||||||
|
file "res.qrc" as res
|
||||||
|
file "代码规范.md" as codeStandard
|
||||||
|
file "BUTTON_LAYOUT_OPTIMIZATION_REPORT.md" as layoutReport
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "catkin_dog/ (ROS机器人控制)" {
|
||||||
|
package "unitree_ros_to_real/" {
|
||||||
|
package "unitree_legged_real/" {
|
||||||
|
package "src/exe/" as exe
|
||||||
|
package "include/" as realInclude
|
||||||
|
package "launch/" as launch
|
||||||
|
package "scripts/" as scripts
|
||||||
|
package "rviz/" as rviz
|
||||||
|
file "CMakeLists.txt" as realCmake
|
||||||
|
file "package.xml" as realPackage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "unitree_legged_sdk/" {
|
||||||
|
package "include/" as sdkInclude
|
||||||
|
package "lib/" as lib
|
||||||
|
package "example/" as example
|
||||||
|
package "example_py/" as examplePy
|
||||||
|
package "python_wrapper/" as pyWrapper
|
||||||
|
file "CMakeLists.txt" as sdkCmake
|
||||||
|
file "package.xml" as sdkPackage
|
||||||
|
file "README.md" as sdkReadme
|
||||||
|
}
|
||||||
|
|
||||||
|
package "unitree_legged_msgs/" {
|
||||||
|
package "msg/ (ROS消息定义)" {
|
||||||
|
file "HighCmd.msg" as highCmd
|
||||||
|
file "HighState.msg" as highState
|
||||||
|
file "LowCmd.msg" as lowCmd
|
||||||
|
file "LowState.msg" as lowState
|
||||||
|
file "MotorCmd.msg" as motorCmd
|
||||||
|
file "MotorState.msg" as motorState
|
||||||
|
file "IMU.msg" as imu
|
||||||
|
file "BmsState.msg" as bmsState
|
||||||
|
file "LED.msg" as led
|
||||||
|
file "Cartesian.msg" as cartesian
|
||||||
|
}
|
||||||
|
file "CMakeLists.txt" as msgCmake
|
||||||
|
file "package.xml" as msgPackage
|
||||||
|
}
|
||||||
|
|
||||||
|
package "slamware_ros_sdk_linux-x86_64-gcc9/" as slamware
|
||||||
|
file "CMakeLists.txt" as catkinCmake
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
' 主要模块关系
|
||||||
|
package "系统架构层次" {
|
||||||
|
note top of Client : "Qt客户端应用\n- 用户界面\n- 数据库管理\n- 设备控制\n- 音频处理\n- 面部识别"
|
||||||
|
|
||||||
|
note top of catkin_dog : "ROS机器人控制\n- 机器狗SDK\n- 消息通信\n- 导航控制\n- SLAM建图"
|
||||||
|
}
|
||||||
|
|
||||||
|
' 核心功能模块
|
||||||
|
package "核心功能模块" {
|
||||||
|
note as N1 : "1. 空地协同控制\n- 无人机控制\n- 机器狗控制\n- 协同调度"
|
||||||
|
|
||||||
|
note as N2 : "2. 智能识别系统\n- YOLO目标检测\n- 面部识别\n- 音频处理"
|
||||||
|
|
||||||
|
note as N3 : "3. 数据管理系统\n- 敌方数据库\n- 设备数据库\n- 情报数据"
|
||||||
|
|
||||||
|
note as N4 : "4. 可视化界面\n- 3D战场地图\n- 实时视频显示\n- 态势分析"
|
||||||
|
}
|
||||||
|
|
||||||
|
Client --> N1 : 控制指令
|
||||||
|
Client --> N2 : 识别结果
|
||||||
|
Client --> N3 : 数据存储
|
||||||
|
Client --> N4 : 界面展示
|
||||||
|
|
||||||
|
catkin_dog --> N1 : 执行控制
|
||||||
|
catkin_dog --> N2 : 传感器数据
|
||||||
|
catkin_dog --> N3 : 位置信息
|
||||||
|
catkin_dog --> N4 : 状态反馈
|
||||||
|
|
||||||
|
@enduml
|
@ -0,0 +1,350 @@
|
|||||||
|
@startuml 数据模型类图
|
||||||
|
title 基于空地协同的战场环境探索系统 - 数据模型类图
|
||||||
|
skinparam classAttributeIconSize 0
|
||||||
|
skinparam classFontSize 10
|
||||||
|
skinparam classFontStyle bold
|
||||||
|
skinparam packageStyle rectangle
|
||||||
|
|
||||||
|
package "核心数据实体" {
|
||||||
|
class Location {
|
||||||
|
-locationId: String
|
||||||
|
-x: double
|
||||||
|
-y: double
|
||||||
|
-z: double
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+getCoordinates()
|
||||||
|
+setCoordinates()
|
||||||
|
+calculateDistance()
|
||||||
|
+isValid()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pose {
|
||||||
|
-poseId: String
|
||||||
|
-position: Location
|
||||||
|
-orientation: QQuaternion
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+getPosition()
|
||||||
|
+getOrientation()
|
||||||
|
+setPose()
|
||||||
|
+transformPose()
|
||||||
|
}
|
||||||
|
|
||||||
|
class SensorData {
|
||||||
|
-sensorId: String
|
||||||
|
-sensorType: String
|
||||||
|
-dataType: String
|
||||||
|
-rawData: QByteArray
|
||||||
|
-processedData: QVariant
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+getRawData()
|
||||||
|
+getProcessedData()
|
||||||
|
+processData()
|
||||||
|
+validateData()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Target {
|
||||||
|
-targetId: String
|
||||||
|
-targetType: String
|
||||||
|
-location: Location
|
||||||
|
-threatLevel: int
|
||||||
|
-confidence: double
|
||||||
|
-status: String
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+updateLocation()
|
||||||
|
+updateThreatLevel()
|
||||||
|
+assessThreat()
|
||||||
|
+isActive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "设备数据模型" {
|
||||||
|
class Device {
|
||||||
|
-deviceId: String
|
||||||
|
-deviceType: String
|
||||||
|
-deviceName: String
|
||||||
|
-status: String
|
||||||
|
-connectionStatus: String
|
||||||
|
-lastUpdate: QDateTime
|
||||||
|
+getDeviceInfo()
|
||||||
|
+updateStatus()
|
||||||
|
+isConnected()
|
||||||
|
+isOperational()
|
||||||
|
}
|
||||||
|
|
||||||
|
class RobotDog {
|
||||||
|
-dogId: String
|
||||||
|
-dogType: String
|
||||||
|
-batteryLevel: double
|
||||||
|
-currentPose: Pose
|
||||||
|
-movementStatus: String
|
||||||
|
-sensorData: QList<SensorData>
|
||||||
|
-lastCommand: MovementCommand
|
||||||
|
+getBatteryLevel()
|
||||||
|
+getCurrentPose()
|
||||||
|
+updateStatus()
|
||||||
|
+sendCommand()
|
||||||
|
+emergencyStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
class UAV {
|
||||||
|
-uavId: String
|
||||||
|
-uavType: String
|
||||||
|
-batteryLevel: double
|
||||||
|
-altitude: double
|
||||||
|
-currentPose: Pose
|
||||||
|
-flightMode: String
|
||||||
|
-sensorData: QList<SensorData>
|
||||||
|
+getBatteryLevel()
|
||||||
|
+getAltitude()
|
||||||
|
+getCurrentPose()
|
||||||
|
+updateFlightMode()
|
||||||
|
+sendFlightCommand()
|
||||||
|
}
|
||||||
|
|
||||||
|
class MovementCommand {
|
||||||
|
-commandId: String
|
||||||
|
-deviceId: String
|
||||||
|
-commandType: String
|
||||||
|
-targetPose: Pose
|
||||||
|
-speed: double
|
||||||
|
-priority: int
|
||||||
|
-timestamp: QDateTime
|
||||||
|
-status: String
|
||||||
|
+executeCommand()
|
||||||
|
+validateCommand()
|
||||||
|
+getCommandStatus()
|
||||||
|
+cancelCommand()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "任务数据模型" {
|
||||||
|
class Mission {
|
||||||
|
-missionId: String
|
||||||
|
-missionType: String
|
||||||
|
-missionName: String
|
||||||
|
-priority: int
|
||||||
|
-status: String
|
||||||
|
-startTime: QDateTime
|
||||||
|
-endTime: QDateTime
|
||||||
|
-assignedDevices: QList<String>
|
||||||
|
-tasks: QList<Task>
|
||||||
|
+createMission()
|
||||||
|
+assignDevices()
|
||||||
|
+addTask()
|
||||||
|
+updateStatus()
|
||||||
|
+completeMission()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Task {
|
||||||
|
-taskId: String
|
||||||
|
-missionId: String
|
||||||
|
-taskType: String
|
||||||
|
-taskName: String
|
||||||
|
-priority: int
|
||||||
|
-status: String
|
||||||
|
-assignedDevice: String
|
||||||
|
-startLocation: Location
|
||||||
|
-endLocation: Location
|
||||||
|
-parameters: QVariantMap
|
||||||
|
+assignDevice()
|
||||||
|
+updateStatus()
|
||||||
|
+executeTask()
|
||||||
|
+completeTask()
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaskResult {
|
||||||
|
-resultId: String
|
||||||
|
-taskId: String
|
||||||
|
-deviceId: String
|
||||||
|
-resultType: String
|
||||||
|
-resultData: QVariant
|
||||||
|
-success: boolean
|
||||||
|
-errorMessage: String
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+setResult()
|
||||||
|
+getResult()
|
||||||
|
+isSuccess()
|
||||||
|
+getErrorMessage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "情报数据模型" {
|
||||||
|
class IntelligenceData {
|
||||||
|
-intelligenceId: String
|
||||||
|
-dataType: String
|
||||||
|
-source: String
|
||||||
|
-content: QVariant
|
||||||
|
-confidence: double
|
||||||
|
-priority: int
|
||||||
|
-timestamp: QDateTime
|
||||||
|
-expiryTime: QDateTime
|
||||||
|
+getContent()
|
||||||
|
+setConfidence()
|
||||||
|
+isExpired()
|
||||||
|
+updatePriority()
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnemyTarget {
|
||||||
|
-targetId: String
|
||||||
|
-targetType: String
|
||||||
|
-location: Location
|
||||||
|
-threatLevel: int
|
||||||
|
-confidence: double
|
||||||
|
-detectionTime: QDateTime
|
||||||
|
-lastUpdate: QDateTime
|
||||||
|
-status: String
|
||||||
|
-attributes: QVariantMap
|
||||||
|
+updateLocation()
|
||||||
|
+updateThreatLevel()
|
||||||
|
+setAttributes()
|
||||||
|
+isActive()
|
||||||
|
}
|
||||||
|
|
||||||
|
class BattlefieldMap {
|
||||||
|
-mapId: String
|
||||||
|
-mapType: String
|
||||||
|
-resolution: double
|
||||||
|
-width: double
|
||||||
|
-height: double
|
||||||
|
-origin: Location
|
||||||
|
-mapData: QImage
|
||||||
|
-obstacles: QList<Obstacle>
|
||||||
|
-lastUpdate: QDateTime
|
||||||
|
+getMapData()
|
||||||
|
+addObstacle()
|
||||||
|
+removeObstacle()
|
||||||
|
+updateMap()
|
||||||
|
+getObstacles()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Obstacle {
|
||||||
|
-obstacleId: String
|
||||||
|
-obstacleType: String
|
||||||
|
-location: Location
|
||||||
|
-size: QVector3D
|
||||||
|
-properties: QVariantMap
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+getLocation()
|
||||||
|
+getSize()
|
||||||
|
+setProperties()
|
||||||
|
+isBlocking()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "系统配置数据" {
|
||||||
|
class SystemConfig {
|
||||||
|
-configId: String
|
||||||
|
-configType: String
|
||||||
|
-configName: String
|
||||||
|
-configValue: QVariant
|
||||||
|
-description: String
|
||||||
|
-lastModified: QDateTime
|
||||||
|
+getValue()
|
||||||
|
+setValue()
|
||||||
|
+getDescription()
|
||||||
|
+isValid()
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserConfig {
|
||||||
|
-userId: String
|
||||||
|
-username: String
|
||||||
|
-userRole: String
|
||||||
|
-permissions: QList<String>
|
||||||
|
-preferences: QVariantMap
|
||||||
|
-lastLogin: QDateTime
|
||||||
|
+getPermissions()
|
||||||
|
+setPreferences()
|
||||||
|
+hasPermission()
|
||||||
|
+updateLastLogin()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceConfig {
|
||||||
|
-deviceId: String
|
||||||
|
-configType: String
|
||||||
|
-parameters: QVariantMap
|
||||||
|
-lastModified: QDateTime
|
||||||
|
+getParameters()
|
||||||
|
+setParameters()
|
||||||
|
+validateConfig()
|
||||||
|
+applyConfig()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "日志和监控数据" {
|
||||||
|
class SystemLog {
|
||||||
|
-logId: String
|
||||||
|
-logLevel: String
|
||||||
|
-logSource: String
|
||||||
|
-logMessage: String
|
||||||
|
-timestamp: QDateTime
|
||||||
|
-userId: String
|
||||||
|
-deviceId: String
|
||||||
|
+getLogInfo()
|
||||||
|
+setLogLevel()
|
||||||
|
+formatMessage()
|
||||||
|
}
|
||||||
|
|
||||||
|
class PerformanceMetrics {
|
||||||
|
-metricId: String
|
||||||
|
-metricType: String
|
||||||
|
-metricName: String
|
||||||
|
-metricValue: double
|
||||||
|
-unit: String
|
||||||
|
-timestamp: QDateTime
|
||||||
|
-deviceId: String
|
||||||
|
+getMetricValue()
|
||||||
|
+setMetricValue()
|
||||||
|
+getUnit()
|
||||||
|
+isWithinRange()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Alert {
|
||||||
|
-alertId: String
|
||||||
|
-alertType: String
|
||||||
|
-alertLevel: String
|
||||||
|
-alertMessage: String
|
||||||
|
-source: String
|
||||||
|
-timestamp: QDateTime
|
||||||
|
-acknowledged: boolean
|
||||||
|
-resolved: boolean
|
||||||
|
+getAlertInfo()
|
||||||
|
+acknowledgeAlert()
|
||||||
|
+resolveAlert()
|
||||||
|
+isActive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
' 关系定义
|
||||||
|
Location ||--o{ Pose : 组成
|
||||||
|
Location ||--o{ Target : 定位
|
||||||
|
Location ||--o{ RobotDog : 定位
|
||||||
|
Location ||--o{ UAV : 定位
|
||||||
|
Location ||--o{ Obstacle : 定位
|
||||||
|
|
||||||
|
Pose ||--o{ MovementCommand : 目标位置
|
||||||
|
Pose ||--o{ Task : 起始/结束位置
|
||||||
|
|
||||||
|
Device ||--o{ RobotDog : 继承
|
||||||
|
Device ||--o{ UAV : 继承
|
||||||
|
|
||||||
|
RobotDog ||--o{ MovementCommand : 执行
|
||||||
|
UAV ||--o{ MovementCommand : 执行
|
||||||
|
|
||||||
|
Mission ||--o{ Task : 包含
|
||||||
|
Task ||--o{ TaskResult : 产生
|
||||||
|
Task ||--o{ MovementCommand : 生成
|
||||||
|
|
||||||
|
IntelligenceData ||--o{ EnemyTarget : 包含
|
||||||
|
BattlefieldMap ||--o{ Obstacle : 包含
|
||||||
|
BattlefieldMap ||--o{ Location : 覆盖
|
||||||
|
|
||||||
|
SystemConfig ||--o{ DeviceConfig : 配置
|
||||||
|
UserConfig ||--o{ SystemLog : 记录
|
||||||
|
Device ||--o{ DeviceConfig : 配置
|
||||||
|
|
||||||
|
SystemLog ||--o{ PerformanceMetrics : 记录
|
||||||
|
SystemLog ||--o{ Alert : 生成
|
||||||
|
Device ||--o{ PerformanceMetrics : 监控
|
||||||
|
Device ||--o{ Alert : 产生
|
||||||
|
|
||||||
|
@enduml
|
@ -0,0 +1,515 @@
|
|||||||
|
@startuml 软件系统分析类图
|
||||||
|
title 基于空地协同的战场环境探索系统 - 软件系统分析类图
|
||||||
|
skinparam classAttributeIconSize 0
|
||||||
|
skinparam classFontSize 10
|
||||||
|
skinparam classFontStyle bold
|
||||||
|
skinparam packageStyle rectangle
|
||||||
|
skinparam packageFontSize 12
|
||||||
|
|
||||||
|
' 定义样式
|
||||||
|
skinparam class {
|
||||||
|
BackgroundColor<<Qt>> #E1F5FE
|
||||||
|
BackgroundColor<<ROS>> #F3E5F5
|
||||||
|
BackgroundColor<<AI>> #E8F5E8
|
||||||
|
BackgroundColor<<Database>> #FFF3E0
|
||||||
|
BackgroundColor<<Core>> #FCE4EC
|
||||||
|
}
|
||||||
|
|
||||||
|
package "用户界面层 (Qt Client)" <<Qt>> {
|
||||||
|
class MainWindow {
|
||||||
|
-mainWindowId: String
|
||||||
|
-windowTitle: String
|
||||||
|
-windowSize: QSize
|
||||||
|
+initializeUI()
|
||||||
|
+setupMenuBar()
|
||||||
|
+setupToolBar()
|
||||||
|
+setupStatusBar()
|
||||||
|
+handleMenuAction()
|
||||||
|
+updateStatus()
|
||||||
|
+closeEvent()
|
||||||
|
}
|
||||||
|
|
||||||
|
class UIInitializationManager {
|
||||||
|
-uiManagerId: String
|
||||||
|
-initializationStatus: String
|
||||||
|
+initializeAllComponents()
|
||||||
|
+setupDatabaseConnection()
|
||||||
|
+setupDeviceConnections()
|
||||||
|
+setupSignalSlots()
|
||||||
|
+validateInitialization()
|
||||||
|
+handleInitializationError()
|
||||||
|
}
|
||||||
|
|
||||||
|
package "UI组件 (Components)" {
|
||||||
|
class RightFunctionPanel {
|
||||||
|
-panelId: String
|
||||||
|
-panelType: String
|
||||||
|
-isVisible: boolean
|
||||||
|
+setupFunctionButtons()
|
||||||
|
+handleButtonClick()
|
||||||
|
+updatePanelContent()
|
||||||
|
+showPanel()
|
||||||
|
+hidePanel()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceListPanel {
|
||||||
|
-deviceListId: String
|
||||||
|
-deviceCount: int
|
||||||
|
-selectedDevice: String
|
||||||
|
+loadDeviceList()
|
||||||
|
+addDevice()
|
||||||
|
+removeDevice()
|
||||||
|
+selectDevice()
|
||||||
|
+updateDeviceStatus()
|
||||||
|
+refreshDeviceList()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceCard {
|
||||||
|
-deviceId: String
|
||||||
|
-deviceType: String
|
||||||
|
-deviceStatus: String
|
||||||
|
-deviceIcon: QIcon
|
||||||
|
+displayDeviceInfo()
|
||||||
|
+updateStatus()
|
||||||
|
+handleClick()
|
||||||
|
+showDetails()
|
||||||
|
}
|
||||||
|
|
||||||
|
class SystemLogPanel {
|
||||||
|
-logPanelId: String
|
||||||
|
-logLevel: String
|
||||||
|
-maxLogEntries: int
|
||||||
|
+addLogEntry()
|
||||||
|
+clearLogs()
|
||||||
|
+filterLogs()
|
||||||
|
+exportLogs()
|
||||||
|
+setLogLevel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "对话框 (Dialogs)" {
|
||||||
|
class RobotDogControlDialog {
|
||||||
|
-dialogId: String
|
||||||
|
-dogId: String
|
||||||
|
-controlMode: String
|
||||||
|
+setupControlInterface()
|
||||||
|
+sendMovementCommand()
|
||||||
|
+sendNavigationCommand()
|
||||||
|
+updateDogStatus()
|
||||||
|
+emergencyStop()
|
||||||
|
+closeDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DroneControlDialog {
|
||||||
|
-dialogId: String
|
||||||
|
-droneId: String
|
||||||
|
-flightMode: String
|
||||||
|
+setupFlightInterface()
|
||||||
|
+sendTakeoffCommand()
|
||||||
|
+sendLandingCommand()
|
||||||
|
+sendFlightCommand()
|
||||||
|
+updateDroneStatus()
|
||||||
|
+emergencyLanding()
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnemyStatsDialog {
|
||||||
|
-dialogId: String
|
||||||
|
-enemyCount: int
|
||||||
|
-threatLevel: int
|
||||||
|
+loadEnemyData()
|
||||||
|
+displayStatistics()
|
||||||
|
+updateThreatLevel()
|
||||||
|
+exportReport()
|
||||||
|
+closeDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceDialog {
|
||||||
|
-dialogId: String
|
||||||
|
-deviceId: String
|
||||||
|
-deviceType: String
|
||||||
|
+setupDeviceInterface()
|
||||||
|
+configureDevice()
|
||||||
|
+testDevice()
|
||||||
|
+updateDeviceInfo()
|
||||||
|
+saveConfiguration()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "核心业务层 (Core Business)" <<Core>> {
|
||||||
|
package "数据库管理 (Database)" <<Database>> {
|
||||||
|
class DatabaseManager {
|
||||||
|
-dbManagerId: String
|
||||||
|
-connectionStatus: String
|
||||||
|
-dbConfig: DatabaseConfig
|
||||||
|
+connectToDatabase()
|
||||||
|
+disconnectFromDatabase()
|
||||||
|
+createTables()
|
||||||
|
+executeQuery()
|
||||||
|
+beginTransaction()
|
||||||
|
+commitTransaction()
|
||||||
|
+rollbackTransaction()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseHelper {
|
||||||
|
-helperId: String
|
||||||
|
-queryBuilder: QueryBuilder
|
||||||
|
+buildSelectQuery()
|
||||||
|
+buildInsertQuery()
|
||||||
|
+buildUpdateQuery()
|
||||||
|
+buildDeleteQuery()
|
||||||
|
+executeQuery()
|
||||||
|
+handleQueryError()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseConfig {
|
||||||
|
-configId: String
|
||||||
|
-host: String
|
||||||
|
-port: int
|
||||||
|
-databaseName: String
|
||||||
|
-username: String
|
||||||
|
-password: String
|
||||||
|
+loadFromFile()
|
||||||
|
+saveToFile()
|
||||||
|
+validateConfig()
|
||||||
|
+getConnectionString()
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnemyDatabase {
|
||||||
|
-enemyDbId: String
|
||||||
|
-tableName: String
|
||||||
|
+insertEnemyTarget()
|
||||||
|
+updateEnemyTarget()
|
||||||
|
+deleteEnemyTarget()
|
||||||
|
+getEnemyTarget()
|
||||||
|
+getAllEnemyTargets()
|
||||||
|
+getEnemyTargetsByType()
|
||||||
|
+getEnemyTargetsByThreatLevel()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DogDatabase {
|
||||||
|
-dogDbId: String
|
||||||
|
-tableName: String
|
||||||
|
+insertDogStatus()
|
||||||
|
+updateDogStatus()
|
||||||
|
+getDogStatus()
|
||||||
|
+getAllDogStatus()
|
||||||
|
+insertDogLocation()
|
||||||
|
+getDogLocationHistory()
|
||||||
|
}
|
||||||
|
|
||||||
|
class UAVDatabase {
|
||||||
|
-uavDbId: String
|
||||||
|
-tableName: String
|
||||||
|
+insertUAVStatus()
|
||||||
|
+updateUAVStatus()
|
||||||
|
+getUAVStatus()
|
||||||
|
+getAllUAVStatus()
|
||||||
|
+insertUAVFlightData()
|
||||||
|
+getUAVFlightTrajectory()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "工具类 (Utils)" {
|
||||||
|
class ConfigManager {
|
||||||
|
-configManagerId: String
|
||||||
|
-configFile: String
|
||||||
|
-configData: QVariantMap
|
||||||
|
+loadConfiguration()
|
||||||
|
+saveConfiguration()
|
||||||
|
+getValue()
|
||||||
|
+setValue()
|
||||||
|
+validateConfiguration()
|
||||||
|
+reloadConfiguration()
|
||||||
|
}
|
||||||
|
|
||||||
|
class SystemLogger {
|
||||||
|
-loggerId: String
|
||||||
|
-logLevel: String
|
||||||
|
-logFile: String
|
||||||
|
+logInfo()
|
||||||
|
+logWarning()
|
||||||
|
+logError()
|
||||||
|
+logDebug()
|
||||||
|
+setLogLevel()
|
||||||
|
+setLogFile()
|
||||||
|
+rotateLogFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "AI算法层 (AI Algorithms)" <<AI>> {
|
||||||
|
class YOLODetector {
|
||||||
|
-detectorId: String
|
||||||
|
-modelPath: String
|
||||||
|
-confidenceThreshold: double
|
||||||
|
-nmsThreshold: double
|
||||||
|
-modelLoaded: boolean
|
||||||
|
+loadModel()
|
||||||
|
+detectObjects()
|
||||||
|
+classifyTargets()
|
||||||
|
+updateModel()
|
||||||
|
+setConfidenceThreshold()
|
||||||
|
+setNMSThreshold()
|
||||||
|
+getDetectionResults()
|
||||||
|
}
|
||||||
|
|
||||||
|
class TargetClassifier {
|
||||||
|
-classifierId: String
|
||||||
|
-classifierType: String
|
||||||
|
-trainingData: QList<QImage>
|
||||||
|
+trainClassifier()
|
||||||
|
+classifyTarget()
|
||||||
|
+updateClassifier()
|
||||||
|
+getClassificationResults()
|
||||||
|
+validateClassification()
|
||||||
|
}
|
||||||
|
|
||||||
|
class SLAMProcessor {
|
||||||
|
-slamId: String
|
||||||
|
-slamType: String
|
||||||
|
-mapResolution: double
|
||||||
|
-currentPose: Pose
|
||||||
|
+processSensorData()
|
||||||
|
+buildMap()
|
||||||
|
+localizePosition()
|
||||||
|
+updateMap()
|
||||||
|
+getCurrentPose()
|
||||||
|
+getMapData()
|
||||||
|
}
|
||||||
|
|
||||||
|
class PathPlanner {
|
||||||
|
-plannerId: String
|
||||||
|
-algorithmType: String
|
||||||
|
-heuristicFunction: String
|
||||||
|
-obstacleMap: QImage
|
||||||
|
+planOptimalPath()
|
||||||
|
+avoidObstacles()
|
||||||
|
+optimizeRoute()
|
||||||
|
+replanPath()
|
||||||
|
+getPathData()
|
||||||
|
+validatePath()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DataFusion {
|
||||||
|
-fusionId: String
|
||||||
|
-fusionAlgorithm: String
|
||||||
|
-weightMatrix: Matrix
|
||||||
|
-sensorData: QList<SensorData>
|
||||||
|
+fuseMultiSourceData()
|
||||||
|
+weightData()
|
||||||
|
+resolveConflicts()
|
||||||
|
+generateFusedMap()
|
||||||
|
+getFusionResults()
|
||||||
|
+updateFusionAlgorithm()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "ROS机器人控制层 (ROS Control)" <<ROS>> {
|
||||||
|
package "Unitree机器狗控制" {
|
||||||
|
class UnitreeController {
|
||||||
|
-controllerId: String
|
||||||
|
-dogId: String
|
||||||
|
-connectionStatus: String
|
||||||
|
-currentState: DogState
|
||||||
|
+connectToDog()
|
||||||
|
+disconnectFromDog()
|
||||||
|
+sendMovementCommand()
|
||||||
|
+sendNavigationCommand()
|
||||||
|
+getDogStatus()
|
||||||
|
+emergencyStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DogState {
|
||||||
|
-stateId: String
|
||||||
|
-batteryLevel: double
|
||||||
|
-currentPose: Pose
|
||||||
|
-movementStatus: String
|
||||||
|
-sensorData: SensorData
|
||||||
|
+updateState()
|
||||||
|
+getBatteryLevel()
|
||||||
|
+getCurrentPose()
|
||||||
|
+getMovementStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
class MovementCommand {
|
||||||
|
-commandId: String
|
||||||
|
-commandType: String
|
||||||
|
-targetPose: Pose
|
||||||
|
-speed: double
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+executeCommand()
|
||||||
|
+validateCommand()
|
||||||
|
+getCommandStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "ROS消息定义" {
|
||||||
|
class HighCmd {
|
||||||
|
-mode: int
|
||||||
|
-gaitType: int
|
||||||
|
-speedLevel: int
|
||||||
|
-footRaiseHeight: float
|
||||||
|
-bodyHeight: float
|
||||||
|
+serialize()
|
||||||
|
+deserialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
class HighState {
|
||||||
|
-mode: int
|
||||||
|
-gaitType: int
|
||||||
|
-footRaiseHeight: float
|
||||||
|
-bodyHeight: float
|
||||||
|
-position: Cartesian
|
||||||
|
+serialize()
|
||||||
|
+deserialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
class IMU {
|
||||||
|
-quaternion: QVector4D
|
||||||
|
-gyroscope: QVector3D
|
||||||
|
-accelerometer: QVector3D
|
||||||
|
-timestamp: QDateTime
|
||||||
|
+getQuaternion()
|
||||||
|
+getGyroscope()
|
||||||
|
+getAccelerometer()
|
||||||
|
}
|
||||||
|
|
||||||
|
class MotorState {
|
||||||
|
-motorId: int
|
||||||
|
-position: float
|
||||||
|
-velocity: float
|
||||||
|
-torque: float
|
||||||
|
-temperature: float
|
||||||
|
+getPosition()
|
||||||
|
+getVelocity()
|
||||||
|
+getTorque()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "通信层 (Communication)" {
|
||||||
|
class CommunicationManager {
|
||||||
|
-commManagerId: String
|
||||||
|
-connectionType: String
|
||||||
|
-connectionStatus: String
|
||||||
|
+establishConnection()
|
||||||
|
+closeConnection()
|
||||||
|
+sendMessage()
|
||||||
|
+receiveMessage()
|
||||||
|
+handleConnectionError()
|
||||||
|
+getConnectionStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
class NetworkProtocol {
|
||||||
|
-protocolId: String
|
||||||
|
-protocolType: String
|
||||||
|
-port: int
|
||||||
|
-timeout: int
|
||||||
|
+encodeMessage()
|
||||||
|
+decodeMessage()
|
||||||
|
+validateMessage()
|
||||||
|
+handleProtocolError()
|
||||||
|
}
|
||||||
|
|
||||||
|
class DataTransmission {
|
||||||
|
-transmissionId: String
|
||||||
|
-dataType: String
|
||||||
|
-compressionEnabled: boolean
|
||||||
|
-encryptionEnabled: boolean
|
||||||
|
+transmitData()
|
||||||
|
+receiveData()
|
||||||
|
+compressData()
|
||||||
|
+decompressData()
|
||||||
|
+encryptData()
|
||||||
|
+decryptData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package "任务控制层 (Mission Control)" {
|
||||||
|
class MissionController {
|
||||||
|
-missionId: String
|
||||||
|
-missionType: String
|
||||||
|
-priority: int
|
||||||
|
-status: String
|
||||||
|
-startTime: QDateTime
|
||||||
|
+createMission()
|
||||||
|
+assignTasks()
|
||||||
|
+monitorProgress()
|
||||||
|
+handleEmergency()
|
||||||
|
+generateReport()
|
||||||
|
+abortMission()
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaskScheduler {
|
||||||
|
-schedulerId: String
|
||||||
|
-taskQueue: QQueue<Task>
|
||||||
|
-schedulingAlgorithm: String
|
||||||
|
+addTask()
|
||||||
|
+removeTask()
|
||||||
|
+scheduleTasks()
|
||||||
|
+getNextTask()
|
||||||
|
+updateTaskStatus()
|
||||||
|
+optimizeSchedule()
|
||||||
|
}
|
||||||
|
|
||||||
|
class CoordinationController {
|
||||||
|
-coordinationId: String
|
||||||
|
-coordinationType: String
|
||||||
|
-deviceList: QList<Device>
|
||||||
|
+coordinatePlatforms()
|
||||||
|
+optimizeTaskAllocation()
|
||||||
|
+resolveConflicts()
|
||||||
|
+maintainFormation()
|
||||||
|
+getCoordinationStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
' 关系定义
|
||||||
|
MainWindow ||--o{ UIInitializationManager : 使用
|
||||||
|
MainWindow ||--o{ RightFunctionPanel : 包含
|
||||||
|
MainWindow ||--o{ DeviceListPanel : 包含
|
||||||
|
MainWindow ||--o{ SystemLogPanel : 包含
|
||||||
|
|
||||||
|
DeviceListPanel ||--o{ DeviceCard : 包含
|
||||||
|
MainWindow ||--o{ RobotDogControlDialog : 打开
|
||||||
|
MainWindow ||--o{ DroneControlDialog : 打开
|
||||||
|
MainWindow ||--o{ EnemyStatsDialog : 打开
|
||||||
|
MainWindow ||--o{ DeviceDialog : 打开
|
||||||
|
|
||||||
|
UIInitializationManager ||--o{ DatabaseManager : 初始化
|
||||||
|
UIInitializationManager ||--o{ ConfigManager : 配置
|
||||||
|
|
||||||
|
DatabaseManager ||--o{ DatabaseHelper : 使用
|
||||||
|
DatabaseManager ||--o{ DatabaseConfig : 配置
|
||||||
|
DatabaseManager ||--o{ EnemyDatabase : 管理
|
||||||
|
DatabaseManager ||--o{ DogDatabase : 管理
|
||||||
|
DatabaseManager ||--o{ UAVDatabase : 管理
|
||||||
|
|
||||||
|
RobotDogControlDialog ||--o{ UnitreeController : 控制
|
||||||
|
DroneControlDialog ||--o{ CommunicationManager : 通信
|
||||||
|
|
||||||
|
UnitreeController ||--o{ DogState : 监控
|
||||||
|
UnitreeController ||--o{ MovementCommand : 发送
|
||||||
|
UnitreeController ||--o{ HighCmd : 发送
|
||||||
|
UnitreeController ||--o{ HighState : 接收
|
||||||
|
UnitreeController ||--o{ IMU : 接收
|
||||||
|
UnitreeController ||--o{ MotorState : 接收
|
||||||
|
|
||||||
|
YOLODetector ||--o{ TargetClassifier : 使用
|
||||||
|
SLAMProcessor ||--o{ PathPlanner : 提供地图
|
||||||
|
DataFusion ||--o{ YOLODetector : 融合数据
|
||||||
|
DataFusion ||--o{ SLAMProcessor : 融合数据
|
||||||
|
|
||||||
|
MissionController ||--o{ TaskScheduler : 使用
|
||||||
|
MissionController ||--o{ CoordinationController : 使用
|
||||||
|
TaskScheduler ||--o{ UnitreeController : 调度
|
||||||
|
TaskScheduler ||--o{ CommunicationManager : 调度
|
||||||
|
|
||||||
|
CommunicationManager ||--o{ NetworkProtocol : 使用
|
||||||
|
CommunicationManager ||--o{ DataTransmission : 使用
|
||||||
|
|
||||||
|
SystemLogger ||--o{ MainWindow : 记录
|
||||||
|
ConfigManager ||--o{ MainWindow : 配置
|
||||||
|
|
||||||
|
@enduml
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,153 @@
|
|||||||
|
#ifndef TESTCONFIG_H
|
||||||
|
#define TESTCONFIG_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
// 测试配置常量
|
||||||
|
namespace TestConfig {
|
||||||
|
// 测试数据库配置
|
||||||
|
const QString TEST_DB_HOST = "localhost";
|
||||||
|
const int TEST_DB_PORT = 3306;
|
||||||
|
const QString TEST_DB_NAME = "test_battlefield_exploration";
|
||||||
|
const QString TEST_DB_USER = "test_user";
|
||||||
|
const QString TEST_DB_PASSWORD = "test_password";
|
||||||
|
|
||||||
|
// 测试文件路径
|
||||||
|
const QString TEST_DATA_DIR = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/battlefield_test_data";
|
||||||
|
const QString TEST_IMAGES_DIR = TEST_DATA_DIR + "/images";
|
||||||
|
const QString TEST_VIDEOS_DIR = TEST_DATA_DIR + "/videos";
|
||||||
|
const QString TEST_MAPS_DIR = TEST_DATA_DIR + "/maps";
|
||||||
|
const QString TEST_LOGS_DIR = TEST_DATA_DIR + "/logs";
|
||||||
|
|
||||||
|
// 测试图像配置
|
||||||
|
const int TEST_IMAGE_WIDTH = 640;
|
||||||
|
const int TEST_IMAGE_HEIGHT = 480;
|
||||||
|
const QString TEST_IMAGE_FORMAT = "PNG";
|
||||||
|
|
||||||
|
// 测试视频配置
|
||||||
|
const int TEST_VIDEO_FPS = 30;
|
||||||
|
const int TEST_VIDEO_DURATION = 10; // 秒
|
||||||
|
|
||||||
|
// 测试地图配置
|
||||||
|
const double TEST_MAP_WIDTH = 100.0; // 米
|
||||||
|
const double TEST_MAP_HEIGHT = 100.0; // 米
|
||||||
|
const double TEST_MAP_RESOLUTION = 0.1; // 米/像素
|
||||||
|
|
||||||
|
// 测试设备配置
|
||||||
|
const QString TEST_DRONE_ID = "TEST_DRONE_001";
|
||||||
|
const QString TEST_DOG_ID = "TEST_DOG_001";
|
||||||
|
const QString TEST_SENSOR_ID = "TEST_SENSOR_001";
|
||||||
|
|
||||||
|
// 测试目标配置
|
||||||
|
const QString TEST_ENEMY_ID = "TEST_ENEMY_001";
|
||||||
|
const QString TEST_TARGET_TYPE = "TANK";
|
||||||
|
const double TEST_THREAT_LEVEL = 8.0;
|
||||||
|
const double TEST_CONFIDENCE = 0.95;
|
||||||
|
|
||||||
|
// 测试位置配置
|
||||||
|
const double TEST_START_X = 0.0;
|
||||||
|
const double TEST_START_Y = 0.0;
|
||||||
|
const double TEST_START_Z = 0.0;
|
||||||
|
const double TEST_END_X = 50.0;
|
||||||
|
const double TEST_END_Y = 50.0;
|
||||||
|
const double TEST_END_Z = 0.0;
|
||||||
|
|
||||||
|
// 测试时间配置
|
||||||
|
const int TEST_TIMEOUT_MS = 5000;
|
||||||
|
const int TEST_INTERVAL_MS = 100;
|
||||||
|
const int TEST_DURATION_MS = 10000;
|
||||||
|
|
||||||
|
// 测试性能阈值
|
||||||
|
const double MAX_DETECTION_LATENCY_MS = 100.0;
|
||||||
|
const double MAX_NAVIGATION_ERROR_M = 0.5;
|
||||||
|
const double MAX_FUSION_ERROR = 0.1;
|
||||||
|
const double MIN_DETECTION_ACCURACY = 0.8;
|
||||||
|
|
||||||
|
// 测试网络配置
|
||||||
|
const QString TEST_SERVER_HOST = "127.0.0.1";
|
||||||
|
const int TEST_SERVER_PORT = 8080;
|
||||||
|
const int TEST_CLIENT_PORT = 8081;
|
||||||
|
|
||||||
|
// 测试加密配置
|
||||||
|
const QString TEST_ENCRYPTION_KEY = "test_encryption_key_12345";
|
||||||
|
const QString TEST_IV = "test_iv_12345678";
|
||||||
|
|
||||||
|
// 测试日志配置
|
||||||
|
const QString TEST_LOG_LEVEL = "DEBUG";
|
||||||
|
const bool TEST_LOG_TO_FILE = true;
|
||||||
|
const bool TEST_LOG_TO_CONSOLE = true;
|
||||||
|
|
||||||
|
// 测试模式配置
|
||||||
|
const bool TEST_SIMULATION_MODE = true;
|
||||||
|
const bool TEST_REAL_DEVICE_MODE = false;
|
||||||
|
const bool TEST_DEBUG_MODE = true;
|
||||||
|
|
||||||
|
// 测试数据生成配置
|
||||||
|
const int NUM_TEST_IMAGES = 100;
|
||||||
|
const int NUM_TEST_TARGETS = 50;
|
||||||
|
const int NUM_TEST_WAYPOINTS = 20;
|
||||||
|
const int NUM_TEST_OBSTACLES = 10;
|
||||||
|
|
||||||
|
// 测试场景配置
|
||||||
|
enum TestScenario {
|
||||||
|
SCENARIO_URBAN_COMBAT,
|
||||||
|
SCENARIO_OPEN_FIELD,
|
||||||
|
SCENARIO_FOREST,
|
||||||
|
SCENARIO_UNDERGROUND,
|
||||||
|
SCENARIO_MIXED_ENVIRONMENT
|
||||||
|
};
|
||||||
|
|
||||||
|
// 测试环境配置
|
||||||
|
enum TestEnvironment {
|
||||||
|
ENV_DAYLIGHT,
|
||||||
|
ENV_NIGHT,
|
||||||
|
ENV_RAIN,
|
||||||
|
ENV_FOG,
|
||||||
|
ENV_DUST
|
||||||
|
};
|
||||||
|
|
||||||
|
// 测试难度配置
|
||||||
|
enum TestDifficulty {
|
||||||
|
DIFFICULTY_EASY,
|
||||||
|
DIFFICULTY_MEDIUM,
|
||||||
|
DIFFICULTY_HARD,
|
||||||
|
DIFFICULTY_EXTREME
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 测试工具函数
|
||||||
|
namespace TestUtils {
|
||||||
|
// 创建测试目录
|
||||||
|
bool createTestDirectories();
|
||||||
|
|
||||||
|
// 清理测试数据
|
||||||
|
void cleanupTestData();
|
||||||
|
|
||||||
|
// 生成测试图像
|
||||||
|
QString generateTestImage(const QString& filename, int width = TestConfig::TEST_IMAGE_WIDTH, int height = TestConfig::TEST_IMAGE_HEIGHT);
|
||||||
|
|
||||||
|
// 生成测试视频
|
||||||
|
QString generateTestVideo(const QString& filename, int duration = TestConfig::TEST_VIDEO_DURATION);
|
||||||
|
|
||||||
|
// 生成测试地图
|
||||||
|
QString generateTestMap(const QString& filename);
|
||||||
|
|
||||||
|
// 生成测试传感器数据
|
||||||
|
QByteArray generateTestSensorData();
|
||||||
|
|
||||||
|
// 生成测试目标数据
|
||||||
|
QByteArray generateTestTargetData();
|
||||||
|
|
||||||
|
// 验证测试结果
|
||||||
|
bool verifyTestResult(const QString& testName, bool result, const QString& message = "");
|
||||||
|
|
||||||
|
// 记录测试日志
|
||||||
|
void logTestResult(const QString& testName, bool passed, const QString& details = "");
|
||||||
|
|
||||||
|
// 计算测试统计
|
||||||
|
void calculateTestStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TESTCONFIG_H
|
@ -0,0 +1,105 @@
|
|||||||
|
#ifndef TESTDATAFUSION_H
|
||||||
|
#define TESTDATAFUSION_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QVector3D>
|
||||||
|
#include <QMatrix4x4>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/core/DataFusion.h"
|
||||||
|
#include "../include/core/SensorFusion.h"
|
||||||
|
#include "../include/core/KalmanFilter.h"
|
||||||
|
|
||||||
|
class TestDataFusion : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// 数据融合初始化测试
|
||||||
|
void testDataFusionInitialization();
|
||||||
|
void testSensorRegistration();
|
||||||
|
void testCoordinateTransformation();
|
||||||
|
void testFusionAlgorithmSetup();
|
||||||
|
|
||||||
|
// 多源数据融合测试
|
||||||
|
void testMultiSensorFusion();
|
||||||
|
void testTemporalFusion();
|
||||||
|
void testSpatialFusion();
|
||||||
|
void testFeatureFusion();
|
||||||
|
|
||||||
|
// 传感器数据融合测试
|
||||||
|
void testLidarCameraFusion();
|
||||||
|
void testIMUGPSFusion();
|
||||||
|
void testRadarLidarFusion();
|
||||||
|
void testOpticalInfraredFusion();
|
||||||
|
|
||||||
|
// 目标跟踪融合测试
|
||||||
|
void testTargetTrackingFusion();
|
||||||
|
void testMultiTargetTracking();
|
||||||
|
void testTrackAssociation();
|
||||||
|
void testTrackPrediction();
|
||||||
|
|
||||||
|
// 地图融合测试
|
||||||
|
void testMapFusion();
|
||||||
|
void testOccupancyGridFusion();
|
||||||
|
void testFeatureMapFusion();
|
||||||
|
void testSemanticMapFusion();
|
||||||
|
|
||||||
|
// 态势感知融合测试
|
||||||
|
void testSituationalAwareness();
|
||||||
|
void testThreatAssessment();
|
||||||
|
void testRiskEvaluation();
|
||||||
|
void testDecisionSupport();
|
||||||
|
|
||||||
|
// 数据质量测试
|
||||||
|
void testDataQualityAssessment();
|
||||||
|
void testOutlierDetection();
|
||||||
|
void testNoiseFiltering();
|
||||||
|
void testDataValidation();
|
||||||
|
|
||||||
|
// 性能测试
|
||||||
|
void testFusionSpeed();
|
||||||
|
void testMemoryUsage();
|
||||||
|
void testRealTimePerformance();
|
||||||
|
void testScalability();
|
||||||
|
|
||||||
|
// 鲁棒性测试
|
||||||
|
void testSensorFailureHandling();
|
||||||
|
void testDataLossHandling();
|
||||||
|
void testInconsistentDataHandling();
|
||||||
|
void testDynamicSensorConfiguration();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DataFusion* m_dataFusion;
|
||||||
|
SensorFusion* m_sensorFusion;
|
||||||
|
KalmanFilter* m_kalmanFilter;
|
||||||
|
|
||||||
|
// 测试数据
|
||||||
|
QList<SensorData> m_testSensorData;
|
||||||
|
QList<TargetData> m_testTargetData;
|
||||||
|
QList<MapData> m_testMapData;
|
||||||
|
|
||||||
|
// 测试数据准备
|
||||||
|
void prepareTestSensorData();
|
||||||
|
void prepareTestTargetData();
|
||||||
|
void prepareTestMapData();
|
||||||
|
void cleanupTestData();
|
||||||
|
|
||||||
|
// 测试辅助函数
|
||||||
|
bool verifyFusionResult(const FusionResult& result);
|
||||||
|
double calculateFusionAccuracy(const QList<FusionResult>& results);
|
||||||
|
bool verifyDataConsistency(const QList<SensorData>& data);
|
||||||
|
void simulateFusionScenario(const QString& scenario);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTDATAFUSION_H
|
@ -0,0 +1,69 @@
|
|||||||
|
#ifndef TESTDATABASEMANAGER_H
|
||||||
|
#define TESTDATABASEMANAGER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QSqlDatabase>
|
||||||
|
#include <QSqlQuery>
|
||||||
|
#include <QSqlError>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/core/database/DatabaseManager.h"
|
||||||
|
#include "../include/core/database/EnemyDatabase.h"
|
||||||
|
#include "../include/core/database/DogDatabase.h"
|
||||||
|
#include "../include/core/database/UAVDatabase.h"
|
||||||
|
|
||||||
|
class TestDatabaseManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// 数据库连接测试
|
||||||
|
void testDatabaseConnection();
|
||||||
|
void testDatabaseCreation();
|
||||||
|
void testDatabaseConfig();
|
||||||
|
|
||||||
|
// 敌方数据库测试
|
||||||
|
void testEnemyDatabaseOperations();
|
||||||
|
void testEnemyDataInsertion();
|
||||||
|
void testEnemyDataQuery();
|
||||||
|
void testEnemyDataUpdate();
|
||||||
|
void testEnemyDataDeletion();
|
||||||
|
|
||||||
|
// 机器狗数据库测试
|
||||||
|
void testDogDatabaseOperations();
|
||||||
|
void testDogStatusUpdate();
|
||||||
|
void testDogLocationTracking();
|
||||||
|
|
||||||
|
// 无人机数据库测试
|
||||||
|
void testUAVDatabaseOperations();
|
||||||
|
void testUAVStatusUpdate();
|
||||||
|
void testUAVFlightData();
|
||||||
|
|
||||||
|
// 数据库性能测试
|
||||||
|
void testDatabasePerformance();
|
||||||
|
void testConcurrentAccess();
|
||||||
|
void testDataIntegrity();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DatabaseManager* m_dbManager;
|
||||||
|
EnemyDatabase* m_enemyDb;
|
||||||
|
DogDatabase* m_dogDb;
|
||||||
|
UAVDatabase* m_uavDb;
|
||||||
|
|
||||||
|
// 测试数据
|
||||||
|
void createTestData();
|
||||||
|
void cleanupTestData();
|
||||||
|
bool verifyTestData();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTDATABASEMANAGER_H
|
@ -0,0 +1,76 @@
|
|||||||
|
#ifndef TESTDEVICECONTROL_H
|
||||||
|
#define TESTDEVICECONTROL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QSignalSpy>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/ui/dialogs/RobotDogControlDialog.h"
|
||||||
|
#include "../include/ui/dialogs/DroneControlDialog.h"
|
||||||
|
#include "../include/ui/components/DeviceListPanel.h"
|
||||||
|
|
||||||
|
class TestDeviceControl : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// 机器狗控制测试
|
||||||
|
void testRobotDogInitialization();
|
||||||
|
void testRobotDogMovement();
|
||||||
|
void testRobotDogNavigation();
|
||||||
|
void testRobotDogStatusMonitoring();
|
||||||
|
void testRobotDogEmergencyStop();
|
||||||
|
|
||||||
|
// 无人机控制测试
|
||||||
|
void testDroneInitialization();
|
||||||
|
void testDroneTakeoff();
|
||||||
|
void testDroneFlight();
|
||||||
|
void testDroneLanding();
|
||||||
|
void testDroneStatusMonitoring();
|
||||||
|
void testDroneEmergencyLanding();
|
||||||
|
|
||||||
|
// 设备列表管理测试
|
||||||
|
void testDeviceListManagement();
|
||||||
|
void testDeviceConnection();
|
||||||
|
void testDeviceDisconnection();
|
||||||
|
void testDeviceStatusUpdate();
|
||||||
|
|
||||||
|
// 协同控制测试
|
||||||
|
void testCoordinatedMovement();
|
||||||
|
void testFormationControl();
|
||||||
|
void testTaskAllocation();
|
||||||
|
void testConflictResolution();
|
||||||
|
|
||||||
|
// 通信测试
|
||||||
|
void testDeviceCommunication();
|
||||||
|
void testCommandTransmission();
|
||||||
|
void testStatusFeedback();
|
||||||
|
void testErrorHandling();
|
||||||
|
|
||||||
|
// 性能测试
|
||||||
|
void testControlLatency();
|
||||||
|
void testResponseTime();
|
||||||
|
void testConcurrentControl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
RobotDogControlDialog* m_robotDogDialog;
|
||||||
|
DroneControlDialog* m_droneDialog;
|
||||||
|
DeviceListPanel* m_deviceListPanel;
|
||||||
|
|
||||||
|
// 模拟设备状态
|
||||||
|
void simulateDeviceStatus();
|
||||||
|
void simulateCommunicationDelay();
|
||||||
|
bool verifyDeviceResponse();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTDEVICECONTROL_H
|
@ -0,0 +1,69 @@
|
|||||||
|
#include <QApplication>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
// 测试模块头文件
|
||||||
|
#include "TestDatabaseManager.h"
|
||||||
|
#include "TestDeviceControl.h"
|
||||||
|
#include "TestYOLODetector.h"
|
||||||
|
#include "TestSLAMProcessor.h"
|
||||||
|
#include "TestDataFusion.h"
|
||||||
|
#include "TestCommunication.h"
|
||||||
|
#include "TestMissionController.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
qDebug() << "=== 基于空地协同的战场环境探索系统 - 测试套件 ===";
|
||||||
|
qDebug() << "开始执行测试...";
|
||||||
|
|
||||||
|
int testResult = 0;
|
||||||
|
|
||||||
|
// 1. 数据库管理测试
|
||||||
|
qDebug() << "\n--- 执行数据库管理测试 ---";
|
||||||
|
TestDatabaseManager dbTest;
|
||||||
|
testResult += QTest::qExec(&dbTest, argc, argv);
|
||||||
|
|
||||||
|
// 2. 设备控制测试
|
||||||
|
qDebug() << "\n--- 执行设备控制测试 ---";
|
||||||
|
TestDeviceControl deviceTest;
|
||||||
|
testResult += QTest::qExec(&deviceTest, argc, argv);
|
||||||
|
|
||||||
|
// 3. YOLO检测器测试
|
||||||
|
qDebug() << "\n--- 执行YOLO检测器测试 ---";
|
||||||
|
TestYOLODetector yoloTest;
|
||||||
|
testResult += QTest::qExec(&yoloTest, argc, argv);
|
||||||
|
|
||||||
|
// 4. SLAM处理器测试
|
||||||
|
qDebug() << "\n--- 执行SLAM处理器测试 ---";
|
||||||
|
TestSLAMProcessor slamTest;
|
||||||
|
testResult += QTest::qExec(&slamTest, argc, argv);
|
||||||
|
|
||||||
|
// 5. 数据融合测试
|
||||||
|
qDebug() << "\n--- 执行数据融合测试 ---";
|
||||||
|
TestDataFusion fusionTest;
|
||||||
|
testResult += QTest::qExec(&fusionTest, argc, argv);
|
||||||
|
|
||||||
|
// 6. 通信模块测试
|
||||||
|
qDebug() << "\n--- 执行通信模块测试 ---";
|
||||||
|
TestCommunication commTest;
|
||||||
|
testResult += QTest::qExec(&commTest, argc, argv);
|
||||||
|
|
||||||
|
// 7. 任务控制器测试
|
||||||
|
qDebug() << "\n--- 执行任务控制器测试 ---";
|
||||||
|
TestMissionController missionTest;
|
||||||
|
testResult += QTest::qExec(&missionTest, argc, argv);
|
||||||
|
|
||||||
|
// 测试结果汇总
|
||||||
|
qDebug() << "\n=== 测试结果汇总 ===";
|
||||||
|
if (testResult == 0) {
|
||||||
|
qDebug() << "✅ 所有测试通过!";
|
||||||
|
} else {
|
||||||
|
qDebug() << "❌ 有" << testResult << "个测试失败";
|
||||||
|
}
|
||||||
|
|
||||||
|
return testResult;
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
#ifndef TESTMISSIONCONTROLLER_H
|
||||||
|
#define TESTMISSIONCONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QSignalSpy>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/core/MissionController.h"
|
||||||
|
#include "../include/core/TaskScheduler.h"
|
||||||
|
#include "../include/core/CoordinationController.h"
|
||||||
|
|
||||||
|
class TestMissionController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// 任务管理测试
|
||||||
|
void testMissionCreation();
|
||||||
|
void testMissionPlanning();
|
||||||
|
void testMissionExecution();
|
||||||
|
void testMissionMonitoring();
|
||||||
|
|
||||||
|
// 任务调度测试
|
||||||
|
void testTaskScheduling();
|
||||||
|
void testTaskAllocation();
|
||||||
|
void testTaskPrioritization();
|
||||||
|
void testTaskDependencies();
|
||||||
|
|
||||||
|
// 协同控制测试
|
||||||
|
void testCoordinatedControl();
|
||||||
|
void testFormationControl();
|
||||||
|
void testConflictResolution();
|
||||||
|
void testResourceSharing();
|
||||||
|
|
||||||
|
// 任务执行测试
|
||||||
|
void testExplorationMission();
|
||||||
|
void testSurveillanceMission();
|
||||||
|
void testReconnaissanceMission();
|
||||||
|
void testIntelligenceGatheringMission();
|
||||||
|
|
||||||
|
// 状态管理测试
|
||||||
|
void testMissionStateManagement();
|
||||||
|
void testDeviceStateTracking();
|
||||||
|
void testSystemHealthMonitoring();
|
||||||
|
void testPerformanceMetrics();
|
||||||
|
|
||||||
|
// 异常处理测试
|
||||||
|
void testMissionAbort();
|
||||||
|
void testDeviceFailureHandling();
|
||||||
|
void testEmergencyResponse();
|
||||||
|
void testRecoveryProcedures();
|
||||||
|
|
||||||
|
// 性能测试
|
||||||
|
void testMissionExecutionSpeed();
|
||||||
|
void testResourceUtilization();
|
||||||
|
void testConcurrentMissions();
|
||||||
|
void testScalability();
|
||||||
|
|
||||||
|
// 集成测试
|
||||||
|
void testEndToEndMission();
|
||||||
|
void testMultiDeviceIntegration();
|
||||||
|
void testSystemIntegration();
|
||||||
|
void testUserInterfaceIntegration();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MissionController* m_missionController;
|
||||||
|
TaskScheduler* m_taskScheduler;
|
||||||
|
CoordinationController* m_coordinationController;
|
||||||
|
|
||||||
|
// 测试数据
|
||||||
|
QList<Mission> m_testMissions;
|
||||||
|
QList<Task> m_testTasks;
|
||||||
|
|
||||||
|
// 测试数据准备
|
||||||
|
void prepareTestMissions();
|
||||||
|
void prepareTestTasks();
|
||||||
|
void cleanupTestData();
|
||||||
|
|
||||||
|
// 测试辅助函数
|
||||||
|
bool verifyMissionExecution(const Mission& mission);
|
||||||
|
double calculateMissionSuccessRate(const QList<Mission>& missions);
|
||||||
|
bool verifyTaskCompletion(const Task& task);
|
||||||
|
void simulateMissionScenario(const QString& scenario);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTMISSIONCONTROLLER_H
|
@ -0,0 +1,105 @@
|
|||||||
|
#ifndef TESTSLAMPROCESSOR_H
|
||||||
|
#define TESTSLAMPROCESSOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QVector3D>
|
||||||
|
#include <QMatrix4x4>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/core/SLAMProcessor.h"
|
||||||
|
#include "../include/core/PathPlanner.h"
|
||||||
|
#include "../include/core/MapBuilder.h"
|
||||||
|
|
||||||
|
class TestSLAMProcessor : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// SLAM初始化测试
|
||||||
|
void testSLAMInitialization();
|
||||||
|
void testSensorCalibration();
|
||||||
|
void testCoordinateSystemSetup();
|
||||||
|
void testParameterConfiguration();
|
||||||
|
|
||||||
|
// 传感器数据处理测试
|
||||||
|
void testLidarDataProcessing();
|
||||||
|
void testIMUDataProcessing();
|
||||||
|
void testCameraDataProcessing();
|
||||||
|
void testMultiSensorFusion();
|
||||||
|
|
||||||
|
// 定位测试
|
||||||
|
void testLocalization();
|
||||||
|
void testPoseEstimation();
|
||||||
|
void testPositionTracking();
|
||||||
|
void testOrientationEstimation();
|
||||||
|
|
||||||
|
// 建图测试
|
||||||
|
void testMapBuilding();
|
||||||
|
void testOccupancyGridGeneration();
|
||||||
|
void testFeatureExtraction();
|
||||||
|
void testLoopClosureDetection();
|
||||||
|
|
||||||
|
// 路径规划测试
|
||||||
|
void testPathPlanning();
|
||||||
|
void testObstacleAvoidance();
|
||||||
|
void testGlobalPathPlanning();
|
||||||
|
void testLocalPathPlanning();
|
||||||
|
|
||||||
|
// 导航测试
|
||||||
|
void testNavigation();
|
||||||
|
void testWaypointFollowing();
|
||||||
|
void testDynamicObstacleAvoidance();
|
||||||
|
void testNavigationAccuracy();
|
||||||
|
|
||||||
|
// 地图管理测试
|
||||||
|
void testMapLoading();
|
||||||
|
void testMapSaving();
|
||||||
|
void testMapUpdating();
|
||||||
|
void testMapOptimization();
|
||||||
|
|
||||||
|
// 性能测试
|
||||||
|
void testProcessingSpeed();
|
||||||
|
void testMemoryEfficiency();
|
||||||
|
void testRealTimePerformance();
|
||||||
|
void testScalability();
|
||||||
|
|
||||||
|
// 鲁棒性测试
|
||||||
|
void testSensorFailureHandling();
|
||||||
|
void testNoiseRobustness();
|
||||||
|
void testDynamicEnvironment();
|
||||||
|
void testLongTermOperation();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SLAMProcessor* m_slamProcessor;
|
||||||
|
PathPlanner* m_pathPlanner;
|
||||||
|
MapBuilder* m_mapBuilder;
|
||||||
|
|
||||||
|
// 测试数据
|
||||||
|
QList<SensorData> m_testSensorData;
|
||||||
|
QList<QVector3D> m_testTrajectory;
|
||||||
|
QList<Obstacle> m_testObstacles;
|
||||||
|
|
||||||
|
// 测试数据准备
|
||||||
|
void prepareTestSensorData();
|
||||||
|
void generateSyntheticTrajectory();
|
||||||
|
void createTestEnvironment();
|
||||||
|
void cleanupTestData();
|
||||||
|
|
||||||
|
// 测试辅助函数
|
||||||
|
bool verifyPoseEstimation(const Pose& estimated, const Pose& groundTruth);
|
||||||
|
double calculateLocalizationAccuracy(const QList<Pose>& estimated, const QList<Pose>& groundTruth);
|
||||||
|
bool verifyPathFeasibility(const QList<QVector3D>& path);
|
||||||
|
void simulateNavigationScenario(const QString& scenario);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTSLAMPROCESSOR_H
|
@ -0,0 +1,95 @@
|
|||||||
|
#ifndef TESTYOLODETECTOR_H
|
||||||
|
#define TESTYOLODETECTOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTest>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
|
// 包含被测试的类
|
||||||
|
#include "../include/core/YOLODetector.h"
|
||||||
|
#include "../include/core/TargetClassifier.h"
|
||||||
|
|
||||||
|
class TestYOLODetector : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 初始化测试环境
|
||||||
|
void initTestCase();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
// 模型加载测试
|
||||||
|
void testModelLoading();
|
||||||
|
void testModelValidation();
|
||||||
|
void testModelPerformance();
|
||||||
|
|
||||||
|
// 目标检测测试
|
||||||
|
void testObjectDetection();
|
||||||
|
void testTargetClassification();
|
||||||
|
void testConfidenceScoring();
|
||||||
|
void testBoundingBoxAccuracy();
|
||||||
|
|
||||||
|
// 图像处理测试
|
||||||
|
void testImagePreprocessing();
|
||||||
|
void testImageResizing();
|
||||||
|
void testImageNormalization();
|
||||||
|
void testBatchProcessing();
|
||||||
|
|
||||||
|
// 特定目标检测测试
|
||||||
|
void testMilitaryVehicleDetection();
|
||||||
|
void testPersonDetection();
|
||||||
|
void testWeaponDetection();
|
||||||
|
void testBuildingDetection();
|
||||||
|
|
||||||
|
// 实时检测测试
|
||||||
|
void testRealTimeDetection();
|
||||||
|
void testVideoStreamProcessing();
|
||||||
|
void testDetectionLatency();
|
||||||
|
void testDetectionAccuracy();
|
||||||
|
|
||||||
|
// 多目标检测测试
|
||||||
|
void testMultipleObjectDetection();
|
||||||
|
void testObjectTracking();
|
||||||
|
void testOcclusionHandling();
|
||||||
|
void testSmallObjectDetection();
|
||||||
|
|
||||||
|
// 环境适应性测试
|
||||||
|
void testLightingConditions();
|
||||||
|
void testWeatherConditions();
|
||||||
|
void testDistanceVariation();
|
||||||
|
void testAngleVariation();
|
||||||
|
|
||||||
|
// 性能优化测试
|
||||||
|
void testDetectionSpeed();
|
||||||
|
void testMemoryUsage();
|
||||||
|
void testGPUAcceleration();
|
||||||
|
void testModelOptimization();
|
||||||
|
|
||||||
|
private:
|
||||||
|
YOLODetector* m_yoloDetector;
|
||||||
|
TargetClassifier* m_targetClassifier;
|
||||||
|
|
||||||
|
// 测试图像
|
||||||
|
QList<QImage> m_testImages;
|
||||||
|
QList<QString> m_testImagePaths;
|
||||||
|
|
||||||
|
// 测试数据准备
|
||||||
|
void prepareTestImages();
|
||||||
|
void createSyntheticTestImages();
|
||||||
|
void loadRealTestImages();
|
||||||
|
void cleanupTestImages();
|
||||||
|
|
||||||
|
// 测试辅助函数
|
||||||
|
bool verifyDetectionResult(const DetectionResult& result);
|
||||||
|
double calculateDetectionAccuracy(const QList<DetectionResult>& results);
|
||||||
|
void simulateDetectionScenario(const QString& scenario);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTYOLODETECTOR_H
|
@ -0,0 +1,212 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 基于空地协同的战场环境探索系统 - 测试运行脚本
|
||||||
|
# 作者: 系统开发团队
|
||||||
|
# 日期: 2024年
|
||||||
|
|
||||||
|
echo "=========================================="
|
||||||
|
echo "基于空地协同的战场环境探索系统 - 测试套件"
|
||||||
|
echo "=========================================="
|
||||||
|
|
||||||
|
# 设置环境变量
|
||||||
|
export QT_QPA_PLATFORM=offscreen
|
||||||
|
export QT_LOGGING_RULES="*.debug=true;qt.qpa.*=false"
|
||||||
|
|
||||||
|
# 测试配置
|
||||||
|
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
BUILD_DIR="$TEST_DIR/../build"
|
||||||
|
BIN_DIR="$BUILD_DIR/bin"
|
||||||
|
LOG_DIR="$TEST_DIR/logs"
|
||||||
|
REPORT_DIR="$TEST_DIR/reports"
|
||||||
|
|
||||||
|
# 创建必要的目录
|
||||||
|
mkdir -p "$LOG_DIR"
|
||||||
|
mkdir -p "$REPORT_DIR"
|
||||||
|
|
||||||
|
# 测试时间戳
|
||||||
|
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
||||||
|
LOG_FILE="$LOG_DIR/test_run_$TIMESTAMP.log"
|
||||||
|
REPORT_FILE="$REPORT_DIR/test_report_$TIMESTAMP.html"
|
||||||
|
|
||||||
|
echo "测试开始时间: $(date)"
|
||||||
|
echo "日志文件: $LOG_FILE"
|
||||||
|
echo "报告文件: $REPORT_FILE"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 检查构建目录
|
||||||
|
if [ ! -d "$BUILD_DIR" ]; then
|
||||||
|
echo "❌ 错误: 构建目录不存在,请先编译项目"
|
||||||
|
echo "运行: cd $BUILD_DIR && make"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 检查可执行文件
|
||||||
|
TEST_EXECUTABLE="$BIN_DIR/TestMain"
|
||||||
|
if [ ! -f "$TEST_EXECUTABLE" ]; then
|
||||||
|
echo "❌ 错误: 测试可执行文件不存在: $TEST_EXECUTABLE"
|
||||||
|
echo "请先编译测试程序"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 函数:运行单个测试模块
|
||||||
|
run_test_module() {
|
||||||
|
local module_name="$1"
|
||||||
|
local test_args="$2"
|
||||||
|
|
||||||
|
echo "🧪 运行 $module_name 测试..."
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
||||||
|
# 运行测试并捕获输出
|
||||||
|
if [ -n "$test_args" ]; then
|
||||||
|
"$TEST_EXECUTABLE" $test_args 2>&1 | tee -a "$LOG_FILE"
|
||||||
|
else
|
||||||
|
"$TEST_EXECUTABLE" 2>&1 | tee -a "$LOG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local exit_code=${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
if [ $exit_code -eq 0 ]; then
|
||||||
|
echo "✅ $module_name 测试通过"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "❌ $module_name 测试失败 (退出码: $exit_code)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 函数:生成测试报告
|
||||||
|
generate_test_report() {
|
||||||
|
echo "📊 生成测试报告..."
|
||||||
|
|
||||||
|
cat > "$REPORT_FILE" << EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>战场环境探索系统 - 测试报告</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; margin: 20px; }
|
||||||
|
.header { background-color: #f0f0f0; padding: 20px; border-radius: 5px; }
|
||||||
|
.summary { margin: 20px 0; }
|
||||||
|
.test-module { margin: 10px 0; padding: 10px; border: 1px solid #ddd; border-radius: 3px; }
|
||||||
|
.passed { background-color: #d4edda; border-color: #c3e6cb; }
|
||||||
|
.failed { background-color: #f8d7da; border-color: #f5c6cb; }
|
||||||
|
.log { background-color: #f8f9fa; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 12px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<h1>基于空地协同的战场环境探索系统 - 测试报告</h1>
|
||||||
|
<p>生成时间: $(date)</p>
|
||||||
|
<p>测试环境: $(uname -a)</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="summary">
|
||||||
|
<h2>测试摘要</h2>
|
||||||
|
<p>总测试模块: 7</p>
|
||||||
|
<p>通过模块: $PASSED_COUNT</p>
|
||||||
|
<p>失败模块: $FAILED_COUNT</p>
|
||||||
|
<p>成功率: $((PASSED_COUNT * 100 / (PASSED_COUNT + FAILED_COUNT)))%</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="test-modules">
|
||||||
|
<h2>测试模块详情</h2>
|
||||||
|
$(cat "$LOG_DIR/test_results_$TIMESTAMP.txt" 2>/dev/null || echo "<p>无详细结果</p>")
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="log">
|
||||||
|
<h2>测试日志</h2>
|
||||||
|
<pre>$(tail -n 100 "$LOG_FILE" 2>/dev/null || echo "无日志数据")</pre>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "📄 测试报告已生成: $REPORT_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 主测试流程
|
||||||
|
echo "🚀 开始执行测试套件..."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 初始化计数器
|
||||||
|
PASSED_COUNT=0
|
||||||
|
FAILED_COUNT=0
|
||||||
|
|
||||||
|
# 1. 数据库管理测试
|
||||||
|
if run_test_module "数据库管理" "--database"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. 设备控制测试
|
||||||
|
if run_test_module "设备控制" "--device"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. YOLO检测器测试
|
||||||
|
if run_test_module "YOLO检测器" "--yolo"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 4. SLAM处理器测试
|
||||||
|
if run_test_module "SLAM处理器" "--slam"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 5. 数据融合测试
|
||||||
|
if run_test_module "数据融合" "--fusion"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 6. 通信模块测试
|
||||||
|
if run_test_module "通信模块" "--communication"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 7. 任务控制器测试
|
||||||
|
if run_test_module "任务控制器" "--mission"; then
|
||||||
|
((PASSED_COUNT++))
|
||||||
|
else
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 测试结果汇总
|
||||||
|
echo ""
|
||||||
|
echo "=========================================="
|
||||||
|
echo "测试结果汇总"
|
||||||
|
echo "=========================================="
|
||||||
|
echo "总测试模块: $((PASSED_COUNT + FAILED_COUNT))"
|
||||||
|
echo "通过模块: $PASSED_COUNT"
|
||||||
|
echo "失败模块: $FAILED_COUNT"
|
||||||
|
echo "成功率: $((PASSED_COUNT * 100 / (PASSED_COUNT + FAILED_COUNT)))%"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 生成测试报告
|
||||||
|
generate_test_report
|
||||||
|
|
||||||
|
# 清理临时文件
|
||||||
|
echo "🧹 清理临时文件..."
|
||||||
|
rm -f "$LOG_DIR/test_results_$TIMESTAMP.txt" 2>/dev/null
|
||||||
|
|
||||||
|
# 最终结果
|
||||||
|
if [ $FAILED_COUNT -eq 0 ]; then
|
||||||
|
echo "🎉 所有测试通过!系统质量良好。"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "⚠️ 有 $FAILED_COUNT 个测试模块失败,请检查系统功能。"
|
||||||
|
echo "详细日志请查看: $LOG_FILE"
|
||||||
|
echo "测试报告请查看: $REPORT_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue