From 91fbc1342f1a33a42581228b7651f9fae4671875 Mon Sep 17 00:00:00 2001 From: "sean.zhou" Date: Thu, 18 May 2023 16:23:35 +0800 Subject: [PATCH] What's new? 1. Add new model: DJI Matrices 350 RTK. 2. Fixed some issues. --- package.json | 1 + src/components/g-map/DroneControlPanel.vue | 32 +++++++++---- .../g-map/use-drone-control-mqtt-event.ts | 17 ++++++- .../g-map/use-drone-control-ws-event.ts | 6 +-- src/components/g-map/use-manual-control.ts | 7 ++- src/components/g-map/use-mqtt.ts | 2 + src/components/livestream-agora.vue | 36 +++++++------- src/components/livestream-others.vue | 2 +- src/components/task/CreatePlan.vue | 48 ++++++++++--------- src/pages/page-pilot/pilot-home.vue | 15 +++--- src/pages/page-web/projects/workspace.vue | 1 + src/store/index.ts | 1 - src/types/device.ts | 4 ++ src/types/drc.ts | 13 ++--- src/types/task.ts | 9 +++- 15 files changed, 121 insertions(+), 73 deletions(-) diff --git a/package.json b/package.json index 34c4aa0..4a82dd0 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "ant-design-vue/es/switch/style/css", "ant-design-vue/es/table/style/css", "ant-design-vue/es/tag/style/css", + "ant-design-vue/es/time-picker/style/css", "ant-design-vue/es/tooltip/style/css", "ant-design-vue/es/tree/style/css", "ant-design-vue/es/upload/style/css", diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue index af2311f..ea8956a 100644 --- a/src/components/g-map/DroneControlPanel.vue +++ b/src/components/g-map/DroneControlPanel.vue @@ -118,7 +118,7 @@ Take off - @@ -269,7 +269,7 @@ const clientId = computed(() => { return store.state.clientId }) -const initCmdList = baseCmdList.find(item => item.cmdKey === DeviceCmd.ReturnHome) +const initCmdList = baseCmdList.find(item => item.cmdKey === DeviceCmd.ReturnHome) as DeviceCmdItem const cmdItem = ref(initCmdList) const { @@ -284,7 +284,10 @@ async function sendControlCmd (cmdItem: DeviceCmdItem, index: number) { action: cmdItem.action }, false) if (result && flightController.value) { + message.success('Return home successful') exitFlightCOntrol() + } else { + message.error('Failed to return home') } cmdItem.loading = false } @@ -346,7 +349,7 @@ const takeoffToPointPopoverData = reactive({ maxSpeed: MAX_SPEED, rthAltitude: null as null | number, rcLostAction: LostControlActionInCommandFLight.RETURN_HOME, - exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.RETURN_HOME + exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION }) function onShowTakeoffToPointPopover () { @@ -357,7 +360,7 @@ function onShowTakeoffToPointPopover () { takeoffToPointPopoverData.securityTakeoffHeight = null takeoffToPointPopoverData.rthAltitude = null takeoffToPointPopoverData.rcLostAction = LostControlActionInCommandFLight.RETURN_HOME - takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.RETURN_HOME + takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION } async function onTakeoffToPointConfirm (confirm: boolean) { @@ -396,10 +399,10 @@ const deviceTopicInfo: DeviceTopicInfo = reactive({ useMqtt(deviceTopicInfo) // 飞行控制 -const drcState = computed(() => { - return store.state.deviceState?.dockInfo[props.sn]?.link_osd?.drc_state === DrcStateEnum.CONNECTED -}) -const flightController = ref(drcState.value) +// const drcState = computed(() => { +// return store.state.deviceState?.dockInfo[props.sn]?.link_osd?.drc_state === DrcStateEnum.CONNECTED +// }) +const flightController = ref(false) async function onClickFightControl () { if (flightController.value) { @@ -452,7 +455,7 @@ async function exitFlightCOntrol () { } // drc mqtt message -const { drcInfo } = useDroneControlMqttEvent(props.sn) +const { drcInfo, errorInfo } = useDroneControlMqttEvent(props.sn) const { handleKeyup, @@ -688,6 +691,17 @@ async function onCameraAimConfirm (confirm: boolean) { } cameraAimPopoverData.visible = false } + +watch(() => errorInfo, (errorInfo) => { + if (errorInfo.value) { + message.error(errorInfo.value) + console.error(errorInfo.value) + errorInfo.value = '' + } +}, { + immediate: true, + deep: true +})