parent
d358997df8
commit
a36b34837e
@ -0,0 +1,11 @@
|
||||
{
|
||||
"created_time": "2026-04-20T02:11:45Z",
|
||||
"files": [
|
||||
],
|
||||
"folders": [
|
||||
],
|
||||
"id": "1542",
|
||||
"modified_time": "2026-04-20T02:11:45Z",
|
||||
"signature": "4031563627892149089",
|
||||
"version": 3
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(curl -sL \"https://unpkg.com/roslib@2.1.0/dist/\")",
|
||||
"Bash(curl -sL \"https://unpkg.com/roslib@1.3.0/build/roslib.min.js\" -o \"d:/29578/Documents/Study/computer/S_E/软件体系结构与设计/软件前端/js/roslib.min.js\" -w \"%{http_code} %{size_download}\")"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,383 @@
|
||||
/* ===== 全局样式 ===== */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
background: #f0f2f5;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* ===== 顶部状态栏 ===== */
|
||||
.top-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
padding: 0 16px;
|
||||
background: #1a1a2e;
|
||||
color: #e0e0e0;
|
||||
flex-shrink: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.top-bar-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
font-size: 13px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.status-item strong {
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.top-bar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.top-bar-right input {
|
||||
width: 220px;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
background: #2a2a3e;
|
||||
color: #e0e0e0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* ===== 连接模式切换 ===== */
|
||||
.conn-mode-group {
|
||||
display: flex;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #444;
|
||||
}
|
||||
|
||||
.mode-btn {
|
||||
padding: 4px 12px;
|
||||
background: #2a2a3e;
|
||||
color: #aaa;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.mode-btn:hover { color: #ddd; }
|
||||
|
||||
.mode-btn.active {
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.conn-mode-tag {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 3px;
|
||||
background: #2a2a3e;
|
||||
color: #888;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ===== 标签 ===== */
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tag-success { background: #f6ffed; color: #52c41a; }
|
||||
.tag-danger { background: #fff1f0; color: #ff4d4f; }
|
||||
.tag-warning { background: #fffbe6; color: #faad14; }
|
||||
.tag-info { background: #e6f7ff; color: #007aff; }
|
||||
|
||||
/* ===== 按钮 ===== */
|
||||
.btn {
|
||||
padding: 7px 14px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn:not(:disabled):hover { opacity: 0.85; }
|
||||
|
||||
.btn-primary { background: #007aff; color: #fff; }
|
||||
.btn-success { background: #52c41a; color: #fff; }
|
||||
.btn-warning { background: #faad14; color: #fff; }
|
||||
.btn-danger { background: #ff4d4f; color: #fff; }
|
||||
.btn-secondary { background: #e0e0e0; color: #333; }
|
||||
.btn.wide { width: 100%; }
|
||||
|
||||
.btn-link {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.btn-link:hover { color: #007aff; }
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.btn-group .btn { flex: 1; }
|
||||
|
||||
/* ===== 主内容区 ===== */
|
||||
.main-content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* ===== 地图 ===== */
|
||||
.map-container {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* ===== 右侧控制面板 ===== */
|
||||
.control-panel {
|
||||
width: 300px;
|
||||
flex-shrink: 0;
|
||||
background: #fff;
|
||||
border-left: 1px solid #e0e0e0;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.panel-section {
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.panel-header span:last-child {
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* ===== 航点列表 ===== */
|
||||
.waypoint-list {
|
||||
max-height: 220px;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.empty-hint {
|
||||
text-align: center;
|
||||
color: #bbb;
|
||||
font-size: 13px;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.wp-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 8px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 4px;
|
||||
background: #f8f9fa;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.wp-item:hover { background: #e6f7ff; }
|
||||
|
||||
.wp-item.active { background: #e6f7ff; border: 1px solid #91d5ff; }
|
||||
|
||||
.wp-index {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wp-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wp-coord {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.wp-alt {
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.wp-delete {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: none;
|
||||
background: none;
|
||||
color: #ccc;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wp-delete:hover { color: #ff4d4f; }
|
||||
|
||||
.wp-params {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.wp-params input {
|
||||
width: 60px;
|
||||
padding: 3px 6px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ===== 数据面板 ===== */
|
||||
.data-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.data-item {
|
||||
background: #f8f9fa;
|
||||
border-radius: 6px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.data-label {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.data-value {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* ===== 底部日志栏 ===== */
|
||||
.log-bar {
|
||||
height: 120px;
|
||||
flex-shrink: 0;
|
||||
background: #1e1e1e;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.log-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 12px;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
background: #2a2a2a;
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
|
||||
.log-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 4px 12px;
|
||||
font-family: 'Consolas', 'Monaco', monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.log-entry .time { color: #666; margin-right: 8px; }
|
||||
.log-entry.success { color: #52c41a; }
|
||||
.log-entry.error { color: #ff4d4f; }
|
||||
.log-entry.warning { color: #faad14; }
|
||||
.log-entry.info { color: #aaa; }
|
||||
|
||||
/* ===== Leaflet 自定义 ===== */
|
||||
.drone-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.drone-icon-inner {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 10px solid transparent;
|
||||
border-right: 10px solid transparent;
|
||||
border-bottom: 20px solid #007aff;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
transform-origin: center 60%;
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>P600 无人机定点巡航控制系统</title>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<!-- 顶部状态栏 -->
|
||||
<header class="top-bar">
|
||||
<div class="top-bar-left">
|
||||
<span class="logo">P600 定点巡航控制系统</span>
|
||||
<span id="conn-status" class="tag tag-danger">未连接</span>
|
||||
<span class="status-item">模式: <strong id="flight-mode">--</strong></span>
|
||||
<span class="status-item">电量: <strong id="battery">--%</strong></span>
|
||||
<span class="status-item">GPS: <strong id="gps-status">--</strong></span>
|
||||
<span class="status-item">速度: <strong id="speed">-- m/s</strong></span>
|
||||
<span class="status-item">高度: <strong id="altitude">-- m</strong></span>
|
||||
</div>
|
||||
<div class="top-bar-right">
|
||||
<div class="conn-mode-group">
|
||||
<button id="btn-mode-sim" class="mode-btn active" title="Prometheus SITL 仿真 (rosbridge WebSocket)">仿真模式</button>
|
||||
<button id="btn-mode-real" class="mode-btn" title="P600 实机 WiFi 数传 (rosbridge WebSocket)">实机模式</button>
|
||||
</div>
|
||||
<input type="text" id="drone-url" value="ws://localhost:9090" placeholder="rosbridge 地址" />
|
||||
<button id="btn-connect" class="btn btn-primary">连接无人机</button>
|
||||
<span id="conn-mode-tag" class="conn-mode-tag">rosbridge</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 主内容区 -->
|
||||
<div class="main-content">
|
||||
<!-- 地图区域 -->
|
||||
<div id="map" class="map-container"></div>
|
||||
|
||||
<!-- 右侧控制面板 -->
|
||||
<aside class="control-panel">
|
||||
<!-- 航点列表 -->
|
||||
<div class="panel-section">
|
||||
<div class="panel-header">
|
||||
<span>航点列表</span>
|
||||
<span id="wp-count">0 个航点</span>
|
||||
</div>
|
||||
<div id="waypoint-list" class="waypoint-list">
|
||||
<div class="empty-hint">在地图上点击以添加航点</div>
|
||||
</div>
|
||||
<div class="wp-params">
|
||||
<label>默认高度: <input type="number" id="default-alt" value="15" min="1" max="100" /> 米</label>
|
||||
<label>默认悬停: <input type="number" id="default-hold" value="0" min="0" max="60" /> 秒</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 任务操作 -->
|
||||
<div class="panel-section">
|
||||
<div class="panel-header">任务操作</div>
|
||||
<div class="btn-group">
|
||||
<button id="btn-upload" class="btn btn-primary wide" disabled>上传任务</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="btn-start" class="btn btn-success wide" disabled>开始任务</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="btn-pause" class="btn btn-warning" disabled>暂停</button>
|
||||
<button id="btn-resume" class="btn btn-success" disabled>继续</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="btn-rth" class="btn btn-danger" disabled>返航</button>
|
||||
<button id="btn-land" class="btn btn-danger" disabled>降落</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="btn-clear" class="btn btn-secondary wide">清除所有航点</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 实时数据 -->
|
||||
<div class="panel-section">
|
||||
<div class="panel-header">实时数据</div>
|
||||
<div class="data-grid">
|
||||
<div class="data-item">
|
||||
<span class="data-label">纬度</span>
|
||||
<span class="data-value" id="data-lat">--</span>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<span class="data-label">经度</span>
|
||||
<span class="data-value" id="data-lng">--</span>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<span class="data-label">航向</span>
|
||||
<span class="data-value" id="data-heading">--</span>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<span class="data-label">当前航点</span>
|
||||
<span class="data-value" id="data-wp">--</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<!-- 底部日志栏 -->
|
||||
<footer class="log-bar">
|
||||
<div class="log-header">
|
||||
<span>操作日志</span>
|
||||
<button id="btn-clear-log" class="btn-link">清空</button>
|
||||
</div>
|
||||
<div id="log-content" class="log-content"></div>
|
||||
</footer>
|
||||
|
||||
<!-- JS 依赖 -->
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script src="/js/roslib.min.js"></script>
|
||||
<script src="/js/map.js"></script>
|
||||
<script src="/js/websocket.js"></script>
|
||||
<script src="/js/ui.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
# 此文件已弃用 - 新架构通过 roslibjs + rosbridge_server 直接在浏览器端控制无人机
|
||||
# 无需 Python 后端处理无人机逻辑
|
||||
#
|
||||
# 新架构:
|
||||
# 浏览器 (roslibjs) ──WebSocket──► rosbridge_server ──ROS话题──► Prometheus/MAVROS ──► PX4
|
||||
#
|
||||
# 如需参考旧版 MAVSDK 实现,请查看 git 历史
|
||||
@ -0,0 +1 @@
|
||||
flask==3.0.0
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
{
|
||||
"created_time": "2026-04-20T02:11:45Z",
|
||||
"files": [
|
||||
{
|
||||
"attachment_folder": "",
|
||||
"created_time": "2026-04-20T02:11:45Z",
|
||||
"id": "1543",
|
||||
"modified_time": "2026-04-20T02:11:45Z",
|
||||
"name": "README.md",
|
||||
"signature": "1126905480722352993",
|
||||
"tags": [
|
||||
]
|
||||
}
|
||||
],
|
||||
"folders": [
|
||||
{
|
||||
"name": "document"
|
||||
}
|
||||
],
|
||||
"id": "1541",
|
||||
"modified_time": "2026-04-20T02:11:45Z",
|
||||
"signature": "5155401718504459105",
|
||||
"version": 3
|
||||
}
|
||||
Loading…
Reference in new issue