|
@@ -260,6 +260,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
private void toAddFilghtPoint(String from, DeviceDTO device,OsdRcDrone data) {
|
|
private void toAddFilghtPoint(String from, DeviceDTO device,OsdRcDrone data) {
|
|
|
|
|
|
|
|
switch (data.getModeCode()) {
|
|
switch (data.getModeCode()) {
|
|
|
|
|
+ //case IDLE:
|
|
|
case TAKEOFF_FINISHED:
|
|
case TAKEOFF_FINISHED:
|
|
|
case MANUAL:
|
|
case MANUAL:
|
|
|
case TAKEOFF_AUTO:
|
|
case TAKEOFF_AUTO:
|
|
@@ -299,17 +300,23 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
|
|
|
|
|
private void pushFlyTrackToWeb(String from, DeviceDTO device,OsdRcDrone data) {
|
|
private void pushFlyTrackToWeb(String from, DeviceDTO device,OsdRcDrone data) {
|
|
|
//推送实时轨迹信息
|
|
//推送实时轨迹信息
|
|
|
- List<FlightTrackDTO> trackList = getFlightLine(device,data);
|
|
|
|
|
|
|
+ List<FlightTrackDTO> trackList = getFlightLine(device);
|
|
|
if(!CollectionUtils.isEmpty(trackList)) {
|
|
if(!CollectionUtils.isEmpty(trackList)) {
|
|
|
- deviceService.pushOsdDataToWeb(device.getWorkspaceId(), BizCodeEnum.DRONE_FLY_TRACK, from, data);
|
|
|
|
|
|
|
+ deviceService.pushOsdDataToWeb(device.getWorkspaceId(), BizCodeEnum.DRONE_FLY_TRACK, from, trackList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //模拟第二条实时航线
|
|
|
|
|
+ List<FlightTrackDTO> flightPoints = flightTaskService.getRTFlightTrackByTaskId(44);
|
|
|
|
|
+ deviceService.pushOsdDataToWeb(device.getWorkspaceId(), BizCodeEnum.DRONE_FLY_TRACK, from, trackList);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private List<FlightTrackDTO> getFlightLine(DeviceDTO device,OsdRcDrone data) {
|
|
|
|
|
|
|
+ private List<FlightTrackDTO> getFlightLine(DeviceDTO device) {
|
|
|
Optional<List<FlightTrackDTO>> optList = deviceRedisService.getDroneFlyTrack(device.getDeviceSn());
|
|
Optional<List<FlightTrackDTO>> optList = deviceRedisService.getDroneFlyTrack(device.getDeviceSn());
|
|
|
if(!optList.isPresent() || optList.get().isEmpty()) {
|
|
if(!optList.isPresent() || optList.get().isEmpty()) {
|
|
|
//获取飞行任务(轨迹)
|
|
//获取飞行任务(轨迹)
|
|
|
- FlightTaskDTO task = getFlightTask(device, data, false);
|
|
|
|
|
|
|
+ FlightTaskDTO task = getFlightTask(device, false);
|
|
|
if(task == null) {
|
|
if(task == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
@@ -361,7 +368,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
}
|
|
}
|
|
|
if(isAdd) {
|
|
if(isAdd) {
|
|
|
//获取飞行任务(轨迹)
|
|
//获取飞行任务(轨迹)
|
|
|
- FlightTaskDTO task = getFlightTask(device, data, true);
|
|
|
|
|
|
|
+ FlightTaskDTO task = getFlightTask(device, true);
|
|
|
log.info("获取飞行轨迹任务:" + task.toString());
|
|
log.info("获取飞行轨迹任务:" + task.toString());
|
|
|
//添加Home信息
|
|
//添加Home信息
|
|
|
if(!lastPoint.isPresent()) {
|
|
if(!lastPoint.isPresent()) {
|
|
@@ -421,12 +428,12 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private FlightTaskDTO getFlightTask(DeviceDTO device,OsdRcDrone data,boolean isCreate) {
|
|
|
|
|
|
|
+ private FlightTaskDTO getFlightTask(DeviceDTO device,boolean isCreate) {
|
|
|
//获取任务名称
|
|
//获取任务名称
|
|
|
FlightTaskDTO flightTaskDTO = null;
|
|
FlightTaskDTO flightTaskDTO = null;
|
|
|
Optional<FlightTaskDTO> opt = deviceRedisService.getDroneFlightTask(device.getDeviceSn());
|
|
Optional<FlightTaskDTO> opt = deviceRedisService.getDroneFlightTask(device.getDeviceSn());
|
|
|
if(opt.isPresent()) {
|
|
if(opt.isPresent()) {
|
|
|
- return opt.get();
|
|
|
|
|
|
|
+ flightTaskDTO = opt.get();
|
|
|
} else {
|
|
} else {
|
|
|
//查询当天未完成的任务
|
|
//查询当天未完成的任务
|
|
|
flightTaskDTO = flightTaskService.getCurrentFlightTask(device.getWorkspaceId(),device.getDeviceSn());
|
|
flightTaskDTO = flightTaskService.getCurrentFlightTask(device.getWorkspaceId(),device.getDeviceSn());
|
|
@@ -444,8 +451,9 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
.createTime(curTime.getTime())
|
|
.createTime(curTime.getTime())
|
|
|
.username(UserRequest.getCurrentUser() != null ? UserRequest.getCurrentUser().getUsername() : "system")
|
|
.username(UserRequest.getCurrentUser() != null ? UserRequest.getCurrentUser().getUsername() : "system")
|
|
|
.build());
|
|
.build());
|
|
|
- deviceRedisService.setDroneFlightTask(device.getDeviceSn(),flightTaskDTO);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+ deviceRedisService.setDroneFlightTask(device.getDeviceSn(),flightTaskDTO);
|
|
|
return flightTaskDTO;
|
|
return flightTaskDTO;
|
|
|
}
|
|
}
|
|
|
|
|
|