fix 集群控制 点飞 算出飞机目标位置 如果小于0 直接提示 返回 打断 不发送飞行命令

This commit is contained in:
oldHome 2025-06-28 15:52:19 +08:00
parent 9cca19f31c
commit 05361d6065

View File

@ -202,6 +202,7 @@ export default {
return
}
let minTargetAlt = Infinity //
//
const commands = this.planeList.map(p => {
const pos = p?.planeState?.position
@ -216,12 +217,22 @@ export default {
const newLat = targetLat + offsetLat
const newAlt = targetAlt + offsetAlt
if (newAlt < minTargetAlt) {
minTargetAlt = newAlt
}
return {
macadd: p.macadd,
cmd: `{guidedMode:{lon:${newLon.toFixed(7)},lat:${newLat.toFixed(7)},alt:${newAlt.toFixed(1)}}}`
}
}).filter(Boolean)
//
if (minTargetAlt < 0) {
this.$message.warning(`指令已取消:最矮飞机将飞到地面以下(最低高度 ${minTargetAlt.toFixed(1)} 米)`)
return
}
//
commands.forEach(({ macadd, cmd }) => {
mqtt.publishFun(`cmd/${macadd}`, cmd)