diff --git a/src/api/drone-control/drone.ts b/src/api/drone-control/drone.ts index 7539a4d..82734ab 100644 --- a/src/api/drone-control/drone.ts +++ b/src/api/drone-control/drone.ts @@ -18,6 +18,18 @@ export enum LostControlActionInCommandFLight { Land = 1, // 着陆 RETURN_HOME = 2, // 返航 } +export enum ERthMode { + SMART = 0, + SETTING = 1 +} +export enum ECommanderModeLostAction { + CONTINUE = 0, + EXEC_LOST_ACTION = 1 +} +export enum ECommanderFlightMode { + SMART = 0, + SETTING = 1 +} export interface PointBody { latitude: number; longitude: number; @@ -48,7 +60,11 @@ export interface PostTakeoffToPointBody{ max_speed: number; // flyto过程中能达到的最大速度, 单位m/s 跟飞机档位有关 rc_lost_action: LostControlActionInCommandFLight; // 失控行为 rth_altitude: number; // 返航高度 - exit_wayline_when_rc_lost: WaylineLostControlActionInCommandFlight + exit_wayline_when_rc_lost: WaylineLostControlActionInCommandFlight; + rth_mode: ERthMode; + commander_mode_lost_action: ECommanderModeLostAction; + commander_flight_mode: ECommanderFlightMode; + commander_flight_height: number; } // 一键起飞 diff --git a/src/api/http/config.ts b/src/api/http/config.ts index 75cbc92..d124291 100644 --- a/src/api/http/config.ts +++ b/src/api/http/config.ts @@ -1,17 +1,17 @@ export const CURRENT_CONFIG = { // license - appId: 'Please enter the app id.', // You need to go to the development website to apply. - appKey: 'Please enter the app key.', // You need to go to the development website to apply. + appId: 'Please enter the app id.', // You need to go to the development website to apply. + appKey: 'Please enter the app key.', // You need to go to the development website to apply. appLicense: 'Please enter the app license.', // You need to go to the development website to apply. - + // http baseURL: 'Please enter the backend access address prefix.', // This url must end with "/". Example: 'http://192.168.1.1:6789/' - websocketURL: 'Please enter the WebSocket access address.', // Example: 'ws://192.168.1.1:6789/api/v1/ws' + websocketURL: 'Please enter the WebSocket access address.', // Example: 'ws://192.168.1.1:6789/api/v1/ws' // livestreaming // RTMP Note: This IP is the address of the streaming server. If you want to see livestream on web page, you need to convert the RTMP stream to WebRTC stream. - rtmpURL: 'Please enter the rtmp access address.', // Example: 'rtmp://192.168.1.1/live/' + rtmpURL: 'Please enter the rtmp access address.', // Example: 'rtmp://192.168.1.1/live/' // GB28181 Note:If you don't know what these parameters mean, you can go to Pilot2 and select the GB28181 page in the cloud platform. Where the parameters same as these parameters. gbServerIp: 'Please enter the server ip.', gbServerPort: 'Please enter the server port.', @@ -29,7 +29,7 @@ export const CURRENT_CONFIG = { agoraToken: 'Please enter the agora temporary token.', agoraChannel: 'Please enter the agora channel.', - // map + // map // You can apply on the AMap website. amapKey: 'Please enter the amap key.', diff --git a/src/api/wayline.ts b/src/api/wayline.ts index a917804..18be49c 100644 --- a/src/api/wayline.ts +++ b/src/api/wayline.ts @@ -42,10 +42,12 @@ export interface CreatePlan { dock_sn: string, task_type: TaskType, // 任务类型 wayline_type: WaylineType, // 航线类型 - task_days?: number[] // 执行任务的日期(秒) - task_periods?: number[][] // 执行任务的时间点(秒) + task_days: number[] // 执行任务的日期(秒) + task_periods: number[][] // 执行任务的时间点(秒) rth_altitude: number // 相对机场返航高度 20 - 500 out_of_control_action: OutOfControlAction // 失控动作 + min_battery_capacity?: number, // The minimum battery capacity of aircraft. + min_storage_capacity?: number, // The minimum storage capacity of dock and aircraft. } // Create Wayline Job diff --git a/src/components/GMap.vue b/src/components/GMap.vue index 1a99fcc..25485ff 100644 --- a/src/components/GMap.vue +++ b/src/components/GMap.vue @@ -21,8 +21,8 @@ -
-
+
+
{{ osdVisible.callsign }}
@@ -49,7 +49,7 @@ - {{ deviceInfo.gateway && deviceInfo.gateway.capacity_percent !== str ? deviceInfo.gateway.capacity_percent + ' %' : deviceInfo.gateway.capacity_percent }} + {{ deviceInfo.gateway && deviceInfo.gateway.capacity_percent !== str ? deviceInfo.gateway?.capacity_percent + ' %' : deviceInfo.gateway?.capacity_percent }} @@ -141,11 +141,11 @@
-
-
+
+
{{ osdVisible.gateway_callsign }} -
+
@@ -267,7 +267,7 @@ - {{ DroneInDockEnum[deviceInfo.dock.basic_osd?.drone_in_dock] }} + {{ deviceInfo.dock.basic_osd?.drone_in_dock }} @@ -413,6 +413,17 @@
+ +
+
+ + +
+
+
+ + +
@@ -452,6 +463,8 @@ import DockControlPanel from './g-map/DockControlPanel.vue' import { useDockControl } from './g-map/use-dock-control' import DroneControlPanel from './g-map/DroneControlPanel.vue' import { useConnectMqtt } from './g-map/use-connect-mqtt' +import LivestreamOthers from './livestream-others.vue' +import LivestreamAgora from './livestream-agora.vue' export default defineComponent({ components: { @@ -475,7 +488,9 @@ export default defineComponent({ DockControlPanel, DroneControlPanel, CarryOutOutlined, - RocketOutlined + RocketOutlined, + LivestreamOthers, + LivestreamAgora }, name: 'GMap', props: {}, @@ -534,6 +549,12 @@ export default defineComponent({ const drawVisible = computed(() => { return store.state.drawVisible }) + const livestreamOthersVisible = computed(() => { + return store.state.livestreamOthersVisible + }) + const livestreamAgoraVisible = computed(() => { + return store.state.livestreamAgoraVisible + }) const osdVisible = computed(() => { return store.state.osdVisible }) @@ -572,7 +593,7 @@ export default defineComponent({ } } if (data.currentType === EDeviceTypeName.Dock && data.dockInfo[data.currentSn]) { - deviceTsaUpdateHook.initMarker(EDeviceTypeName.Dock, [EDeviceTypeName.Dock], data.currentSn, data.dockInfo[data.currentSn].basic_osd?.longitude, data.dockInfo[data.currentSn].basic_osd?.latitude) + deviceTsaUpdateHook.initMarker(EDeviceTypeName.Dock, EDeviceTypeName[EDeviceTypeName.Dock], data.currentSn, data.dockInfo[data.currentSn].basic_osd?.longitude, data.dockInfo[data.currentSn].basic_osd?.latitude) if (osdVisible.value.visible && osdVisible.value.is_dock && osdVisible.value.gateway_sn !== '') { deviceInfo.dock = data.dockInfo[osdVisible.value.gateway_sn] deviceInfo.device = data.deviceInfo[deviceInfo.dock.basic_osd.sub_device?.device_sn ?? osdVisible.value.sn] @@ -607,15 +628,27 @@ export default defineComponent({ }) updateCoordinates('wgs84-gcj02', ele) - useGMapCoverHook.init2DPin( - ele.name, - ele.resource.content.geometry.coordinates, - ele.resource.content.properties.color, - { - id: ele.id, - name: ele.name - } - ) + const data = { id: ele.id, name: ele.name } + if (MapElementEnum.PIN === ele.resource?.type) { + useGMapCoverHook.init2DPin( + ele.name, + ele.resource.content.geometry.coordinates, + ele.resource.content.properties.color, + data + ) + } else if (MapElementEnum.LINE === ele.resource?.type) { + useGMapCoverHook.initPolyline( + ele.name, + ele.resource.content.geometry.coordinates, + ele.resource.content.properties.color, + data) + } else if (MapElementEnum.POLY === ele.resource?.type) { + useGMapCoverHook.initPolygon( + ele.name, + ele.resource.content.geometry.coordinates, + ele.resource.content.properties.color, + data) + } } store.state.wsEvent.mapElementCreat = {} @@ -749,6 +782,12 @@ export default defineComponent({ console.log('layers', layers) store.commit('SET_LAYER_INFO', layers) } + function closeLivestreamOthers () { + store.commit('SET_LIVESTREAM_OTHERS_VISIBLE', false) + } + function closeLivestreamAgora () { + store.commit('SET_LIVESTREAM_AGORA_VISIBLE', false) + } function updateCoordinates (transformType: string, element: any) { const geoType = element.resource?.content.geometry.type const type = element.resource?.type as number @@ -769,39 +808,38 @@ export default defineComponent({ ) as GeojsonCoordinate element.resource.content.geometry.coordinates = transResult } - } else if (MapElementEnum.LINE === type && geoType === 'LineString') { + } else if (MapElementEnum.LINE === type) { const coordinates = element.resource?.content.geometry .coordinates as GeojsonCoordinate[] if (transformType === 'wgs84-gcj02') { - coordinates.forEach(coordinate => { - coordinate = wgs84togcj02( + coordinates.forEach((coordinate, i, arr) => { + arr[i] = wgs84togcj02( coordinate[0], coordinate[1] ) as GeojsonCoordinate }) } else if (transformType === 'gcj02-wgs84') { - coordinates.forEach(coordinate => { - coordinate = gcj02towgs84( + coordinates.forEach((coordinate, i, arr) => { + arr[i] = gcj02towgs84( coordinate[0], coordinate[1] ) as GeojsonCoordinate }) } element.resource.content.geometry.coordinates = coordinates - } else if (MapElementEnum.LINE === type && geoType === 'Polygon') { + } else if (MapElementEnum.POLY === type) { const coordinates = element.resource?.content.geometry .coordinates[0] as GeojsonCoordinate[] - if (transformType === 'wgs84-gcj02') { - coordinates.forEach(coordinate => { - coordinate = wgs84togcj02( + coordinates.forEach((coordinate, i, arr) => { + arr[i] = wgs84togcj02( coordinate[0], coordinate[1] ) as GeojsonCoordinate }) } else if (transformType === 'gcj02-wgs84') { - coordinates.forEach(coordinate => { - coordinate = gcj02towgs84( + coordinates.forEach((coordinate, i, arr) => { + arr[i] = gcj02towgs84( coordinate[0], coordinate[1] ) as GeojsonCoordinate @@ -815,6 +853,8 @@ export default defineComponent({ draw, mouseMode, drawVisible, + livestreamOthersVisible, + livestreamAgoraVisible, osdVisible, pin, state, @@ -830,7 +870,9 @@ export default defineComponent({ NetworkStateTypeEnum, NetworkStateQualityEnum, RainfallEnum, - DroneInDockEnum + DroneInDockEnum, + closeLivestreamOthers, + closeLivestreamAgora } } }) @@ -875,7 +917,8 @@ export default defineComponent({ } .osd-panel { position: absolute; - left: 10px; + margin-left: 10px; + left: 0; top: 10px; width: 480px; background: #000; @@ -926,4 +969,17 @@ export default defineComponent({ min-height: 2px; border-radius: 2px; } + +.liveview { + position: absolute; + color: #fff; + z-index: 1; + left: 0; + margin-left: 10px; + top: 10px; + text-align: center; + width: 800px; + height: 720px; + background: #232323; +} diff --git a/src/components/g-map/DockControlPanel.vue b/src/components/g-map/DockControlPanel.vue index ade675b..0c52427 100644 --- a/src/components/g-map/DockControlPanel.vue +++ b/src/components/g-map/DockControlPanel.vue @@ -73,15 +73,14 @@ watch(() => props.deviceInfo, (value) => { deep: true }) +// dock 控制指令 +const debugStatus = ref(props.deviceInfo.dock?.basic_osd?.mode_code === EDockModeCode.Remote_Debugging) const emit = defineEmits(['close-control-panel']) function closeControlPanel () { - emit('close-control-panel', props.sn) + emit('close-control-panel', props.sn, debugStatus.value) } -// dock 控制指令 -const debugStatus = ref(props.deviceInfo.dock?.basic_osd.mode_code === EDockModeCode.Remote_Debugging) - async function onDeviceStatusChange (status: boolean) { let result = false if (status) { diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue index ea8956a..6aa8c16 100644 --- a/src/components/g-map/DroneControlPanel.vue +++ b/src/components/g-map/DroneControlPanel.vue @@ -112,15 +112,53 @@ :options="WaylineLostControlActionInCommandFlightOptions" >
+
+ Return-to-Home Mode: + +
+
+ Commander Mode Lost Action: + +
+
+ Commander Flight Mode: + +
+
+ Commander Flight Height(m): + +
+
+ +
+
+ + +
-
@@ -250,9 +288,15 @@ import { usePayloadControl } from './use-payload-control' import { CameraMode, CameraType, CameraTypeOptions, ZoomCameraTypeOptions, CameraListItem } from '/@/types/live-stream' import { useDroneControlWsEvent } from './use-drone-control-ws-event' import { useDroneControlMqttEvent } from './use-drone-control-mqtt-event' -import { postFlightAuth, LostControlActionInCommandFLight, WaylineLostControlActionInCommandFlight } from '/@/api/drone-control/drone' +import { + postFlightAuth, LostControlActionInCommandFLight, WaylineLostControlActionInCommandFlight, ERthMode, + ECommanderModeLostAction, ECommanderFlightMode +} from '/@/api/drone-control/drone' import { useDroneControl } from './use-drone-control' -import { GimbalResetMode, GimbalResetModeOptions, LostControlActionInCommandFLightOptions, WaylineLostControlActionInCommandFlightOptions } from '/@/types/drone-control' +import { + GimbalResetMode, GimbalResetModeOptions, LostControlActionInCommandFLightOptions, WaylineLostControlActionInCommandFlightOptions, + RthModeInCommandFlightOptions, CommanderModeLostActionInCommandFlightOptions, CommanderFlightModeInCommandFlightOptions +} from '/@/types/drone-control' import DroneControlPopover from './DroneControlPopover.vue' import DroneControlInfoPanel from './DroneControlInfoPanel.vue' import { noDebugCmdList as baseCmdList, DeviceCmdItem, DeviceCmd } from '/@/types/device-cmd' @@ -269,8 +313,8 @@ const clientId = computed(() => { return store.state.clientId }) -const initCmdList = baseCmdList.find(item => item.cmdKey === DeviceCmd.ReturnHome) as DeviceCmdItem -const cmdItem = ref(initCmdList) +const initCmdList = baseCmdList.map(cmdItem => Object.assign({}, cmdItem)) +const cmdList = ref(initCmdList) const { sendDockControlCmd @@ -283,9 +327,11 @@ async function sendControlCmd (cmdItem: DeviceCmdItem, index: number) { cmd: cmdItem.cmdKey, action: cmdItem.action }, false) - if (result && flightController.value) { + if (result) { message.success('Return home successful') - exitFlightCOntrol() + if (flightController.value) { + exitFlightCOntrol() + } } else { message.error('Failed to return home') } @@ -349,7 +395,11 @@ const takeoffToPointPopoverData = reactive({ maxSpeed: MAX_SPEED, rthAltitude: null as null | number, rcLostAction: LostControlActionInCommandFLight.RETURN_HOME, - exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION + exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION, + rthMode: ERthMode.SETTING, + commanderModeLostAction: ECommanderModeLostAction.CONTINUE, + commanderFlightMode: ECommanderFlightMode.SETTING, + commanderFlightHeight: null as null | number, }) function onShowTakeoffToPointPopover () { @@ -361,6 +411,10 @@ function onShowTakeoffToPointPopover () { takeoffToPointPopoverData.rthAltitude = null takeoffToPointPopoverData.rcLostAction = LostControlActionInCommandFLight.RETURN_HOME takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION + takeoffToPointPopoverData.rthMode = ERthMode.SETTING + takeoffToPointPopoverData.commanderModeLostAction = ECommanderModeLostAction.CONTINUE + takeoffToPointPopoverData.commanderFlightMode = ECommanderFlightMode.SETTING + takeoffToPointPopoverData.commanderFlightHeight = null } async function onTakeoffToPointConfirm (confirm: boolean) { @@ -369,7 +423,8 @@ async function onTakeoffToPointConfirm (confirm: boolean) { !takeoffToPointPopoverData.latitude || !takeoffToPointPopoverData.longitude || !takeoffToPointPopoverData.securityTakeoffHeight || - !takeoffToPointPopoverData.rthAltitude) { + !takeoffToPointPopoverData.rthAltitude || + !takeoffToPointPopoverData.commanderFlightHeight) { message.error('Input error') return } @@ -382,7 +437,11 @@ async function onTakeoffToPointConfirm (confirm: boolean) { rth_altitude: takeoffToPointPopoverData.rthAltitude, max_speed: takeoffToPointPopoverData.maxSpeed, rc_lost_action: takeoffToPointPopoverData.rcLostAction, - exit_wayline_when_rc_lost: takeoffToPointPopoverData.exitWaylineWhenRcLost + exit_wayline_when_rc_lost: takeoffToPointPopoverData.exitWaylineWhenRcLost, + rth_mode: takeoffToPointPopoverData.rthMode, + commander_mode_lost_action: takeoffToPointPopoverData.commanderModeLostAction, + commander_flight_mode: takeoffToPointPopoverData.commanderFlightMode, + commander_flight_height: takeoffToPointPopoverData.commanderFlightHeight, }) } catch (error) { } @@ -672,6 +731,14 @@ function onShowCameraAimPopover () { cameraAimPopoverData.y = null } +function openLivestreamOthers () { + store.commit('SET_LIVESTREAM_OTHERS_VISIBLE', true) +} + +function openLivestreamAgora () { + store.commit('SET_LIVESTREAM_AGORA_VISIBLE', true) +} + async function onCameraAimConfirm (confirm: boolean) { if (confirm) { if (cameraAimPopoverData.cameraType === null || cameraAimPopoverData.x === null || cameraAimPopoverData.y === null) { diff --git a/src/components/g-map/use-dock-control.ts b/src/components/g-map/use-dock-control.ts index 3cf9b1a..e61345e 100644 --- a/src/components/g-map/use-dock-control.ts +++ b/src/components/g-map/use-dock-control.ts @@ -45,8 +45,10 @@ export function useDockControl () { } // 控制面板关闭 - async function onCloseControlPanel (sn: string) { - await dockDebugOnOff(sn, false) + async function onCloseControlPanel (sn: string, debugging: boolean) { + if (debugging) { + await dockDebugOnOff(sn, false) + } setDockControlPanelVisible(false) } diff --git a/src/components/livestream-agora.vue b/src/components/livestream-agora.vue index dd435ab..6ed589a 100644 --- a/src/components/livestream-agora.vue +++ b/src/components/livestream-agora.vue @@ -1,5 +1,5 @@