提交 09ae253f 作者: 温凯

Merge branch 'v4_master' into v4

......@@ -2,7 +2,7 @@
<div class="control-bottom">
<div class="control-bottom-item" @click="onStartTask">
<img src="./assets/images/start.svg" />
<span class="dib">一键任务</span>
<span class="dib">一键任务 </span>
</div>
<div class="control-bottom-item" @click="onReturnFlight">
<img src="./assets/images/return.svg" />
......
......@@ -32,7 +32,7 @@
<div class="btn" @click="onStartTask" v-hover>一键任务</div>
<div class>
<span class="btn__add-line" @click="showAirwayEdit = true">
<span class="f8"></span> 创建航线
<span class="f8"></span> 创建航线
</span>
</div>
</el-form>
......@@ -72,7 +72,7 @@ export default {
"useSTLAirway",
"useTask",
]),
...mapState("MMCFlightControlCenter/uav", ["uav","uavRealTimeData"]),
...mapState("MMCFlightControlCenter/uav", ["uav", "uavRealTimeData"]),
// 选择的任务
selectedTask() {
let find = this.taskList.find((item) => {
......@@ -176,7 +176,7 @@ export default {
this.bus.$on("refreshAirway", this.getAirwayList);
await this.getTaskList();
await this.getAirwayList();
console.log(this.uavRealTimeData,'this.uavRealTimeData');
console.log(this.uavRealTimeData, "this.uavRealTimeData");
// 获取正在飞行的航线
if (this.uavRealTimeData.isFlying) {
this.getTaskInfoRecord();
......@@ -278,10 +278,15 @@ export default {
this.$message.warning("请选择航线");
return;
}
let diversionPoint = this.uav.diversionPoint;
if (!diversionPoint) {
return this.$message.warning("设备暂无备降点无法进行一键任务,请前往后台管理设置备降点!");
}
let data = this.taskList.filter((item) => item.id == this.selectedTaskId);
if (data && data[0].status == "执行中") {
return this.$message.warning("当前任务执行中");
}
try {
await this.$confirm("请确认是否进行一键任务操作?", "安全确认", {
cancelButtonText: "取消",
......@@ -289,6 +294,7 @@ export default {
customClass: "uav_controlPane",
showClose: false,
});
//
this.$store.commit("MMCFlightControlCenter/uav/setState", {
key: "airlineData",
value: this.selectedAirway,
......
......@@ -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,6 @@ const actions = {
* @param {object} data.taskInfoId //任务id
*/
async takeOff({ state, commit }, data) {
console.log(state.airlineData, data);
if (state.uav.network == 2) {
try {
let flightSortieId;
......@@ -709,7 +712,7 @@ const actions = {
taskInfoId: data.taskInfoId || undefined,
deviceId: state.uav.deviceId,
reouteId: state.airlineData.id,
})
});
} else {
// 生成架次号
flightSortieId = await TaskInfo.flightSortieId({
......@@ -721,12 +724,12 @@ const actions = {
/* const flightSortieId = {
data: `tmj-v4-${Date.now()}`
} */
// 上传航线指令
// 一键任务
const waypointList = state.airlineData?.content;
window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
topic: "PX4/OBTAIN/" + state.uav.deviceId,
data: {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.航线上传,
type: window.$mmc_stl.$store.state.MMCMQTT.orders.一键任务,
data: {
taskId: state.airlineData.id,
flightSortiesID: flightSortieId.data,
......@@ -736,67 +739,74 @@ const actions = {
headingMode: "AUTO",
isExitMissionOnRCSignalLostEnabled: true,
maxFlightSpeed: 12,
rallyList: [
{
longitude: diversionPointArr[0],
altitude: diversionPointArr[2],
latitude: diversionPointArr[1],
},
],
},
},
callback() { },
callback() {},
});
// 告诉飞控开始任务,并且把架次号和 任务id传过去
window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
topic: "PX4/OBTAIN/" + state.uav.deviceId,
data: {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.绑定任务id,
data: {
taskId: state.airlineData.id,
flightSortiesID: flightSortieId.data,
},
},
callback() { },
});
// // 告诉飞控开始任务,并且把架次号和 任务id传过去
// window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
// topic: "PX4/OBTAIN/" + state.uav.deviceId,
// data: {
// type: window.$mmc_stl.$store.state.MMCMQTT.orders.绑定任务id,
// data: {
// taskId: state.airlineData.id,
// flightSortiesID: flightSortieId.data,
// },
// },
// callback() {},
// });
// 起飞指令
commit("setState", {
key: "waitAirlineUpload",
value: true,
});
let time = setInterval(() => {
if (state.uavRealTimeData.uploadAirline) {
clearInterval(time);
window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
topic: "PX4/OBTAIN/" + state.uav.deviceId,
data: {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.航线一键起飞,
data: {
taskId: state.airlineData.id,
seq: 0,
},
},
callback() {
data?.callback && data.callback(true, flightSortieId.data);
},
});
// 清空261数据
let dataSet = window.$mmc_stl.$store.state.MMCMQTT.dataSet;
dataSet[state.uav.deviceId][261] = null;
// commit("setState", {
// key: "waitAirlineUpload",
// value: true,
// });
// let time = setInterval(() => {
// if (state.uavRealTimeData.uploadAirline) {
// clearInterval(time);
// window.$mmc_stl.$store.dispatch("MMCMQTT/publish", {
// topic: "PX4/OBTAIN/" + state.uav.deviceId,
// data: {
// type: window.$mmc_stl.$store.state.MMCMQTT.orders.航线一键起飞,
// data: {
// taskId: state.airlineData.id,
// seq: 0,
// },
// },
// callback() {
// data?.callback && data.callback(true, flightSortieId.data);
// },
// });
// // 清空261数据
// let dataSet = window.$mmc_stl.$store.state.MMCMQTT.dataSet;
// dataSet[state.uav.deviceId][261] = null;
window.$mmc_stl.$store.commit("MMCMQTT/setSate", {
key: "dataSet",
value: dataSet,
});
commit("setState", {
key: "uavRealTimeData",
value: {
...state.uavRealTimeData,
uploadAirline: null,
},
});
}
}, 1000);
// window.$mmc_stl.$store.commit("MMCMQTT/setSate", {
// key: "dataSet",
// value: dataSet,
// });
// commit("setState", {
// key: "uavRealTimeData",
// value: {
// ...state.uavRealTimeData,
// uploadAirline: null,
// },
// });
// }
// }, 1000);
// 做个保险, 要是因为各种原因导致没飞起, 超过一分钟删除循环定时器
setTimeout(() => {
clearInterval(time);
}, 60000);
// // 做个保险, 要是因为各种原因导致没飞起, 超过一分钟删除循环定时器
// setTimeout(() => {
// clearInterval(time);
// }, 60000);
} catch (e) {
console.log("一键起飞失败", e);
data?.callback && data.callback(false);
......@@ -1317,7 +1327,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 +1369,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 +1387,7 @@ const actions = {
type: window.$mmc_stl.$store.state.MMCMQTT.orders.链路切换,
data,
},
callback() { },
callback() {},
});
},
// 键盘控制
......
......@@ -8,6 +8,7 @@ export default {
摇杆控制: 519,
航线下载: 520,
航线上传: 521,
一键任务: 529,
航线一键起飞: 522,
暂停航线任务: 523,
继续航线任务: 524,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论