fix 集群控制 点飞 算出飞机目标位置 如果小于0 直接提示 返回 打断 不发送飞行命令
This commit is contained in:
parent
9cca19f31c
commit
05361d6065
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user