徐景良 1 day ago
commit ccc79173cb

@ -324,6 +324,7 @@
const airPortStoreVal = airPortStore();
const uav = airPortStoreVal.getUAV;
const live_info = airPortStoreVal.getLiveInfo;
const typeId = airPortStoreVal.getTypeId;
const bid = buildGUID();
const selectName = ref('');
@ -443,6 +444,10 @@
flight_safety_advance_check: 1,
};
airPortStoreVal.setFlightId(data.flight_id);
if (typeId == 'Dock 1') {
delete data.rth_mode;
delete data.flight_safety_advance_check;
}
//
const querys = {
bid: bid,
@ -608,26 +613,75 @@
}
};
const getDRCFlightQuery = (type, value, seq) => {
let data = {
roll: 1024,
pitch: 1024,
throttle: 1024,
yaw: 1024,
gimbal_pitch: 1024,
};
if (value == 'up') {
data[type] = 1684;
} else {
data[type] = 364;
let querys;
if (typeId == 'Dock 3' || typeId == 'Dock 2') {
let data = {
roll: 1024,
pitch: 1024,
throttle: 1024,
yaw: 1024,
gimbal_pitch: 1024,
};
if (value == 'up') {
data[type] = 1684;
} else {
data[type] = 364;
}
querys = {
seq: seq.value,
method: 'stick_control',
data: data,
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
};
} else if (typeId == 'Dock 1') {
let data = {
seq: seq.value,
x: 0,
y: 0,
h: 0,
w: 0,
};
if (value == 'up') {
switch (type) {
case 'roll':
data.y = 17;
break;
case 'pitch':
data.x = 17;
break;
case 'throttle':
data.h = 5;
break;
case 'yaw':
data.w = 90;
break;
}
} else {
switch (type) {
case 'roll':
data.y = -17;
break;
case 'pitch':
data.x = -17;
break;
case 'throttle':
data.h = -4;
break;
case 'yaw':
data.w = -90;
break;
}
}
querys = {
method: 'drone_control',
data: data,
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
};
}
const querys = {
seq: seq.value,
method: 'stick_control',
data: data,
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
};
return querys;
};
//
@ -748,17 +802,29 @@
timer = window.setInterval(() => {
drcSeq.value = drcSeq.value + 1;
let drcQuerys;
drcQuerys = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'heart_beat',
data: {
if (typeId == 'Dock 3' || typeId == 'Dock 2') {
drcQuerys = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
},
seq: drcSeq.value,
};
method: 'heart_beat',
data: {
timestamp: new Date().getTime(),
},
seq: drcSeq.value,
};
} else if (typeId == 'Dock 1') {
drcQuerys = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'heart_beat',
data: {
timestamp: new Date().getTime(),
seq: drcSeq.value,
},
};
}
drcDownTopic(drcQuerys);
}, 5000);
// drc
@ -783,7 +849,7 @@
services_replyTopic();
};
let player;
const liveCode = ref('7');
const liveCode = ref(uav.sn);
const playVideo = () => {
player = TCPlayer('player-container-id-live', {
sources: [

@ -28,7 +28,12 @@
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
import { EventBus } from '@/utils/eventBus';
import { uuid, buildGUID } from '@/utils/uuid';
import { servicesTopic, services_replyTopic, errorName } from '@/utils/debugging/remote';
import {
servicesTopic,
services_replyTopic,
errorName,
cameraCode,
} from '@/utils/debugging/remote';
import {
getClient,
createConnection,
@ -56,6 +61,7 @@
const deliveryData = ref();
//
const droneData = ref();
const typeId = airPortStoreVal.getTypeId;
const clickBtn = (val) => {
if (!droneData.value) {
@ -87,6 +93,10 @@
flight_safety_advance_check: 1,
};
airPortStoreVal.setFlightId(data.flight_id);
if (typeId == 'Dock 1') {
delete data.rth_mode;
delete data.flight_safety_advance_check;
}
//
createConfirm({
iconType: 'warning',
@ -191,9 +201,22 @@
lng: data.lng,
lat: data.lat,
}).then((res) => {
if (res.length == 0) {
createMessage.warning('附近没有无人机,请稍后再试');
return;
}
airPortStoreVal.setAirPort('sn', res[0].droneportsn);
airPortStoreVal.setUAV('sn', res[0].Sn);
airPortStoreVal.setGateway(res[0].GateWay);
airPortStoreVal.setAirPort('video_id', res[0].droneportsn + '/165-0-7/normal-0');
airPortStoreVal.setTypeId(res[0].droneporttype);
airPortStoreVal.setUAV('sn', res[0].Sn);
airPortStoreVal.setUAV('camera_index', cameraCode(res[0].uavtype));
airPortStoreVal.setUAV(
'video_id',
res[0].Sn + '/' + cameraCode(res[0].uavtype) + '/normal-0',
);
applyDroneControl({ dronePortSn: res[0].droneportsn }).then((res) => {
console.log(res);
droneData.value = res;

@ -7,13 +7,13 @@ export const airPortStore = defineStore({
sn: null,
camera_index: '165-0-7',
video_index: 'normal-0',
video_id: '8UUXN5400A079H/165-0-7/normal-0',
video_id: null,
},
uav: {
sn: null,
camera_index: '99-0-0',
camera_index: null,
video_index: 'normal-0',
video_id: '1581F8HGX254V00A0BUY/99-0-0/normal-0',
video_id: null,
},
liveInfo: {
rtmp: 'rtmp://175.27.168.120:6019/live/',
@ -27,6 +27,7 @@ export const airPortStore = defineStore({
project: null,
taskId: null,
flightId: null,
typeId: null,
}),
getters: {
getAirport(state) {
@ -50,6 +51,9 @@ export const airPortStore = defineStore({
getFlightId(state) {
return state.flightId;
},
getTypeId(state) {
return state.typeId;
},
},
actions: {
setAirPort(item: any, value: any) {
@ -70,5 +74,8 @@ export const airPortStore = defineStore({
setFlightId(value: any) {
this.flightId = value;
},
setTypeId(value: any) {
this.typeId = value;
},
},
});

@ -493,28 +493,75 @@ export const useChartEditStore = defineStore({
}
const index: number = this.fetchTargetIndex();
const targetData = this.getComponentList[index];
if (index !== -1) {
// 下移排除最底层, 上移排除最顶层
if ((isDown && index === 0) || (!isDown && index === length - 1)) {
if (targetData.isGroup) {
const groupIndex = targetData.groupList.findIndex(
(item) => item.id === this.getTargetChart.selectId[0],
);
// 分组
if (groupIndex === -1) {
// 下移排除最底层, 上移排除最顶层
if ((isDown && index === 0) || (!isDown && index === length - 1)) {
loadingFinish();
return;
}
// 互换位置
const swapIndex = isDown ? index - 1 : index + 1;
const targetItem = this.getComponentList[index];
const swapItem = this.getComponentList[swapIndex];
// 历史记录
if (isHistory) {
chartHistoryStore.createLayerHistory(
[targetItem],
isDown ? HistoryActionTypeEnum.DOWN : HistoryActionTypeEnum.UP,
);
}
this.updateComponentList(index, swapItem);
this.updateComponentList(swapIndex, targetItem);
loadingFinish();
return;
} else {
// 分组里面的单组件
const groupLength = targetData.groupList.length;
// 下移排除最底层, 上移排除最顶层
if ((!isDown && groupIndex === 0) || (isDown && groupIndex === groupLength - 1)) {
loadingFinish();
return;
}
// 互换位置
const swapIndex = isDown ? groupIndex + 1 : groupIndex - 1;
const targetItem = targetData.groupList[groupIndex];
const swapItem = targetData.groupList[swapIndex];
targetData.groupList[groupIndex] = swapItem;
targetData.groupList[swapIndex] = targetItem;
this.componentList[index] = targetData;
return;
}
} else {
// 下移排除最底层, 上移排除最顶层
if ((isDown && index === 0) || (!isDown && index === length - 1)) {
loadingFinish();
return;
}
// 互换位置
const swapIndex = isDown ? index - 1 : index + 1;
const targetItem = this.getComponentList[index];
const swapItem = this.getComponentList[swapIndex];
// 历史记录
if (isHistory) {
chartHistoryStore.createLayerHistory(
[targetItem],
isDown ? HistoryActionTypeEnum.DOWN : HistoryActionTypeEnum.UP,
);
}
this.updateComponentList(index, swapItem);
this.updateComponentList(swapIndex, targetItem);
loadingFinish();
return;
}
// 互换位置
const swapIndex = isDown ? index - 1 : index + 1;
const targetItem = this.getComponentList[index];
const swapItem = this.getComponentList[swapIndex];
// 历史记录
if (isHistory) {
chartHistoryStore.createLayerHistory(
[targetItem],
isDown ? HistoryActionTypeEnum.DOWN : HistoryActionTypeEnum.UP,
);
}
this.updateComponentList(index, swapItem);
this.updateComponentList(swapIndex, targetItem);
loadingFinish();
return;
}
} catch (value) {
loadingError();
@ -1015,7 +1062,6 @@ export const useChartEditStore = defineStore({
try {
// 暂不支持多选
if (this.getTargetChart.selectId.length > 1) return;
loadingStart();
const index: number = this.fetchTargetIndex();
if (index !== -1) {

@ -33,10 +33,19 @@ export const errorName = (code) => {
return '错误码' + code;
}
};
export const cameraCode = (code) => {
if (code == 'M3TD') {
return '81-0-0';
} else if (code == 'M4TD') {
return '99-0-0';
} else if (code == 'M30') {
return '52-0-0';
}
};
export const servicesTopic = (data) => {
console.log(data);
console.log(airPortStoreVal.getGateway);
// 发送消息
clientPublish('thing/product/' + airPortStoreVal.getGateway + '/services', data);
};

Loading…
Cancel
Save