提交 d8e69535 作者: 温凯

fix(uav): 修复一键起飞时未检查备降点的问题

上级 47f051c4
......@@ -6,7 +6,7 @@ let positions = []; // 飞机走过的点, 会一直累计, 每n秒减半一次,
setInterval(() => {
if (positions.length > 1000) {
positions = positions.filter((x, index) => index % 2 === 0);
console.log('飞行轨迹', positions);
console.log("飞行轨迹", positions);
}
}, 60000);
if (!window.$mmc_stl) {
......@@ -14,7 +14,7 @@ if (!window.$mmc_stl) {
}
window.$mmc_stl.positions = () => {
console.log(positions);
}
};
const defaultPos = {
latitude: 0, // 纬度
longitude: 0, // 经度
......@@ -355,16 +355,16 @@ const actions = {
type260.grade <= 2
? "[危险]"
: type260.grade == 3
? "[错误]"
: type260.grade == 4
? "[警告]"
: type260.grade == 5
? "[通知]"
: type260.grade == 6
? "[正常]"
: type260.grade == 7
? "[调试]"
: "AUTO",
? "[错误]"
: type260.grade == 4
? "[警告]"
: type260.grade == 5
? "[通知]"
: type260.grade == 6
? "[正常]"
: type260.grade == 7
? "[调试]"
: "AUTO",
text: type260.msg,
time: moment(type260.timestamp).format("YYYY-MM-DD HH:mm:ss"),
timestamp: type260.timestamp,
......@@ -432,7 +432,7 @@ const actions = {
if (item.mountId === type259.mountId) {
return {
...item,
...type259
...type259,
};
}
return item;
......@@ -499,15 +499,19 @@ const actions = {
if (state.uavRealTimeData.locationCoordinate3D.longitude) {
if (
state.uavRealTimeData.locationCoordinate3D.longitude ===
defaultPos.longitude &&
defaultPos.longitude &&
state.uavRealTimeData.locationCoordinate3D.latitude ===
defaultPos.latitude
defaultPos.latitude
) {
// 默认坐标不记录
} else {
// const posData = UAVDataParser(state.uavRealTimeData); // 这种写法在执行rollup混淆压缩后, posData对象会变成elementUI的对象,原因未知
// 更新轨迹
let flag = positions.some(val => val.x == UAVDataParser(state.uavRealTimeData).position.x && val.y == UAVDataParser(state.uavRealTimeData).position.y)
let flag = positions.some(
(val) =>
val.x == UAVDataParser(state.uavRealTimeData).position.x &&
val.y == UAVDataParser(state.uavRealTimeData).position.y
);
if (!flag) {
positions.push(UAVDataParser(state.uavRealTimeData).position);
}
......@@ -516,7 +520,7 @@ const actions = {
if (
state.uavRealTimeData.locationCoordinate3D.longitude !==
defaultPos.longitude &&
defaultPos.longitude &&
!state.uavModelEntity
) {
dispatch("createUavModel");
......@@ -700,7 +704,12 @@ const actions = {
* @param {object} data.taskInfoId //任务id
*/
async takeOff({ state, commit }, data) {
console.log(state.airlineData, data);
let diversionPoint = state.uav.diversionPoint;
if (!diversionPoint) {
return this.$message.warning("设备暂无备降点,无法进行一键起飞!");
}
let diversionPointArr = diversionPoint.split(",");
console.log(diversionPointArr, "diversionPointArr");
if (state.uav.network == 2) {
try {
let flightSortieId;
......@@ -709,7 +718,7 @@ const actions = {
taskInfoId: data.taskInfoId || undefined,
deviceId: state.uav.deviceId,
reouteId: state.airlineData.id,
})
});
} else {
// 生成架次号
flightSortieId = await TaskInfo.flightSortieId({
......@@ -736,9 +745,16 @@ const actions = {
headingMode: "AUTO",
isExitMissionOnRCSignalLostEnabled: true,
maxFlightSpeed: 12,
rallyList: [
{
longitude: diversionPointArr[0],
altitude: diversionPointArr[2],
latitude: diversionPointArr[1],
},
],
},
},
callback() { },
callback() {},
});
// 告诉飞控开始任务,并且把架次号和 任务id传过去
......@@ -751,7 +767,7 @@ const actions = {
flightSortiesID: flightSortieId.data,
},
},
callback() { },
callback() {},
});
// 起飞指令
......@@ -1317,7 +1333,8 @@ const actions = {
window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
topic: "PX4/OBTAIN/" + state.uav.deviceId,
data: {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.云台控制指令can包透传,
type: window.$mmc_stl.$store.state.MMCMQTT.orders
.云台控制指令can包透传,
data: {
mountId: data.mountId,
payload: data.buffer,
......@@ -1358,7 +1375,7 @@ const actions = {
if (
res.data.currentOperator &&
res.data.currentOperator ===
window.$mmc_stl.$store.state.MMCFlightControlCenter.userInfo.id
window.$mmc_stl.$store.state.MMCFlightControlCenter.userInfo.id
) {
return true;
}
......@@ -1376,7 +1393,7 @@ const actions = {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.链路切换,
data,
},
callback() { },
callback() {},
});
},
// 键盘控制
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论