云台控制、变焦、优化拖拽出屏幕外的问题

main
刘妍 2 months ago
parent 832f220e2d
commit 03afd157bc

@ -8,6 +8,7 @@ const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { createMessage } = useMessage();
const seizeClientId = 'mqtt_client_1581F8HGX254V00A0BUY_seize';
const connection = {
protocol: 'ws',
host: '175.27.168.120',
@ -75,8 +76,8 @@ const createConnection = (callback?) => {
const connectUrl = `${protocol}://${host}:${port}${endpoint}`;
client = mqtt.connect(connectUrl, options);
client.on('connect', () => {
if(callback){
callback()
if (callback) {
callback();
}
});
});
@ -147,7 +148,7 @@ let client_seize: any = {
};
const createSeizeConnection = () => {
const seizeConnection = connection;
seizeConnection.clientId = 'mqtt_client_1581F8HGX254V00A0BUY_seize';
seizeConnection.clientId = seizeClientId;
try {
const { protocol, host, port, endpoint, ...options } = seizeConnection;
const connectUrl = `${protocol}://${host}:${port}${endpoint}`;
@ -200,6 +201,8 @@ const clientReizePublish = (topic: string, querys: any) => {
});
};
export {
connection,
seizeClientId,
// 连接
createConnection,
destroyConnection,

@ -1,6 +1,6 @@
<template>
<div>
<div style="width: 100%; height: 100vh">
<div style="width: calc(100vw - 226px); height: calc(100vh - 20px)">
<Map :airRoute="airRoute" @flyToThere="flyToThere" :airPort="airPort" :uavTrack="uavTrack" />
</div>
<SelectComponent @selectChange="changeSelect" />
@ -20,37 +20,45 @@
<RemoteDebugging @changeRemote="changeRemote" :msgData="msgData" />
</div> -->
<!-- 负载控制 -->
<div v-if="loadControlVisible">
<LoadControl @changeLoadControl="changeLoadControl" :msgData="msgData" />
</div>
<LoadControl
v-if="loadControlVisible"
@changeLoadControl="changeLoadControl"
:msgData="msgData"
:cameraType="cameraType"
/>
<!-- 飞行控制 -->
<div v-if="flightControlVisible">
<FlightControl
@changeFlightControl="changeFlightControl"
@clickTakeOff="clickTakeOff"
@clickFlyTo="clickFlyTo"
/>
</div>
<FlightControl
@changeFlightControl="changeFlightControl"
@clickTakeOff="clickTakeOff"
@clickFlyTo="clickFlyTo"
v-if="flightControlVisible"
/>
<!-- 一键起飞表单 -->
<div v-if="takeOffFormVisible">
<TakeOffForm @changeTakeOffForm="changeTakeOffForm" :locationVal="locationVal" />
</div>
<TakeOffForm
v-if="takeOffFormVisible"
@changeTakeOffForm="changeTakeOffForm"
:locationVal="locationVal"
/>
<!-- 指点飞行表单 -->
<div v-if="flyToFormVisible">
<FlyToForm @changeFlyToForm="changeFlyToForm" :locationVal="locationVal" />
</div>
<div class="AirportLive" v-if="airportLiveVisible" v-drag>
<AirportLive :msgData="msgData" />
</div>
<div
class="LivePreview"
<FlyToForm
v-if="flyToFormVisible"
@changeFlyToForm="changeFlyToForm"
:locationVal="locationVal"
/>
<AirportLive
:msgData="msgData"
v-if="airportLiveVisible"
@changeAirportLive="airportLiveVisible = false"
/>
<LivePreview
v-if="livePreviewVisible"
:style="{ bottom: airportLiveVisible ? '400px' : '20px' }"
v-drag
>
<LivePreview :msgData="msgData" :uavLive="uavLive" />
</div>
:msgData="msgData"
:uavLive="uavLive"
:airportLiveVisible="airportLiveVisible"
@loadLiveStreaming="livePreviewVisible = false"
@changeCameraType="changeCameraType"
/>
</div>
</template>
<script setup lang="ts">
@ -157,6 +165,11 @@
const changeFlyToForm = () => {
flyToFormVisible.value = false;
};
const cameraType = ref('wide');
const changeCameraType = (value: any) => {
console.log(value);
cameraType.value = value;
};
const msgData = ref();
const changeSelect = async (value?: any) => {
//
@ -256,6 +269,7 @@
bottom: 20px;
}
.LivePreview {
width: 100%;
position: absolute;
right: 10px;
bottom: 20px;

@ -1,42 +1,42 @@
<template>
<div id="airport">
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
@dragging="changeSize"
@resizing="changeSize"
>
<div class="airport-live">
<div class="airport-title">
<div class="title">机场直播</div>
<div class="title-icon">
<RedoOutlined @click="startLiveFun" />
<!-- <a-divider type="vertical" style="border-color: #4e5778" /> -->
<!-- <ExpandOutlined /> -->
<a-divider type="vertical" style="border-color: #4e5778" />
<PoweroffOutlined @click="closeLive" />
</div>
</div>
<div class="player" :style="{ height: height - 50 + 'px' }">
<video
id="player-container-id"
:width="width"
:height="height"
preload="auto"
playsinline
webkit-playsinline
>
</video>
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
@dragging="changeSize"
@resizing="changeSize"
>
<div class="airport-live">
<div class="airport-title">
<div class="title">机场直播</div>
<div class="title-icon">
<PlayCircleOutlined title="开始直播" @click="startLiveFun" />
<a-divider type="vertical" style="border-color: #4e5778" />
<RedoOutlined title="刷新" @click="reloadLive" />
<!-- <ExpandOutlined /> -->
<a-divider type="vertical" style="border-color: #4e5778" />
<PoweroffOutlined title="停止直播" @click="closeLive" />
</div>
</div>
</VueDragResize>
</div>
<div class="player" :style="{ height: height - 50 + 'px' }">
<video
id="player-container-id"
:width="width"
:height="height"
preload="auto"
playsinline
webkit-playsinline
>
</video>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { RedoOutlined, ExpandOutlined, PoweroffOutlined } from '@ant-design/icons-vue';
import { RedoOutlined, PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons-vue';
import { onMounted, onBeforeUnmount, watch, ref } from 'vue';
import { startLive, endLive } from '@/api/workmanagement/airportMaintenance';
import TCPlayer from 'tcplayer.js';
@ -48,19 +48,23 @@
import { getClient } from '@/utils/mqtt';
import VueDragResize from 'vue-drag-resize/src';
const pageHeight = document.documentElement.clientHeight;
const pageWidth = document.documentElement.clientWidth;
const width = ref(500);
const height = ref(348);
const left = ref(0);
const top = ref(0);
const left = ref(pageWidth - 800);
const top = ref(pageHeight - 500);
const axisVal = ref('none');
const airPortStoreVal = airPortStore();
const live_info = airPortStoreVal.getLiveInfo;
const airPort = airPortStoreVal.getAirport;
const { createMessage } = useMessage();
const emits = defineEmits(['changeAirportLive']);
const props = defineProps({
msgData: Object,
});
let player;
const liveCode = ref('7');
const liveCode = ref('5');
watch(
() => props.msgData,
(val) => {
@ -96,6 +100,11 @@
},
};
servicesTopic(querys);
emits('changeAirportLive');
};
const reloadLive = () => {
player.src(live_info.url + liveCode.value + '.flv');
player.play();
};
onMounted(() => {
setTimeout(() => {
@ -152,10 +161,6 @@
width: 100%;
height: 100%;
}
#airport {
width: 500px;
height: 348px;
}
.airport-live {
width: 100%;
height: 100%;

@ -1,78 +1,89 @@
<template>
<div id="flight">
<VueDragResize :w="width" :h="height" :x="left" :y="top" :isActive="true" :isResizable="false">
<div class="flight-control" v-if="airportVal" v-drag>
<div class="title">
<div>
飞行控制
<!-- {"0":"空闲中","1":"现场调试","2":"远程调试","3":"固件升级中","4":"作业中","5":"待标定"} -->
<i v-if="airportVal.mode_code == 0"> </i>
<i v-else-if="airportVal.mode_code == 1">现场调试 </i>
<i v-else-if="airportVal.mode_code == 2">远程调试 </i>
<i v-else-if="airportVal.mode_code == 3">固件升级中 </i>
<i v-else-if="airportVal.mode_code == 4">作业中 </i>
<i v-else-if="airportVal.mode_code == 5">待标定 </i>
</div>
<div @click="emits('changeFlightControl')">
<CloseOutlined />
</div>
<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>
飞行控制
<!-- {"0":"空闲中","1":"现场调试","2":"远程调试","3":"固件升级中","4":"作业中","5":"待标定"} -->
<i v-if="airportVal.mode_code == 0"> </i>
<i v-else-if="airportVal.mode_code == 1">现场调试 </i>
<i v-else-if="airportVal.mode_code == 2">远程调试 </i>
<i v-else-if="airportVal.mode_code == 3">固件升级中 </i>
<i v-else-if="airportVal.mode_code == 4">作业中 </i>
<i v-else-if="airportVal.mode_code == 5">待标定 </i>
</div>
<div class="content">
<div class="content-button">
<a-button @click="takeOff"></a-button>
<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="exitDRC" style="background-color: #e3150e; border: none"
>退出飞行控制</a-button
>
<div @click="emits('changeFlightControl')">
<CloseOutlined />
</div>
</div>
<div class="content">
<div class="content-button">
<a-button @click="takeOff"></a-button>
<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="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="上升" @click="changeDRC('throttle', 'up')">
<img src="@/assets/images/flightoperation/top.png" alt="" />
</div>
<div class="info-item-right" title="右旋转" @click="changeDRC('yaw', 'up')">
<img src="@/assets/images/flightoperation/right.png" alt="" />
</div>
<div class="info-item-bottom" title="下降" @click="changeDRC('throttle', 'down')">
<img src="@/assets/images/flightoperation/bottom.png" alt="" />
</div>
<div class="info-item-left" title="左旋转" @click="changeDRC('yaw', 'down')">
<img src="@/assets/images/flightoperation/left.png" alt="" />
</div>
</div>
<div class="content-info">
<div class="info-item">
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
<div class="info-item-top" title="上升" @click="changeDRC('throttle', 'up')">
<img src="@/assets/images/flightoperation/top.png" alt="" />
</div>
<div class="info-item-right" title="右旋转" @click="changeDRC('yaw', 'up')">
<img src="@/assets/images/flightoperation/right.png" alt="" />
</div>
<div class="info-item-bottom" title="下降" @click="changeDRC('throttle', 'down')">
<img src="@/assets/images/flightoperation/bottom.png" alt="" />
</div>
<div class="info-item-left" title="左旋转" @click="changeDRC('yaw', 'down')">
<img src="@/assets/images/flightoperation/left.png" alt="" />
</div>
<div class="info-item">
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
<div class="info-item-top" title="前进" @click="changeDRC('pitch', 'up')">
<img src="@/assets/images/flightoperation/top.png" alt="" />
</div>
<div class="info-item-right" title="右移" @click="changeDRC('roll', 'up')">
<img src="@/assets/images/flightoperation/right.png" alt="" />
</div>
<div class="info-item-bottom" title="后退" @click="changeDRC('pitch', 'down')">
<img src="@/assets/images/flightoperation/bottom.png" alt="" />
</div>
<div class="info-item">
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
<div class="info-item-top" title="前进" @click="changeDRC('pitch', 'up')">
<img src="@/assets/images/flightoperation/top.png" alt="" />
</div>
<div class="info-item-right" title="右移" @click="changeDRC('roll', 'up')">
<img src="@/assets/images/flightoperation/right.png" alt="" />
</div>
<div class="info-item-bottom" title="后退" @click="changeDRC('pitch', 'down')">
<img src="@/assets/images/flightoperation/bottom.png" alt="" />
</div>
<div class="info-item-left" title="左移" @click="changeDRC('roll', 'down')">
<img src="@/assets/images/flightoperation/left.png" alt="" />
</div>
<div class="info-item-left" title="左移" @click="changeDRC('roll', 'down')">
<img src="@/assets/images/flightoperation/left.png" alt="" />
</div>
</div>
</div>
</div>
</VueDragResize>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { onMounted, ref, watch, reactive, onUnmounted } from 'vue';
import { getClient, createSeizeConnection, destroySeizeConnection } from '@/utils/mqtt';
import {
getClient,
createSeizeConnection,
destroySeizeConnection,
connection,
} from '@/utils/mqtt';
import { CloseOutlined } from '@ant-design/icons-vue';
import { vDrag } from '@/utils/drag';
import { drcDownTopicReize, eventsTopicSubscribeReize } from '@/utils/debugging/events';
@ -93,6 +104,10 @@
import { useUserStore } from '@/store/modules/user';
import { timestampToFormattedDate } from '@/utils/index';
import VueDragResize from 'vue-drag-resize/src';
import { airPortStore } from '@/store/modules/airport';
const airPortStoreVal = airPortStore();
const uav = airPortStoreVal.getUAV;
const width = ref(380);
const height = ref(390);
@ -180,7 +195,7 @@
tid: buildGUID(),
timestamp: new Date().getTime(),
data: {
payload_index: '99-0-0',
payload_index: uav.camera_index,
},
});
services_replyTopic();
@ -235,12 +250,14 @@
createSeizeConnection();
createMessage.info('正在进入飞行控制,请稍后');
//
const { protocol, host, port, endpoint } = connection;
const connectUrl = `${protocol}://${host}:${port}${endpoint}`;
const querys = {
bid: buildGUID(),
data: {
hsi_frequency: 10,
mqtt_broker: {
address: 'ws://175.27.168.120:6010/mqtt',
address: connectUrl,
// client_id: 'mqtt_client_1581F8HGX254V00A0BUY',
client_id: 'mqtt_client_1581F8HGX254V00A0BUYSeize',
enable_tls: false,
@ -375,10 +392,6 @@
});
</script>
<style lang="less" scoped>
#flight {
width: 380px;
height: 390px;
}
.flight-control {
width: 96%;
height: 98%;

@ -1,44 +1,54 @@
<template>
<div class="takeoff-information">
<div class="title"
>指点飞行
<div @click="emits('changeFlyToForm')">
<CloseOutlined />
</div>
</div>
<div class="content">
<div class="content-edit">
目标点纬度
<div style="display: flex; flex-direction: column; align-items: center">
<a-input v-model:value="data.points[0].latitude" readonly />
<span style="margin-top: 4px; font-size: 12px; color: #f2762d">地图右键选择目标点</span>
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
:isResizable="false"
>
<div class="takeoff-information">
<div class="title"
>指点飞行
<div @click="emits('changeFlyToForm')">
<CloseOutlined />
</div>
</div>
<div class="content-edit">
目标点经度
<div>
<a-input v-model:value="data.points[0].longitude" readonly />
<div class="content">
<div class="content-edit">
目标点纬度
<div style="display: flex; flex-direction: column; align-items: center">
<a-input v-model:value="data.points[0].latitude" readonly />
<span style="margin-top: 4px; font-size: 12px; color: #f2762d">地图右键选择目标点</span>
</div>
</div>
</div>
<div class="content-edit">
目标点高度
<div>
<a-input v-model:value="data.points[0].height" />
<div class="content-edit">
目标点经度
<div>
<a-input v-model:value="data.points[0].longitude" readonly />
</div>
</div>
<div class="content-edit">
目标点高度
<div>
<a-input v-model:value="data.points[0].height" />
</div>
</div>
<div class="content-button">
<a-button
type="primary"
style="background: #0a99eb; width: 40%"
@click="emits('changeFlyToForm')"
>关闭</a-button
>
<a-button type="primary" style="background: #3a57e8; width: 40%" @click="takeOff"
>起飞</a-button
>
</div>
</div>
<div class="content-button">
<a-button
type="primary"
style="background: #0a99eb; width: 40%"
@click="emits('changeFlyToForm')"
>关闭</a-button
>
<a-button type="primary" style="background: #3a57e8; width: 40%" @click="takeOff"
>起飞</a-button
>
</div>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue';
@ -50,7 +60,12 @@
import { CloseOutlined } from '@ant-design/icons-vue';
import { Map } from '../index';
import { EventBus } from '@/utils/eventBus';
import VueDragResize from 'vue-drag-resize/src';
const width = ref(460);
const height = ref(260);
const left = ref(300);
const top = ref(120);
const emits = defineEmits(['changeFlyToForm']);
const props = defineProps({
msgData: Object,
@ -96,11 +111,9 @@
</script>
<style lang="less" scoped>
.takeoff-information {
position: absolute;
top: 120px;
left: 300px;
z-index: 999;
width: 460px;
width: 96%;
height: 98%;
padding: 10px;
background: #0d0e15;
margin: 10px 0 0 10px;

@ -1,62 +1,64 @@
<template>
<div id="live">
<VueDragResize
:w="width"
:h="height"
:isActive="true"
@dragging="changeSize"
@resizing="changeSize"
>
<div class="live-preview">
<div class="preview-title">
<div class="title-select">
<div class="title-select-item">
<span>镜头:</span>
<a-select
ref="select"
v-model:value="selectVal.camera"
style="width: 60px"
:options="optionsArr.cameraOptions"
@change="cameraChange"
/>
</div>
<div class="title-select-item">
<span>分辨率:</span>
<a-select
ref="select"
v-model:value="selectVal.resolution"
style="width: 80px"
:options="optionsArr.resolutionOptions"
@change="resolutionChange"
/>
</div>
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
@dragging="changeSize"
@resizing="changeSize"
>
<div class="live-preview">
<div class="preview-title">
<div class="title-select">
<div class="title-select-item">
<span>镜头:</span>
<a-select
ref="select"
v-model:value="selectVal.camera"
style="width: 60px"
:options="optionsArr.cameraOptions"
@change="cameraChange"
/>
</div>
<div class="title-icon">
<RedoOutlined @click="startLiveFun" />
<!-- <a-divider type="vertical" style="border-color: #4e5778" /> -->
<!-- <ExpandOutlined /> -->
<a-divider type="vertical" style="border-color: #4e5778" />
<PoweroffOutlined @click="closeLive" />
<div class="title-select-item">
<span>分辨率:</span>
<a-select
ref="select"
v-model:value="selectVal.resolution"
style="width: 80px"
:options="optionsArr.resolutionOptions"
@change="resolutionChange"
/>
</div>
</div>
<div class="live-type">广角</div>
<div class="player" :style="{ height: height - 60 + 'px' }">
<video
id="player-container-id-live"
:width="width"
:height="height"
preload="auto"
playsinline
webkit-playsinline
>
</video>
<div class="title-icon">
<PlayCircleOutlined title="开始直播" @click="startLiveFun" />
<a-divider type="vertical" style="border-color: #4e5778" />
<RedoOutlined title="刷新" @click="reloadLive" />
<!-- <ExpandOutlined /> -->
<a-divider type="vertical" style="border-color: #4e5778" />
<PoweroffOutlined title="停止直播" @click="closeLive" />
</div>
</div>
</VueDragResize>
</div>
<div class="live-type">{{ cameraType }}</div>
<div class="player" :style="{ height: height - 60 + 'px' }">
<video
id="player-container-id-live"
:width="width"
:height="height"
preload="auto"
playsinline
webkit-playsinline
>
</video>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { RedoOutlined, ExpandOutlined, PoweroffOutlined } from '@ant-design/icons-vue';
import { RedoOutlined, PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons-vue';
import { reactive, onMounted, ref, watch, onBeforeUnmount } from 'vue';
import { buildGUID } from '@/utils/uuid';
import { getClient, createConnection } from '@/utils/mqtt';
@ -73,25 +75,35 @@
import { airPortStore } from '@/store/modules/airport';
import VueDragResize from 'vue-drag-resize/src';
const width = ref(500);
const height = ref(348);
const airPortStoreVal = airPortStore();
const live_info = airPortStoreVal.getLiveInfo;
const uav = airPortStoreVal.getUAV;
const { createMessage } = useMessage();
const emits = defineEmits(['loadLiveStreaming', 'changeCameraType']);
const props = defineProps({
msgData: Object,
uavLive: Boolean,
airportLiveVisible: Boolean,
});
const pageHeight = document.documentElement.clientHeight;
const pageWidth = document.documentElement.clientWidth;
const width = ref(500);
const height = ref(348);
const left = ref(pageWidth - 800);
const top = ref(pageHeight - 500);
if (props.airportLiveVisible) {
top.value = pageHeight - 100;
}
let player;
const liveCode = ref('6');
watch(
() => props.msgData,
(val) => {},
);
const cameraType = ref('广角');
const selectVal = reactive({
camera: 'normal',
camera: 'wide',
resolution: 3,
});
const optionsArr = reactive({
@ -100,10 +112,6 @@
label: '红外',
value: 'ir',
},
{
label: '默认',
value: 'normal',
},
{
label: '广角',
value: 'wide',
@ -166,6 +174,12 @@
servicesTopic(querys);
};
const cameraChange = (val: any) => {
optionsArr.cameraOptions.forEach((item) => {
if (item.value === selectVal.camera) {
cameraType.value = item.label;
}
});
emits('changeCameraType', val);
const querys = {
bid: buildGUID(),
method: 'live_lens_change',
@ -205,6 +219,11 @@
},
};
servicesTopic(querys);
emits('loadLiveStreaming');
};
const reloadLive = () => {
player.src(live_info.url + liveCode.value + '.flv');
player.play();
};
onMounted(() => {
setTimeout(() => {

@ -1,67 +1,69 @@
<template>
<div id="remote">
<VueDragResize :w="width" :h="height" :x="left" :y="top" :isActive="true" :isResizable="false">
<div class="remote-debugging" v-if="airportVal" v-drag>
<div class="title">
<span> 云台相机控制 </span>
<div @click="emits('changeLoadControl')">
<CloseOutlined />
</div>
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
:isResizable="false"
>
<div class="remote-debugging" v-if="airportVal" v-drag>
<div class="title">
<span> 云台相机控制 </span>
<div @click="emits('changeLoadControl')">
<CloseOutlined />
</div>
<div class="content">
<!-- <div class="content-item">
<span>相机控制权</span>
<a-button @click="obtain"></a-button>
</div> -->
<!-- <div class="content-item">
<span>切换相机模式</span>
<a-button>抢夺负载控制</a-button>
</div> -->
<!-- <div class="content-item">
<span>拍照</span>
<a-button @click="singleShot"></a-button>
</div> -->
<div class="content-button">
<a-button @click="obtain"></a-button>
<a-button @click="singleShot"></a-button>
<a-button @click="enterDRC" style="background-color: #24d365; border: none"
>进入飞行控制</a-button
>
<a-button @click="exitDRC" style="background-color: #e3150e; border: none"
>退出飞行控制</a-button
>
</div>
<div class="direction-controller">
<img src="@/assets/images/flightoperation/direction_controller.png" alt="" />
<div
class="direction-controller-top"
title="前进"
@click="changeDrc('pitch', 'top')"
></div>
<div
class="direction-controller-right"
title="右移"
@click="changeDrc('roll', 'right')"
></div>
<div
class="direction-controller-bottom"
title="后退"
@click="changeDrc('pitch', 'bottom')"
></div>
<div
class="direction-controller-left"
title="左移"
@click="changeDrc('roll', 'left')"
></div>
</div>
</div>
<div class="content">
<div class="content-button">
<a-button @click="obtain"></a-button>
<a-button @click="singleShot"></a-button>
</div>
<div class="direction-controller">
<img src="@/assets/images/flightoperation/direction_controller.png" alt="" />
<div
class="direction-controller-top"
title="俯视"
@click="changeDrc('pitch_speed', 'up')"
></div>
<div
class="direction-controller-right"
title="右移"
@click="changeDrc('yaw_speed', 'up')"
></div>
<div
class="direction-controller-bottom"
title="仰视"
@click="changeDrc('pitch_speed', 'down')"
></div>
<div
class="direction-controller-left"
title="左移"
@click="changeDrc('yaw_speed', 'down')"
></div>
</div>
<div class="zoom">
<a-slider
v-model:value="zoomVale"
:tooltip-visible="true"
:max="maxval"
:min="2"
@change="cameraZoom"
/>
</div>
</div>
</VueDragResize>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { onMounted, ref, watch, reactive, onUnmounted } from 'vue';
import { getClient, createSeizeConnection, destroySeizeConnection } from '@/utils/mqtt';
import {
getClient,
createSeizeConnection,
destroySeizeConnection,
connection,
} from '@/utils/mqtt';
import { CloseOutlined } from '@ant-design/icons-vue';
import { vDrag } from '@/utils/drag';
import { buildGUID } from '@/utils/uuid';
@ -89,6 +91,7 @@
const top = ref(100);
const airPortStoreVal = airPortStore();
const airPort = airPortStoreVal.getAirport;
const uav = airPortStoreVal.getUAV;
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
@ -97,12 +100,11 @@
const emits = defineEmits(['changeLoadControl']);
const props = defineProps({
msgData: Object,
cameraType: String,
});
const monitorDRC = ref(false);
//
const flightGrab = ref(false);
//
const modeEnter = ref(false);
const airportVal: any = ref({
mode_code: 0,
wind_speed: 0,
@ -117,14 +119,45 @@
capacity_percent: 0,
},
});
const zoomVale = ref(2);
const maxval = ref(200);
watch(
() => props.msgData,
() => props.cameraType,
(val) => {
if (val.topic == 'thing/product/' + airPort.sn + '/events_reply') {
console.log(val);
console.log('props.cameraType', val);
if (val == 'ir') {
maxval.value = 20;
} else {
maxval.value = 200;
}
cameraZoom();
},
);
//
const cameraZoom = () => {
if (!flightGrab.value) {
createMessage.warning('请先获取相机控制权');
return;
}
if (props.cameraType == 'wide') {
createMessage.warning('广角相机不支持变焦,请先调整相机模式');
return;
}
const querys = {
bid: buildGUID(),
method: 'camera_focal_length_set',
tid: buildGUID(),
timestamp: new Date().getTime(),
data: {
payload_index: uav.camera_index,
camera_type: props.cameraType,
zoom_factor: zoomVale.value,
},
};
console.log('querys', querys);
servicesTopicReize(querys);
};
//redis
const changeRedisUser = (val: boolean) => {
const querys = redisUser.value;
@ -170,7 +203,7 @@
tid: buildGUID(),
timestamp: new Date().getTime(),
data: {
payload_index: '99-0-0',
payload_index: uav.camera_index,
},
});
services_replyTopic();
@ -189,98 +222,37 @@
tid: buildGUID(),
timestamp: new Date().getTime(),
data: {
payload_index: '99-0-0',
payload_index: uav.camera_index,
},
});
services_replyTopicReize();
};
const drcSeq = ref(1);
const enterDRC = () => {
if (!flightGrab.value) {
createMessage.warning('请先获取相机控制权');
return;
}
createSeizeConnection();
//
const querys = {
bid: buildGUID(),
data: {
hsi_frequency: 10,
mqtt_broker: {
address: 'http://175.27.168.120:6010',
client_id: 'mqtt_client_1581F8HGX254V00A0BUY',
enable_tls: false,
expire_time: 3600,
password: '',
username: 'sdhc',
},
osd_frequency: 5,
},
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'drc_mode_enter',
};
console.log(querys);
servicesTopic(querys);
drc_eart_beat();
};
let timer;
const drc_eart_beat = () => {
monitorDRC.value = true;
// drc
drcSeq.value = drcSeq.value + 1;
timer = window.setInterval(() => {
const drcQuerys = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'heart_beat',
data: {
timestamp: new Date().getTime(),
},
seq: drcSeq.value,
};
drcDownTopicReize(drcQuerys);
}, 5000);
// drc
eventsTopicSubscribeReize();
};
const exitDRC = () => {
const querys = {
bid: buildGUID(),
data: {},
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'drc_mode_exit',
};
servicesTopic(querys);
};
const seq = ref(1);
//
const changeDrc = (type, val) => {
if (!modeEnter.value) {
createMessage.warning('请先进入指令飞行控制');
if (!flightGrab.value) {
createMessage.warning('请先获取相机控制权');
return;
}
seq.value = seq.value + 1;
let data = {
roll: 1024,
pitch: 1024,
throttle: 1024,
yaw: 1024,
gimbal_pitch: 1024,
payload_index: uav.camera_index,
locked: true,
pitch_speed: 8,
yaw_speed: 8,
};
if (val == 'up') {
data[type] = 1684;
data[type] = 8;
} else {
data[type] = 364;
data[type] = -8;
}
const querys = {
seq: seq.value,
method: 'stick_control',
//
servicesTopicReize({
bid: buildGUID(),
method: 'camera_screen_drag',
tid: buildGUID(),
timestamp: new Date().getTime(),
data: data,
};
drcDownTopicReize(querys);
});
};
onMounted(() => {
// mqtt
@ -294,39 +266,21 @@
// //
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
if (rs.method == 'flight_authority_grab') {
if (rs.method == 'camera_photo_take') {
if (rs.data.result == 0) {
flightGrab.value = true;
createMessage.success('飞行控制权抢夺成功');
createMessage.success('拍照成功');
} else {
flightGrab.value = false;
createMessage.error('飞行控制权抢夺失败,状态码' + rs.data.result);
}
}
if (rs.method == 'drc_mode_enter') {
if (rs.data.result == 0) {
modeEnter.value = true;
createMessage.success('进入指令飞行控制模式成功');
} else {
modeEnter.value = false;
createMessage.error('进入指令飞行控制模式失败,状态码' + rs.data.result);
}
}
if (rs.method == 'drc_mode_exit') {
if (rs.data.result == 0) {
modeEnter.value = false;
createMessage.success('退出指令飞行控制模式成功');
} else {
createMessage.error('退出指令飞行控制模式失败,状态码' + rs.data.result);
createMessage.error('拍照失败,状态码' + rs.data.result);
}
}
if (rs.method === 'drc_status_notify' && monitorDRC.value) {
if (rs.method == 'flight_authority_grab') {
if (rs.data.result == 0) {
if (rs.data.drc_state == 0) {
drc_eart_beat();
}
flightGrab.value = true;
createMessage.success('相机控制权获取成功');
} else {
createMessage.error('DRC连接失败状态码' + rs.data.result);
flightGrab.value = false;
createMessage.error('相机控制权获取失败,状态码' + rs.data.result);
}
}
});
@ -339,10 +293,6 @@
});
</script>
<style lang="less" scoped>
#remote {
width: 400px;
height: 440px;
}
.remote-debugging {
width: 96%;
height: 98%;
@ -422,7 +372,7 @@
height: 50px;
position: absolute;
top: 70px;
right: 80px;
right: 100px;
cursor: pointer;
}
.direction-controller-bottom {
@ -430,7 +380,7 @@
height: 50px;
position: absolute;
bottom: 20px;
right: 130px;
right: 160px;
cursor: pointer;
}
.direction-controller-left {
@ -442,5 +392,11 @@
cursor: pointer;
}
}
.zoom {
margin-top: 40px;
::v-deep .ant-slider-rail {
background: #435382;
}
}
}
</style>

@ -1,93 +1,103 @@
<template>
<div class="takeoff-information">
<div class="title"
>一键起飞
<div @click="emits('changeTakeOffForm')">
<CloseOutlined />
</div>
</div>
<div class="content">
<div class="content-edit">
目标点纬度
<div style="display: flex; flex-direction: column; align-items: center">
<a-input v-model:value="data.target_latitude" readonly />
<span style="margin-top: 4px; font-size: 12px; color: #f2762d">地图右键选择目标点</span>
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
:isResizable="false"
>
<div class="takeoff-information">
<div class="title"
>一键起飞
<div @click="emits('changeTakeOffForm')">
<CloseOutlined />
</div>
</div>
<div class="content-edit">
目标点经度
<div>
<a-input v-model:value="data.target_longitude" readonly />
<div class="content">
<div class="content-edit">
目标点纬度
<div style="display: flex; flex-direction: column; align-items: center">
<a-input v-model:value="data.target_latitude" readonly />
<span style="margin-top: 4px; font-size: 12px; color: #f2762d">地图右键选择目标点</span>
</div>
</div>
</div>
<div class="content-edit">
目标点高度
<div>
<a-input v-model:value="data.target_height" />
<div class="content-edit">
目标点经度
<div>
<a-input v-model:value="data.target_longitude" readonly />
</div>
</div>
</div>
<div class="content-edit">
安全起飞高度
<div>
<a-input v-model:value="data.security_takeoff_height" />
<div class="content-edit">
目标点高度
<div>
<a-input v-model:value="data.target_height" />
</div>
</div>
</div>
<div class="content-edit">
返航模式
<div>
<a-select v-model:value="data.rth_mode" :options="rth_modeOptions" />
<div class="content-edit">
安全起飞高度
<div>
<a-input v-model:value="data.security_takeoff_height" />
</div>
</div>
</div>
<div class="content-edit">
返航高度
<div>
<a-input v-model:value="data.rth_altitude" />
<div class="content-edit">
返航模式
<div>
<a-select v-model:value="data.rth_mode" :options="rth_modeOptions" />
</div>
</div>
</div>
<div class="content-edit">
遥控器失控动作
<div>
<a-select v-model:value="data.rc_lost_action" :options="rc_lost_actionOptions" />
<div class="content-edit">
返航高度
<div>
<a-input v-model:value="data.rth_altitude" />
</div>
</div>
</div>
<div class="content-edit">
指点飞行失控动作
<div>
<a-select
v-model:value="data.commander_mode_lost_action"
:options="commander_mode_lost_actionOptions"
/>
<div class="content-edit">
遥控器失控动作
<div>
<a-select v-model:value="data.rc_lost_action" :options="rc_lost_actionOptions" />
</div>
</div>
</div>
<div class="content-edit">
指点飞行模式
<div>
<a-select
v-model:value="data.commander_flight_mode"
:options="commander_flight_modeOptions"
/>
<div class="content-edit">
指点飞行失控动作
<div>
<a-select
v-model:value="data.commander_mode_lost_action"
:options="commander_mode_lost_actionOptions"
/>
</div>
</div>
</div>
<div class="content-edit">
指点飞行高度
<div>
<a-input v-model:value="data.commander_flight_height" />
<div class="content-edit">
指点飞行模式
<div>
<a-select
v-model:value="data.commander_flight_mode"
:options="commander_flight_modeOptions"
/>
</div>
</div>
<div class="content-edit">
指点飞行高度
<div>
<a-input v-model:value="data.commander_flight_height" />
</div>
</div>
</div>
<div class="content-button">
<a-button
type="primary"
style="background: #0a99eb; width: 40%"
@click="emits('changeTakeOffForm')"
>关闭</a-button
>
<a-button type="primary" style="background: #3a57e8; width: 40%" @click="takeOff"
>起飞</a-button
>
<div class="content-button">
<a-button
type="primary"
style="background: #0a99eb; width: 40%"
@click="emits('changeTakeOffForm')"
>关闭</a-button
>
<a-button type="primary" style="background: #3a57e8; width: 40%" @click="takeOff"
>起飞</a-button
>
</div>
</div>
</div>
</div>
</VueDragResize>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue';
@ -101,7 +111,12 @@
import { Map } from '../index';
import { EventBus } from '@/utils/eventBus';
import { airPortStore } from '@/store/modules/airport';
import VueDragResize from 'vue-drag-resize/src';
const width = ref(460);
const height = ref(620);
const left = ref(300);
const top = ref(100);
const airPortStoreVal = airPortStore();
const airPort = airPortStoreVal.getAirport;
@ -215,11 +230,9 @@
.takeoff-information {
display: flex;
flex-direction: column;
position: absolute;
top: 120px;
left: 300px;
z-index: 999;
width: 460px;
width: 96%;
height: 98%;
padding: 10px;
background: #0d0e15;
margin: 10px 0 0 10px;

@ -1544,27 +1544,27 @@
let position = [props.airPort.longitude, props.airPort.latitude, 70];
//
if (point) {
point.setOptions({
id: 'set-airport',
name: '机场位置',
position: position,
style: {
image: '/projecthome/airport.png',
width: 35,
height: 59,
scale: 1,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
label: {
text: '机场',
font_size: 14,
color: '#ffffff',
outline: true,
outlineColor: '#000000',
pixelOffsetY: -70,
},
},
});
// point.setOptions({
// id: 'set-airport',
// name: '',
// position: position,
// style: {
// image: '/projecthome/airport.png',
// width: 35,
// height: 59,
// scale: 1,
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
// verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
// label: {
// text: '',
// font_size: 14,
// color: '#ffffff',
// outline: true,
// outlineColor: '#000000',
// pixelOffsetY: -70,
// },
// },
// });
} else {
let startGraphic = new mars3d.graphic.BillboardEntity({
id: 'set-airport',

Loading…
Cancel
Save