-
This commit is contained in:
@@ -45,6 +45,9 @@ createApp({
|
||||
agvMoveInterval: null,
|
||||
agvCameraUrl: API + '/api/camera/refresh',
|
||||
agvCameraTimer: null,
|
||||
// 机型展开
|
||||
expandedModelId: null,
|
||||
showAddModelModal: false,
|
||||
// QR
|
||||
qrScanning: false,
|
||||
qrConfigs: [],
|
||||
@@ -810,6 +813,21 @@ createApp({
|
||||
} catch (e) { alert('扫描失败: ' + e.message) }
|
||||
this.qrScanningId = null
|
||||
},
|
||||
async applyQrAngles(qrId) {
|
||||
if (!this.armConnected) { alert('机械臂未连接'); return }
|
||||
const q = this.qrConfigs.find(x => x.id === qrId)
|
||||
if (!q || !q.joint_angles || !Array.isArray(q.joint_angles)) { alert('无效的姿态数据'); return }
|
||||
try {
|
||||
const res = await fetch(API + '/api/arm/set_angles', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type':'application/json'},
|
||||
body: JSON.stringify({ angles: q.joint_angles, speed: 50 })
|
||||
})
|
||||
const data = await res.json()
|
||||
if (data.ok) { alert('姿态已应用到机械臂')
|
||||
} else { alert('应用失败: ' + (data.error || '未知错误')) }
|
||||
} catch (e) { alert('应用姿态失败: ' + e.message) }
|
||||
},
|
||||
onArmPreviewError() {
|
||||
// 机械臂摄像头预览失败,静默处理
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user