提交 d8e69535 作者: 温凯

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

上级 47f051c4
...@@ -6,7 +6,7 @@ let positions = []; // 飞机走过的点, 会一直累计, 每n秒减半一次, ...@@ -6,7 +6,7 @@ let positions = []; // 飞机走过的点, 会一直累计, 每n秒减半一次,
setInterval(() => { setInterval(() => {
if (positions.length > 1000) { if (positions.length > 1000) {
positions = positions.filter((x, index) => index % 2 === 0); positions = positions.filter((x, index) => index % 2 === 0);
console.log('飞行轨迹', positions); console.log("飞行轨迹", positions);
} }
}, 60000); }, 60000);
if (!window.$mmc_stl) { if (!window.$mmc_stl) {
...@@ -14,7 +14,7 @@ if (!window.$mmc_stl) { ...@@ -14,7 +14,7 @@ if (!window.$mmc_stl) {
} }
window.$mmc_stl.positions = () => { window.$mmc_stl.positions = () => {
console.log(positions); console.log(positions);
} };
const defaultPos = { const defaultPos = {
latitude: 0, // 纬度 latitude: 0, // 纬度
longitude: 0, // 经度 longitude: 0, // 经度
...@@ -432,7 +432,7 @@ const actions = { ...@@ -432,7 +432,7 @@ const actions = {
if (item.mountId === type259.mountId) { if (item.mountId === type259.mountId) {
return { return {
...item, ...item,
...type259 ...type259,
}; };
} }
return item; return item;
...@@ -507,7 +507,11 @@ const actions = { ...@@ -507,7 +507,11 @@ const actions = {
} else { } else {
// const posData = UAVDataParser(state.uavRealTimeData); // 这种写法在执行rollup混淆压缩后, posData对象会变成elementUI的对象,原因未知 // 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) { if (!flag) {
positions.push(UAVDataParser(state.uavRealTimeData).position); positions.push(UAVDataParser(state.uavRealTimeData).position);
} }
...@@ -700,7 +704,12 @@ const actions = { ...@@ -700,7 +704,12 @@ const actions = {
* @param {object} data.taskInfoId //任务id * @param {object} data.taskInfoId //任务id
*/ */
async takeOff({ state, commit }, data) { 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) { if (state.uav.network == 2) {
try { try {
let flightSortieId; let flightSortieId;
...@@ -709,7 +718,7 @@ const actions = { ...@@ -709,7 +718,7 @@ const actions = {
taskInfoId: data.taskInfoId || undefined, taskInfoId: data.taskInfoId || undefined,
deviceId: state.uav.deviceId, deviceId: state.uav.deviceId,
reouteId: state.airlineData.id, reouteId: state.airlineData.id,
}) });
} else { } else {
// 生成架次号 // 生成架次号
flightSortieId = await TaskInfo.flightSortieId({ flightSortieId = await TaskInfo.flightSortieId({
...@@ -736,9 +745,16 @@ const actions = { ...@@ -736,9 +745,16 @@ const actions = {
headingMode: "AUTO", headingMode: "AUTO",
isExitMissionOnRCSignalLostEnabled: true, isExitMissionOnRCSignalLostEnabled: true,
maxFlightSpeed: 12, maxFlightSpeed: 12,
rallyList: [
{
longitude: diversionPointArr[0],
altitude: diversionPointArr[2],
latitude: diversionPointArr[1],
},
],
}, },
}, },
callback() { }, callback() {},
}); });
// 告诉飞控开始任务,并且把架次号和 任务id传过去 // 告诉飞控开始任务,并且把架次号和 任务id传过去
...@@ -751,7 +767,7 @@ const actions = { ...@@ -751,7 +767,7 @@ const actions = {
flightSortiesID: flightSortieId.data, flightSortiesID: flightSortieId.data,
}, },
}, },
callback() { }, callback() {},
}); });
// 起飞指令 // 起飞指令
...@@ -1317,7 +1333,8 @@ const actions = { ...@@ -1317,7 +1333,8 @@ const actions = {
window.$mmc_stl.$store.dispatch("MMCMQTT/publish", { window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
topic: "PX4/OBTAIN/" + state.uav.deviceId, topic: "PX4/OBTAIN/" + state.uav.deviceId,
data: { data: {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.云台控制指令can包透传, type: window.$mmc_stl.$store.state.MMCMQTT.orders
.云台控制指令can包透传,
data: { data: {
mountId: data.mountId, mountId: data.mountId,
payload: data.buffer, payload: data.buffer,
...@@ -1376,7 +1393,7 @@ const actions = { ...@@ -1376,7 +1393,7 @@ const actions = {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.链路切换, type: window.$mmc_stl.$store.state.MMCMQTT.orders.链路切换,
data, data,
}, },
callback() { }, callback() {},
}); });
}, },
// 键盘控制 // 键盘控制
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论