|
|
|
@ -1,6 +1,13 @@
|
|
|
|
|
<template>
|
|
|
|
|
<VueDragResize :w="width" :h="height" :x="left" :y="top" :isActive="true" :parentLimitation="true"
|
|
|
|
|
:isResizable="false">
|
|
|
|
|
<VueDragResize
|
|
|
|
|
:w="width"
|
|
|
|
|
:h="height"
|
|
|
|
|
:x="left"
|
|
|
|
|
:y="top"
|
|
|
|
|
:isActive="true"
|
|
|
|
|
:parentLimitation="true"
|
|
|
|
|
:isResizable="false"
|
|
|
|
|
>
|
|
|
|
|
<div class="flight-control" v-if="airportVal" v-drag>
|
|
|
|
|
<div class="title">
|
|
|
|
|
<div>
|
|
|
|
@ -20,7 +27,7 @@
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div class="content-button">
|
|
|
|
|
<a-button @click="takeOff">一键起飞</a-button>
|
|
|
|
|
<a-button @click="emits('clickFlyTo')">指点飞行</a-button>
|
|
|
|
|
<a-button @click="flyTo">指点飞行</a-button>
|
|
|
|
|
<!-- <a-button>智能环绕</a-button> -->
|
|
|
|
|
<a-button @click="returnVoyage">一键返航</a-button>
|
|
|
|
|
<a-button @click="obtain" style="background-color: #1b71e8; border: none">
|
|
|
|
@ -35,53 +42,118 @@
|
|
|
|
|
</template>
|
|
|
|
|
进入飞行控制
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button @click="exitDRC" style="background-color: #e3150e; border: none">退出飞行控制</a-button>
|
|
|
|
|
<a-button @click="exitDRC" style="background-color: #e3150e; border: none"
|
|
|
|
|
>退出飞行控制</a-button
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content-info">
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
|
|
|
|
|
<div class="info-item-top" title="上升" @mousedown="changeDRC('throttle', 'up', '上升')"
|
|
|
|
|
@mouseup="changeDRC('throttle', 'up', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/top-active.png" alt="" v-if="selectName == '上升'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-top"
|
|
|
|
|
title="上升"
|
|
|
|
|
@mousedown="changeDRC('throttle', 'up', '上升')"
|
|
|
|
|
@mouseup="changeDRC('throttle', 'up', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/top-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '上升'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/top.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-right" title="右旋转" @mousedown="changeDRC('yaw', 'up', '右旋转')"
|
|
|
|
|
@mouseup="changeDRC('yaw', 'up', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/right-active.png" alt="" v-if="selectName == '右旋转'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-right"
|
|
|
|
|
title="右旋转"
|
|
|
|
|
@mousedown="changeDRC('yaw', 'up', '右旋转')"
|
|
|
|
|
@mouseup="changeDRC('yaw', 'up', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/right-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '右旋转'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/right.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-bottom" title="下降" @mousedown="changeDRC('throttle', 'down', '下降')"
|
|
|
|
|
@mouseup="changeDRC('throttle', 'down', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/bottom-active.png" alt="" v-if="selectName == '下降'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-bottom"
|
|
|
|
|
title="下降"
|
|
|
|
|
@mousedown="changeDRC('throttle', 'down', '下降')"
|
|
|
|
|
@mouseup="changeDRC('throttle', 'down', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/bottom-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '下降'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/bottom.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-left" title="左旋转" @mousedown="changeDRC('yaw', 'down', '左旋转')"
|
|
|
|
|
@mouseup="changeDRC('yaw', 'down', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/left-active.png" alt="" v-if="selectName == '左旋转'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-left"
|
|
|
|
|
title="左旋转"
|
|
|
|
|
@mousedown="changeDRC('yaw', 'down', '左旋转')"
|
|
|
|
|
@mouseup="changeDRC('yaw', 'down', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/left-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '左旋转'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/left.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
|
|
|
|
|
<div class="info-item-top" title="前进"
|
|
|
|
|
@mousedown="changeDRC('pitch', 'up', '前进')" @mouseup="changeDRC('pitch', 'up', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/top-active.png" alt=""
|
|
|
|
|
v-if="selectName == '前进'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-top"
|
|
|
|
|
title="前进"
|
|
|
|
|
@mousedown="changeDRC('pitch', 'up', '前进')"
|
|
|
|
|
@mouseup="changeDRC('pitch', 'up', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/top-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '前进'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/top.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-right" title="右移"
|
|
|
|
|
@mousedown="changeDRC('roll', 'up', '右移')" @mouseup="changeDRC('roll', 'up', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/right-active.png" alt="" v-if="selectName == '右移'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-right"
|
|
|
|
|
title="右移"
|
|
|
|
|
@mousedown="changeDRC('roll', 'up', '右移')"
|
|
|
|
|
@mouseup="changeDRC('roll', 'up', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/right-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '右移'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/right.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-bottom" title="后退"
|
|
|
|
|
@mousedown="changeDRC('pitch', 'down', '后退')" @mouseup="changeDRC('pitch', 'down', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/bottom-active.png" alt="" v-if="selectName == '后退'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-bottom"
|
|
|
|
|
title="后退"
|
|
|
|
|
@mousedown="changeDRC('pitch', 'down', '后退')"
|
|
|
|
|
@mouseup="changeDRC('pitch', 'down', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/bottom-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '后退'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/bottom.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-item-left" title="左移"
|
|
|
|
|
@mousedown="changeDRC('roll', 'down', '左移')" @mouseup="changeDRC('roll', 'down', '')">
|
|
|
|
|
<img src="@/assets/images/flightoperation/left-active.png" alt="" v-if="selectName == '左移'" />
|
|
|
|
|
<div
|
|
|
|
|
class="info-item-left"
|
|
|
|
|
title="左移"
|
|
|
|
|
@mousedown="changeDRC('roll', 'down', '左移')"
|
|
|
|
|
@mouseup="changeDRC('roll', 'down', '')"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src="@/assets/images/flightoperation/left-active.png"
|
|
|
|
|
alt=""
|
|
|
|
|
v-if="selectName == '左移'"
|
|
|
|
|
/>
|
|
|
|
|
<img src="@/assets/images/flightoperation/left.png" alt="" v-else />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -91,68 +163,73 @@
|
|
|
|
|
</VueDragResize>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, ref, watch, reactive, onUnmounted } from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
import { onMounted, ref, watch, reactive, onUnmounted } from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
getClient,
|
|
|
|
|
createSeizeConnection,
|
|
|
|
|
destroySeizeConnection,
|
|
|
|
|
connection,
|
|
|
|
|
} from '@/utils/mqtt';
|
|
|
|
|
import { CloseOutlined, CheckOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import { vDrag } from '@/utils/drag';
|
|
|
|
|
import { drcDownTopicReize, eventsTopicSubscribeReize } from '@/utils/debugging/events';
|
|
|
|
|
import {
|
|
|
|
|
} from '@/utils/mqtt';
|
|
|
|
|
import { CloseOutlined, CheckOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import { vDrag } from '@/utils/drag';
|
|
|
|
|
import { drcDownTopicReize, eventsTopicSubscribeReize } from '@/utils/debugging/events';
|
|
|
|
|
import {
|
|
|
|
|
servicesTopic,
|
|
|
|
|
services_replyTopic,
|
|
|
|
|
drcDownTopic,
|
|
|
|
|
eventsTopicSubscribe,
|
|
|
|
|
drcUpTopic,
|
|
|
|
|
errorName,
|
|
|
|
|
} from '@/utils/debugging/remote';
|
|
|
|
|
import { buildGUID } from '@/utils/uuid';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
import {
|
|
|
|
|
} from '@/utils/debugging/remote';
|
|
|
|
|
import { buildGUID } from '@/utils/uuid';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
import {
|
|
|
|
|
getRedisUser,
|
|
|
|
|
addOrUpdateRedisUser,
|
|
|
|
|
getLockedClients,
|
|
|
|
|
} from '@/api/workmanagement/airportMaintenance';
|
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
|
import { timestampToFormattedDate } from '@/utils/index';
|
|
|
|
|
import VueDragResize from 'vue-drag-resize/src';
|
|
|
|
|
import { airPortStore } from '@/store/modules/airport';
|
|
|
|
|
} from '@/api/workmanagement/airportMaintenance';
|
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
|
import { timestampToFormattedDate } from '@/utils/index';
|
|
|
|
|
import VueDragResize from 'vue-drag-resize/src';
|
|
|
|
|
import { airPortStore } from '@/store/modules/airport';
|
|
|
|
|
import { EventBus } from '@/utils/eventBus';
|
|
|
|
|
|
|
|
|
|
const airPortStoreVal = airPortStore();
|
|
|
|
|
const uav = airPortStoreVal.getUAV;
|
|
|
|
|
|
|
|
|
|
const width = ref(380);
|
|
|
|
|
const height = ref(390);
|
|
|
|
|
const left = ref(700);
|
|
|
|
|
const top = ref(100);
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const userInfo = userStore.getUserInfo;
|
|
|
|
|
const redisUser = ref({});
|
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
|
const emits = defineEmits(['changeFlightControl', 'clickTakeOff', 'clickFlyTo']);
|
|
|
|
|
const monitorDRC = ref(false);
|
|
|
|
|
// 是否飞行控制权抢夺
|
|
|
|
|
const flightGrab = ref(false);
|
|
|
|
|
// 是否进入飞行指令控制模式
|
|
|
|
|
const modeEnter = ref(false);
|
|
|
|
|
const airportVal: any = ref({
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
uavStatus: Number,
|
|
|
|
|
});
|
|
|
|
|
console.log(props.uavStatus);
|
|
|
|
|
const airPortStoreVal = airPortStore();
|
|
|
|
|
const uav = airPortStoreVal.getUAV;
|
|
|
|
|
const isTakeOff = ref(false);
|
|
|
|
|
const width = ref(380);
|
|
|
|
|
const height = ref(390);
|
|
|
|
|
const left = ref(700);
|
|
|
|
|
const top = ref(100);
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const userInfo = userStore.getUserInfo;
|
|
|
|
|
const redisUser = ref({});
|
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
|
const emits = defineEmits(['changeFlightControl', 'clickTakeOff', 'clickFlyTo']);
|
|
|
|
|
const monitorDRC = ref(false);
|
|
|
|
|
// 是否飞行控制权抢夺
|
|
|
|
|
const flightGrab = ref(false);
|
|
|
|
|
// 是否进入飞行指令控制模式
|
|
|
|
|
const modeEnter = ref(false);
|
|
|
|
|
const airportVal: any = ref({
|
|
|
|
|
mode_code: 0,
|
|
|
|
|
});
|
|
|
|
|
const selectName = ref('');
|
|
|
|
|
const bid = buildGUID();
|
|
|
|
|
//修改redis用户锁
|
|
|
|
|
const changeRedisUser = (val: boolean) => {
|
|
|
|
|
});
|
|
|
|
|
const selectName = ref('');
|
|
|
|
|
const bid = buildGUID();
|
|
|
|
|
//修改redis用户锁
|
|
|
|
|
const changeRedisUser = (val: boolean) => {
|
|
|
|
|
const querys = redisUser.value;
|
|
|
|
|
querys.isLock = val;
|
|
|
|
|
querys.connectTime = timestampToFormattedDate(new Date().getTime());
|
|
|
|
|
addOrUpdateRedisUser(querys);
|
|
|
|
|
};
|
|
|
|
|
const isLocked = ref(false);
|
|
|
|
|
// 判断有没有redis用户锁
|
|
|
|
|
const lockedClient = () => {
|
|
|
|
|
};
|
|
|
|
|
const isLocked = ref(false);
|
|
|
|
|
// 判断有没有redis用户锁
|
|
|
|
|
const lockedClient = () => {
|
|
|
|
|
getLockedClients().then((res) => {
|
|
|
|
|
if (res.length > 0) {
|
|
|
|
|
res.forEach((item, index) => {
|
|
|
|
@ -162,19 +239,33 @@ const lockedClient = () => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// 一键起飞
|
|
|
|
|
const takeOff = () => {
|
|
|
|
|
};
|
|
|
|
|
// 一键起飞
|
|
|
|
|
const takeOff = () => {
|
|
|
|
|
if (isLocked.value) {
|
|
|
|
|
createMessage.warning('当前有用户正在操作,请稍后再试');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isTakeOff.value) {
|
|
|
|
|
createMessage.warning('请勿重复操作');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emits('clickTakeOff');
|
|
|
|
|
changeRedisUser(true);
|
|
|
|
|
};
|
|
|
|
|
// 获取
|
|
|
|
|
const obtain = () => {
|
|
|
|
|
};
|
|
|
|
|
// 指点飞行
|
|
|
|
|
const flyTo = () => {
|
|
|
|
|
console.log('飞行器状态', props.uavStatus);
|
|
|
|
|
console.log('是否一键起飞', !isTakeOff.value);
|
|
|
|
|
console.log(props.uavStatus == 0 && !isTakeOff.value);
|
|
|
|
|
if (!props.uavStatus && !isTakeOff.value) {
|
|
|
|
|
createMessage.warning('飞行器未开机');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emits('clickFlyTo');
|
|
|
|
|
};
|
|
|
|
|
// 获取
|
|
|
|
|
const obtain = () => {
|
|
|
|
|
// if (!getClient()) {
|
|
|
|
|
// createConnection();
|
|
|
|
|
// }
|
|
|
|
@ -182,6 +273,10 @@ const obtain = () => {
|
|
|
|
|
createMessage.warning('当前有用户正在操作,请稍后再试');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (props.uavStatus == 0 && !isTakeOff.value) {
|
|
|
|
|
createMessage.warning('飞行器未开机');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (flightGrab.value) {
|
|
|
|
|
createMessage.warning('已经获取了飞行器控制权');
|
|
|
|
|
return;
|
|
|
|
@ -207,10 +302,14 @@ const obtain = () => {
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
services_replyTopic();
|
|
|
|
|
};
|
|
|
|
|
// 一键返航
|
|
|
|
|
const returnBtn = ref(false);
|
|
|
|
|
const returnVoyage = () => {
|
|
|
|
|
};
|
|
|
|
|
// 一键返航
|
|
|
|
|
const returnBtn = ref(false);
|
|
|
|
|
const returnVoyage = () => {
|
|
|
|
|
if (props.uavStatus == 0 && !isTakeOff.value) {
|
|
|
|
|
createMessage.warning('飞行器未开机');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (returnBtn.value) {
|
|
|
|
|
createMessage.warning('正在返航或已返航,请勿重复操作');
|
|
|
|
|
return;
|
|
|
|
@ -223,12 +322,12 @@ const returnVoyage = () => {
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
|
data: {},
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const seq = ref(1);
|
|
|
|
|
const longPressTimer = ref();
|
|
|
|
|
const longPressInterval = ref();
|
|
|
|
|
const longPressDuration = ref(1000);// 长按时间阈值,单位为毫秒
|
|
|
|
|
const changeDRC = (type, value, name) => {
|
|
|
|
|
};
|
|
|
|
|
const seq = ref(1);
|
|
|
|
|
const longPressTimer = ref();
|
|
|
|
|
const longPressInterval = ref();
|
|
|
|
|
const longPressDuration = ref(1000); // 长按时间阈值,单位为毫秒
|
|
|
|
|
const changeDRC = (type, value, name) => {
|
|
|
|
|
selectName.value = name;
|
|
|
|
|
if (name !== '') {
|
|
|
|
|
console.log('鼠标按下');
|
|
|
|
@ -249,7 +348,7 @@ const changeDRC = (type, value, name) => {
|
|
|
|
|
let querys = getDRCFlightQuery(type, value, seq);
|
|
|
|
|
drcDownTopicReize(querys);
|
|
|
|
|
createMessage.info(name + '指令已发送');
|
|
|
|
|
}, 1000)
|
|
|
|
|
}, 1000);
|
|
|
|
|
}, longPressDuration.value);
|
|
|
|
|
if (isLongPress) {
|
|
|
|
|
isLongPress = false;
|
|
|
|
@ -259,7 +358,6 @@ const changeDRC = (type, value, name) => {
|
|
|
|
|
let querys = getDRCFlightQuery(type, value, seq);
|
|
|
|
|
drcDownTopicReize(querys);
|
|
|
|
|
createMessage.info(name + '指令已发送');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (longPressTimer.value) {
|
|
|
|
|
clearTimeout(longPressTimer.value);
|
|
|
|
@ -273,8 +371,8 @@ const changeDRC = (type, value, name) => {
|
|
|
|
|
}
|
|
|
|
|
console.log('鼠标松开');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const getDRCFlightQuery = (type, value, seq) => {
|
|
|
|
|
};
|
|
|
|
|
const getDRCFlightQuery = (type, value, seq) => {
|
|
|
|
|
let data = {
|
|
|
|
|
roll: 1024,
|
|
|
|
|
pitch: 1024,
|
|
|
|
@ -297,9 +395,15 @@ const getDRCFlightQuery = (type, value, seq) => {
|
|
|
|
|
};
|
|
|
|
|
console.log(querys);
|
|
|
|
|
return querys;
|
|
|
|
|
};
|
|
|
|
|
const drcSeq = ref(1);
|
|
|
|
|
const enterDRC = () => {
|
|
|
|
|
};
|
|
|
|
|
const drcSeq = ref(1);
|
|
|
|
|
let drc_mode_enter_timer;
|
|
|
|
|
const drc_mode_enter_val = ref(1);
|
|
|
|
|
const enterDRC = () => {
|
|
|
|
|
if (props.uavStatus == 0 && !isTakeOff.value) {
|
|
|
|
|
createMessage.warning('飞行器未开机');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!flightGrab.value) {
|
|
|
|
|
createMessage.warning('请先获取飞行控制权');
|
|
|
|
|
return;
|
|
|
|
@ -317,6 +421,7 @@ const enterDRC = () => {
|
|
|
|
|
address: connectUrl,
|
|
|
|
|
// client_id: 'mqtt_client_1581F8HGX254V00A0BUY',
|
|
|
|
|
client_id: 'mqtt_client_1581F8HGX254V00A0BUYSeize',
|
|
|
|
|
// client_id: 'mqttx_' + Math.random().toString(16).substring(2, 8),
|
|
|
|
|
enable_tls: false,
|
|
|
|
|
expire_time: 3600,
|
|
|
|
|
password: '',
|
|
|
|
@ -331,9 +436,19 @@ const enterDRC = () => {
|
|
|
|
|
servicesTopic(querys);
|
|
|
|
|
drc_eart_beat();
|
|
|
|
|
drcUpTopic();
|
|
|
|
|
};
|
|
|
|
|
let timer;
|
|
|
|
|
const drc_eart_beat = () => {
|
|
|
|
|
drc_mode_enter_timer = window.setInterval(() => {
|
|
|
|
|
if (drc_mode_enter_val.value > 30) {
|
|
|
|
|
window.clearInterval(drc_mode_enter_timer);
|
|
|
|
|
drc_mode_enter_timer = null;
|
|
|
|
|
drc_mode_enter_val.value = 0;
|
|
|
|
|
createMessage.error('进入指令飞行控制模式失败,无响应');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
drc_mode_enter_val.value++;
|
|
|
|
|
}, 1000);
|
|
|
|
|
};
|
|
|
|
|
let timer;
|
|
|
|
|
const drc_eart_beat = () => {
|
|
|
|
|
monitorDRC.value = true;
|
|
|
|
|
// 每隔五秒发送drc心跳包
|
|
|
|
|
timer = window.setInterval(() => {
|
|
|
|
@ -352,8 +467,12 @@ const drc_eart_beat = () => {
|
|
|
|
|
}, 5000);
|
|
|
|
|
// 订阅drc链路状态通知
|
|
|
|
|
eventsTopicSubscribe();
|
|
|
|
|
};
|
|
|
|
|
const exitDRC = () => {
|
|
|
|
|
};
|
|
|
|
|
const exitDRC = () => {
|
|
|
|
|
if (props.uavStatus == 0 && !isTakeOff.value) {
|
|
|
|
|
createMessage.warning('飞行器未开机');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
createMessage.info('正在退出飞行控制,请稍后');
|
|
|
|
|
const querys = {
|
|
|
|
|
bid: bid,
|
|
|
|
@ -363,8 +482,8 @@ const exitDRC = () => {
|
|
|
|
|
method: 'drc_mode_exit',
|
|
|
|
|
};
|
|
|
|
|
servicesTopic(querys);
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// 获取mqtt客户端信息
|
|
|
|
|
getRedisUser(userInfo.id).then((res) => {
|
|
|
|
|
if (res) {
|
|
|
|
@ -401,8 +520,10 @@ onMounted(() => {
|
|
|
|
|
modeEnter.value = false;
|
|
|
|
|
createMessage.success('退出指令飞行控制模式成功');
|
|
|
|
|
changeRedisUser(false);
|
|
|
|
|
window.clearInterval(drc_mode_enter_timer);
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('退出指令飞行控制模式失败,' + errorName(rs.data.result));
|
|
|
|
|
window.clearInterval(drc_mode_enter_timer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 一键返航
|
|
|
|
@ -419,6 +540,8 @@ onMounted(() => {
|
|
|
|
|
if (rs.method === 'takeoff_to_point') {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('一键起飞成功');
|
|
|
|
|
isTakeOff.value = true;
|
|
|
|
|
EventBus.emit('closeTranslation', null);
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('一键起飞失败,' + errorName(rs.data.result));
|
|
|
|
|
}
|
|
|
|
@ -437,21 +560,23 @@ onMounted(() => {
|
|
|
|
|
if (rs.method == 'fly_to_point') {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('指点飞行成功');
|
|
|
|
|
EventBus.emit('closeTranslation', null);
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('指点飞行失败,' + errorName(rs.data.result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
});
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
window.clearInterval(timer);
|
|
|
|
|
window.clearInterval(drc_mode_enter_timer);
|
|
|
|
|
destroySeizeConnection();
|
|
|
|
|
changeRedisUser(false);
|
|
|
|
|
monitorDRC.value = false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.flight-control {
|
|
|
|
|
.flight-control {
|
|
|
|
|
width: 96%;
|
|
|
|
|
height: 98%;
|
|
|
|
|
padding: 10px 20px;
|
|
|
|
@ -553,5 +678,5 @@ onUnmounted(() => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|