|
|
|
@ -8,11 +8,13 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div class="content-button">
|
|
|
|
|
<a-button @click="obtain">获取飞行器控制权</a-button>
|
|
|
|
|
<a-button @click="emits('clickTakeOff')">一键起飞</a-button>
|
|
|
|
|
<a-button>指点飞行</a-button>
|
|
|
|
|
<!-- <a-button>智能环绕</a-button> -->
|
|
|
|
|
<a-button @click="returnVoyage">一键返航</a-button>
|
|
|
|
|
<a-button @click="obtain">获取飞行器控制权</a-button>
|
|
|
|
|
<a-button @click="enterDRC">进入飞行控制</a-button>
|
|
|
|
|
<a-button @click="exitDRC">退出飞行控制</a-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content-info">
|
|
|
|
|
<div class="info-item">
|
|
|
|
@ -40,12 +42,14 @@
|
|
|
|
|
import { vDrag } from '@/utils/drag';
|
|
|
|
|
import { getReizeClient, createSeizeConnection, clientReizePublish } from '@/utils/mqtt';
|
|
|
|
|
import {
|
|
|
|
|
eventsTopic,
|
|
|
|
|
events_replyTopic,
|
|
|
|
|
drcDownTopic,
|
|
|
|
|
servicesTopic,
|
|
|
|
|
eventsTopicReize,
|
|
|
|
|
events_replyTopicReize,
|
|
|
|
|
drcDownTopicReize,
|
|
|
|
|
servicesTopicReize,
|
|
|
|
|
services_replyTopicReize,
|
|
|
|
|
return_home_status,
|
|
|
|
|
} from '@/utils/debugging/events';
|
|
|
|
|
import { servicesTopic } from '@/utils/debugging/remote';
|
|
|
|
|
import { buildGUID } from '@/utils/uuid';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
|
|
|
|
@ -90,7 +94,7 @@
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// 飞行控制权抢夺
|
|
|
|
|
eventsTopic({
|
|
|
|
|
servicesTopicReize({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
method: 'flight_authority_grab',
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
@ -98,7 +102,7 @@
|
|
|
|
|
data: {},
|
|
|
|
|
});
|
|
|
|
|
// 负载控制权抢夺
|
|
|
|
|
eventsTopic({
|
|
|
|
|
servicesTopicReize({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
method: 'payload_authority_grab',
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
@ -107,20 +111,33 @@
|
|
|
|
|
payload_index: '99-0-0',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
events_replyTopic();
|
|
|
|
|
events_replyTopicReize();
|
|
|
|
|
services_replyTopicReize();
|
|
|
|
|
// // 接收消息
|
|
|
|
|
getReizeClient().on('message', (topic, message) => {
|
|
|
|
|
const rs = JSON.parse(message);
|
|
|
|
|
console.log(rs);
|
|
|
|
|
// 一键返航
|
|
|
|
|
if (rs.method === 'return_home') {
|
|
|
|
|
createMessage.info(return_home_status[rs.data.output.status]);
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('一键返航成功');
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('一键返航失败,状态码' + rs.data.result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method === 'takeoff_to_point') {
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('一键起飞成功');
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('一键起飞失败,状态码' + rs.data.result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, 1000);
|
|
|
|
|
};
|
|
|
|
|
// 一键返航
|
|
|
|
|
const returnVoyage = () => {
|
|
|
|
|
// 老的
|
|
|
|
|
servicesTopic({
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
method: 'return_home',
|
|
|
|
@ -128,21 +145,79 @@
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
|
data: {},
|
|
|
|
|
});
|
|
|
|
|
// 新的servicesTopicReize
|
|
|
|
|
};
|
|
|
|
|
const seq = ref(1);
|
|
|
|
|
const changeDRC = (type, value) => {
|
|
|
|
|
seq.value = seq.value + 1;
|
|
|
|
|
if (value == 'up') {
|
|
|
|
|
data[type] = data[type] + 20;
|
|
|
|
|
} else {
|
|
|
|
|
data[type] = data[type] - 20;
|
|
|
|
|
}
|
|
|
|
|
const querys = {
|
|
|
|
|
seq: 1,
|
|
|
|
|
seq: seq.value,
|
|
|
|
|
method: 'stick_control',
|
|
|
|
|
data: data,
|
|
|
|
|
};
|
|
|
|
|
drcDownTopic(querys);
|
|
|
|
|
console.log(querys);
|
|
|
|
|
drcDownTopicReize(querys);
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {});
|
|
|
|
|
const enterDRC = () => {
|
|
|
|
|
// http://175.27.168.120:6012/players/srs_player.html?schema=http&port=6012&api=6012
|
|
|
|
|
const querys = {
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
data: {
|
|
|
|
|
hsi_frequency: 10,
|
|
|
|
|
mqtt_broker: {
|
|
|
|
|
address: 'http://175.27.168.120:6010',
|
|
|
|
|
client_id: 'mqtt_client_1581F8HGX254V00A0BUY_seize',
|
|
|
|
|
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);
|
|
|
|
|
servicesTopicReize(querys);
|
|
|
|
|
};
|
|
|
|
|
const exitDRC = () => {
|
|
|
|
|
const querys = {
|
|
|
|
|
bid: buildGUID(),
|
|
|
|
|
data: {},
|
|
|
|
|
tid: buildGUID(),
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
|
method: 'drc_mode_exit',
|
|
|
|
|
};
|
|
|
|
|
servicesTopicReize(querys);
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// // 接收消息
|
|
|
|
|
getReizeClient().on('message', (topic, message) => {
|
|
|
|
|
const rs = JSON.parse(message);
|
|
|
|
|
if (rs.method == 'drc_mode_enter') {
|
|
|
|
|
console.log(rs);
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('进入指令飞行控制模式成功');
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('进入指令飞行控制模式失败,状态码' + rs.data.result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rs.method == 'drc_mode_exit') {
|
|
|
|
|
console.log(rs);
|
|
|
|
|
if (rs.data.result == 0) {
|
|
|
|
|
createMessage.success('退出指令飞行控制模式成功');
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error('退出指令飞行控制模式失败,状态码' + rs.data.result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.flight-control {
|
|
|
|
|