点击“设置”的时候,“运行”也处于选中状态。
任务配置->机械臂初始姿态 加入“应用当前姿态”按钮。点击,把机械臂调整为该姿态。 任务配置->网格配置 本来点位行3已经设置好了数据,但现在没有了。 机械臂的IP地址换到了192.168.50.89
This commit is contained in:
+2
-2
@@ -747,10 +747,10 @@ def api_mission_config_set():
|
||||
gs.mission_config["cols"] = cols
|
||||
gs.mission_config["grid"] = grid
|
||||
gs.mission_config["arm_initial_pose"] = arm_initial_pose
|
||||
# 清除超出网格边界的 positions(只保留 front/back 且 row<rows, col<cols)
|
||||
# 清除超出网格边界的 positions(只保留 front/back 且 row<=rows, col<cols)
|
||||
gs.mission_config["positions"] = [
|
||||
p for p in gs.mission_config.get("positions", [])
|
||||
if p.get("row", 0) < rows and p.get("col", 0) < cols and p.get("side") in ("front", "back")
|
||||
if p.get("row", 0) <= rows and p.get("col", 0) < cols and p.get("side") in ("front", "back")
|
||||
]
|
||||
save_json("mission_config.json", gs.mission_config)
|
||||
return jsonify({"ok": True, "config": gs.mission_config})
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ AGV_CONFIG = {
|
||||
|
||||
# ========== 机械臂 TCP 客户端 ==========
|
||||
ARM_CONFIG = {
|
||||
"host": "192.168.50.74",
|
||||
"host": "192.168.50.89",
|
||||
"port": 5002,
|
||||
"timeout": 8,
|
||||
"retry_times": 3,
|
||||
@@ -39,8 +39,8 @@ CAMERA_CONFIG = {
|
||||
|
||||
# ========== 机械臂摄像头流 ==========
|
||||
ARM_CAMERA_CONFIG = {
|
||||
"url": "http://192.168.50.74:5003/api/camera/preview",
|
||||
"snapshot_url": "http://192.168.50.74:5003/api/camera/snapshot",
|
||||
"url": "http://192.168.50.89:5003/api/camera/preview",
|
||||
"snapshot_url": "http://192.168.50.89:5003/api/camera/snapshot",
|
||||
}
|
||||
|
||||
# ========== HTTP 上传 ==========
|
||||
|
||||
@@ -361,6 +361,25 @@ createApp({
|
||||
if (!data.ok) { alert('导航失败: ' + (data.error || '')) }
|
||||
} catch (e) { alert('导航失败: ' + e.message) }
|
||||
},
|
||||
async goToOrigin() {
|
||||
if (!confirm('确认导航到原点 (0, 0, 0)?')) return
|
||||
try {
|
||||
const res = await fetch(API + '/api/navigate/to', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ x: 0, y: 0, yaw: 0 })
|
||||
})
|
||||
const data = await res.json()
|
||||
if (data.ok) {
|
||||
this.mapMsg = '✅ 已发送导航到原点'
|
||||
} else {
|
||||
this.mapMsg = '❌ ' + (data.error || '导航失败')
|
||||
}
|
||||
} catch (e) {
|
||||
this.mapMsg = '❌ 导航请求失败: ' + e.message
|
||||
}
|
||||
setTimeout(() => { this.mapMsg = '' }, 3000)
|
||||
},
|
||||
async clearPoint() {
|
||||
if (!this.editingPoint) return
|
||||
const { pointRow, col } = this.editingPoint
|
||||
@@ -581,6 +600,20 @@ createApp({
|
||||
}
|
||||
} catch (e) { alert('读取角度失败: ' + e.message) }
|
||||
},
|
||||
async applyArmInitialPose() {
|
||||
if (!this.armConnected) { alert('机械臂未连接'); return }
|
||||
if (!confirm('确认应用初始姿态到机械臂?')) return
|
||||
try {
|
||||
const res = await fetch(API + '/api/arm/set_angles', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ angles: this.armInitialPose, speed: 500 })
|
||||
})
|
||||
const data = await res.json()
|
||||
if (data.ok) alert('✅ 机械臂已移动到初始姿态')
|
||||
else alert('❌ 应用失败: ' + (data.error || ''))
|
||||
} catch (e) { alert('应用失败: ' + e.message) }
|
||||
},
|
||||
async loadAllMachines() {
|
||||
try {
|
||||
const res = await fetch(API + '/api/mission/machines')
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="logo">⚙️ 系统设置</div>
|
||||
<nav class="nav">
|
||||
<a href="/" class="nav-link">🏠 首页</a>
|
||||
<href="/setting" class="nav-link active">⚙️ 设置</a>
|
||||
<a href="/setting" class="nav-link active">⚙️ 设置</a>
|
||||
<a href="/running" class="nav-link">▶️ 运行</a>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -268,6 +268,7 @@
|
||||
<button class="btn btn-primary" @click="generateGrid">🔲 生成网格</button>
|
||||
<button class="btn btn-secondary" @click="saveMissionConfig">💾 保存网格</button>
|
||||
<button class="btn btn-warning" @click="initPose" :disabled="initPoseLoading">📍 初始化位置</button>
|
||||
<button class="btn btn-primary" @click="goToOrigin">🏠 回到原点</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -362,6 +363,7 @@
|
||||
<div class="form-group" style="align-self:end">
|
||||
<button class="btn btn-primary" @click="saveArmInitialPose">💾 保存初始姿态</button>
|
||||
<button class="btn btn-secondary" @click="loadArmCurrentAngles" :disabled="!armConnected" style="margin-left:6px">📋 读取当前角度</button>
|
||||
<button class="btn btn-primary" @click="applyArmInitialPose" :disabled="!armConnected" style="margin-left:6px">🎯 应用当前姿态</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -582,6 +584,6 @@
|
||||
</div>
|
||||
|
||||
<script src="/static/js/vue3.global.prod.js?v=20260526a"></script>
|
||||
<script src="/static/js/setting.js?v=20260526d"></script>
|
||||
<script src="/static/js/setting.js?v=20260526f"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -16,7 +16,7 @@ AGV_CONFIG = {
|
||||
|
||||
# ========== 机械臂 TCP 客户端 ==========
|
||||
ARM_CONFIG = {
|
||||
"host": "192.168.50.74",
|
||||
"host": "192.168.50.89",
|
||||
"port": 5002,
|
||||
"timeout": 8,
|
||||
"retry_times": 3,
|
||||
@@ -39,7 +39,7 @@ CAMERA_CONFIG = {
|
||||
|
||||
# ========== 机械臂摄像头流 ==========
|
||||
ARM_CAMERA_CONFIG = {
|
||||
"url": "http://192.168.50.74:5003/api/camera/preview",
|
||||
"url": "http://192.168.50.89:5003/api/camera/preview",
|
||||
}
|
||||
|
||||
# ========== HTTP 上传 ==========
|
||||
|
||||
@@ -26,7 +26,7 @@ import numpy as np
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
ROS2_SETUP_CMD = "source /opt/ros/humble/setup.bash && source ~/agv_pro_ros2/install/setup.bash"
|
||||
ARM_CAMERA_SNAPSHOT = "http://192.168.50.74:5003/api/camera/snapshot"
|
||||
ARM_CAMERA_SNAPSHOT = "http://192.168.50.89:5003/api/camera/snapshot"
|
||||
PHOTOS_DIR = "/home/elephant/photos"
|
||||
|
||||
# 二维码扫描重试参数
|
||||
|
||||
Reference in New Issue
Block a user