|
|
|
@ -30,12 +30,14 @@
|
|
|
|
|
<a-button @click="emits('clickFlyTo')">指点飞行</a-button>
|
|
|
|
|
<!-- <a-button>智能环绕</a-button> -->
|
|
|
|
|
<a-button @click="returnVoyage">一键返航</a-button>
|
|
|
|
|
<a-button @click="obtain" style="background-color: #1b71e8; border: none"
|
|
|
|
|
>获取飞行器控制权</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button @click="enterDRC" style="background-color: #24d365; border: none"
|
|
|
|
|
>进入飞行控制</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button @click="obtain" style="background-color: #1b71e8; border: none">
|
|
|
|
|
<template #icon v-if="flightGrab"><CheckOutlined /></template>
|
|
|
|
|
获取飞行器控制权
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button @click="enterDRC" style="background-color: #24d365; border: none">
|
|
|
|
|
<template #icon v-if="modeEnter"><CheckOutlined /></template>
|
|
|
|
|
进入飞行控制
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button @click="exitDRC" style="background-color: #e3150e; border: none"
|
|
|
|
|
>退出飞行控制</a-button
|
|
|
|
|
>
|
|
|
|
@ -84,7 +86,7 @@
|
|
|
|
|
destroySeizeConnection,
|
|
|
|
|
connection,
|
|
|
|
|
} from '@/utils/mqtt';
|
|
|
|
|
import { CloseOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import { CloseOutlined, CheckOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import { vDrag } from '@/utils/drag';
|
|
|
|
|
import { drcDownTopicReize, eventsTopicSubscribeReize } from '@/utils/debugging/events';
|
|
|
|
|
import {
|
|
|
|
@ -127,7 +129,7 @@
|
|
|
|
|
const airportVal: any = ref({
|
|
|
|
|
mode_code: 0,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const bid = buildGUID();
|
|
|
|
|
//修改redis用户锁
|
|
|
|
|
const changeRedisUser = (val: boolean) => {
|
|
|
|
|
const querys = redisUser.value;
|
|
|
|
@ -158,7 +160,6 @@
|
|
|
|
|
emits('clickTakeOff');
|
|
|
|
|
changeRedisUser(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取
|
|
|
|
|
const obtain = () => {
|
|
|
|
|
// if (!getClient()) {
|
|
|
|
@ -168,11 +169,15 @@
|
|
|
|
|
createMessage.success('当前有用户正在操作,请稍后再试');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (flightGrab.value) {
|
|
|
|
|
createMessage.warning('已经获取了飞行器控制权');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
createMessage.info('正在获取飞行器控制权,请稍候');
|
|
|
|
|
changeRedisUser(true);
|
|
|
|
|
// 飞行控制权抢夺
|
|
|
|
|
servicesTopic({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
bid: bid,
|
|
|
|
|
method: 'flight_authority_grab',
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
@ -180,7 +185,7 @@
|
|
|
|
|
});
|
|
|
|
|
// 负载控制权抢夺
|
|
|
|
|
servicesTopic({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
bid: bid,
|
|
|
|
|
method: 'payload_authority_grab',
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
@ -191,8 +196,13 @@
|
|
|
|
|
services_replyTopic();
|
|
|
|
|
};
|
|
|
|
|
// 一键返航
|
|
|
|
|
const returnBtn = ref(false);
|
|
|
|
|
const returnVoyage = () => {
|
|
|
|
|
// 老的
|
|
|
|
|
if (returnBtn.value) {
|
|
|
|
|
createMessage.warning('正在返航或已返航,请勿重复操作');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
returnBtn.value = true;
|
|
|
|
|
servicesTopic({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
method: 'return_home',
|
|
|
|
@ -200,7 +210,6 @@
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
|
data: {},
|
|
|
|
|
});
|
|
|
|
|
// 新的servicesTopicReize
|
|
|
|
|
};
|
|
|
|
|
const seq = ref(1);
|
|
|
|
|
const changeDRC = (type, value) => {
|
|
|
|
@ -243,7 +252,7 @@
|
|
|
|
|
const { protocol, host, port, endpoint } = connection;
|
|
|
|
|
const connectUrl = `${protocol}://${host}:${port}${endpoint}`;
|
|
|
|
|
const querys = {
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
bid: bid,
|
|
|
|
|
data: {
|
|
|
|
|
hsi_frequency: 10,
|
|
|
|
|
mqtt_broker: {
|
|
|
|
@ -289,7 +298,7 @@
|
|
|
|
|
const exitDRC = () => {
|
|
|
|
|
createMessage.info('正在退出飞行控制,请稍后');
|
|
|
|
|
const querys = {
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
bid: bid,
|
|
|
|
|
data: {},
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
@ -311,7 +320,7 @@
|
|
|
|
|
if (rs.data.mode_code || rs.data.mode_code == 0) {
|
|
|
|
|
airportVal.value.mode_code = rs.data.mode_code;
|
|
|
|
|
}
|
|
|
|
|
if (rs.method == 'flight_authority_grab') {
|
|
|
|
|
if (rs.method == 'flight_authority_grab' && rs.bid == bid) {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
flightGrab.value = true;
|
|
|
|
|
createMessage.success('飞行控制权抢夺成功');
|
|
|
|
@ -320,7 +329,7 @@
|
|
|
|
|
createMessage.error('飞行控制权抢夺失败,' + errorName(rs.data.result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method == 'drc_mode_enter') {
|
|
|
|
|
if (rs.method == 'drc_mode_enter' && rs.bid == bid) {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
modeEnter.value = true;
|
|
|
|
|
createMessage.success('进入指令飞行控制模式成功');
|
|
|
|
@ -329,10 +338,11 @@
|
|
|
|
|
createMessage.error('进入指令飞行控制模式失败,' + errorName(rs.data.result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method == 'drc_mode_exit') {
|
|
|
|
|
if (rs.method == 'drc_mode_exit' && rs.bid == bid) {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
modeEnter.value = false;
|
|
|
|
|
createMessage.success('退出指令飞行控制模式成功');
|
|
|
|
|
changeRedisUser(false);
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('退出指令飞行控制模式失败,' + errorName(rs.data.result));
|
|
|
|
|
}
|
|
|
|
@ -342,8 +352,10 @@
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('一键返航成功');
|
|
|
|
|
monitorDRC.value = false;
|
|
|
|
|
returnBtn.value = true;
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('一键返航失败,' + errorName(rs.data.result));
|
|
|
|
|
returnBtn.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method === 'takeoff_to_point') {
|
|
|
|
@ -354,7 +366,6 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method === 'drc_status_notify' && monitorDRC.value) {
|
|
|
|
|
console.log('drc_status_notify', rs.data);
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
if (rs.data.drc_state == 0) {
|
|
|
|
|
drc_eart_beat();
|
|
|
|
|