7 files modified
7 files added
1 files deleted
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | <version>2.11.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | |
| | | package com.dji.sample.control.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dji.sample.common.error.CommonErrorEnum; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.mqtt.model.*; |
| | |
| | | import com.dji.sample.component.websocket.model.BizCodeEnum; |
| | | import com.dji.sample.component.websocket.service.ISendMessageService; |
| | | import com.dji.sample.control.model.dto.FlyToProgressReceiver; |
| | | import com.dji.sample.control.model.dto.PointDTO; |
| | | import com.dji.sample.control.model.dto.ResultNotifyDTO; |
| | | import com.dji.sample.control.model.dto.TakeoffProgressReceiver; |
| | | import com.dji.sample.control.model.enums.DroneAuthorityEnum; |
| | | import com.dji.sample.control.model.enums.DroneControlMethodEnum; |
| | | import com.dji.sample.control.model.enums.FlyToStatusEnum; |
| | | import com.dji.sample.control.model.enums.RemoteDebugMethodEnum; |
| | | import com.dji.sample.control.model.param.*; |
| | | import com.dji.sample.control.service.IControlService; |
| | |
| | | import com.dji.sample.manage.service.IDeviceRedisService; |
| | | import com.dji.sample.manage.service.IDeviceService; |
| | | import com.dji.sample.wayline.model.enums.WaylineErrorCodeEnum; |
| | | import com.dji.sample.wayline.model.param.PointPOJO; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.messaging.MessageHeaders; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author sean |
| | |
| | | |
| | | /** |
| | | * Handles multi-state command progress information. |
| | | * |
| | | * @param receiver |
| | | * @param headers |
| | | * @return |
| | |
| | | String sn = RedisOpsUtils.get(key).toString(); |
| | | |
| | | EventsReceiver<EventsOutputProgressReceiver> eventsReceiver = mapper.convertValue(receiver.getData(), |
| | | new TypeReference<EventsReceiver<EventsOutputProgressReceiver>>(){}); |
| | | new TypeReference<EventsReceiver<EventsOutputProgressReceiver>>() { |
| | | }); |
| | | eventsReceiver.setBid(receiver.getBid()); |
| | | eventsReceiver.setSn(sn); |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | FlyToProgressReceiver eventsReceiver = mapper.convertValue(receiver.getData(), new TypeReference<FlyToProgressReceiver>(){}); |
| | | FlyToProgressReceiver eventsReceiver = mapper.convertValue(receiver.getData(), new TypeReference<FlyToProgressReceiver>() { |
| | | }); |
| | | webSocketMessageService.sendBatch(deviceOpt.get().getWorkspaceId(), UserTypeEnum.WEB.getVal(), |
| | | BizCodeEnum.FLY_TO_POINT_PROGRESS.getCode(), |
| | | ResultNotifyDTO.builder().sn(dockSn) |
| | |
| | | eventsReceiver.getStatus().getMessage() : eventsReceiver.getResult().getErrorMsg()) |
| | | .result(eventsReceiver.getResult().getErrorCode()) |
| | | .build()); |
| | | |
| | | if (eventsReceiver.getStatus().equals(FlyToStatusEnum.WAYLINE_OK)) { |
| | | JSONObject jsonObject = (JSONObject) RedisOpsUtils.get("tuban:" + dockSn); |
| | | if (jsonObject != null) { |
| | | List<PointPOJO> targetList = (List<PointPOJO>) jsonObject.get("targetList"); |
| | | int curIndex = (Integer) jsonObject.get("curIndex"); |
| | | flyToNextPoint(targetList, curIndex, dockSn); |
| | | } |
| | | } |
| | | return receiver; |
| | | } |
| | | |
| | | private ResponseResult flyToNextPoint(List<PointPOJO> targetList, int curIndex, String sn) { |
| | | curIndex = curIndex + 1; |
| | | //当无人机状态为人工时再发布下一个命令 |
| | | while (true) { |
| | | Optional<DeviceDTO> dockOpt = deviceRedisService.getDeviceOnline(sn); |
| | | DeviceModeCodeEnum deviceMode = deviceService.getDeviceMode(dockOpt.get().getChildDeviceSn()); |
| | | |
| | | if (DeviceModeCodeEnum.MANUAL == deviceMode) { |
| | | if (curIndex == targetList.size()) { |
| | | //当前是最后一个点,返航 |
| | | ResponseResult returnHome = controlDockDebug(sn, "return_home", null); |
| | | |
| | | RedisOpsUtils.del("tuban:" + sn); |
| | | |
| | | return returnHome; |
| | | } |
| | | else { |
| | | //当前不是最后一个点,飞行到下一个点 |
| | | FlyToPointParam flyToPointParam = new FlyToPointParam(); |
| | | flyToPointParam.setMaxSpeed(14); |
| | | List<PointDTO> pointDTOS = new ArrayList<>(); |
| | | |
| | | PointDTO pointDTO = new PointDTO(); |
| | | pointDTO.setHeight(150.0); |
| | | pointDTO.setLongitude(targetList.get(curIndex).getLon()); |
| | | pointDTO.setLatitude(targetList.get(curIndex).getLat()); |
| | | pointDTOS.add(pointDTO); |
| | | flyToPointParam.setPoints(pointDTOS); |
| | | |
| | | |
| | | ResponseResult flyToRes = flyToPoint(sn, flyToPointParam); |
| | | if (flyToRes.getCode() == ResponseResult.CODE_SUCCESS) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("targetList", targetList); |
| | | jsonObject.put("curIndex", curIndex); |
| | | RedisOpsUtils.set("tuban:" + sn, jsonObject); |
| | | } |
| | | return flyToRes; |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void checkTakeoffCondition(String dockSn) { |
| | | Optional<DeviceDTO> dockOpt = deviceRedisService.getDeviceOnline(dockSn); |
| | |
| | | log.error("机场离线"); |
| | | return null; |
| | | } |
| | | TakeoffProgressReceiver eventsReceiver = mapper.convertValue(receiver.getData(), new TypeReference<TakeoffProgressReceiver>(){}); |
| | | TakeoffProgressReceiver eventsReceiver = mapper.convertValue(receiver.getData(), new TypeReference<TakeoffProgressReceiver>() { |
| | | }); |
| | | |
| | | webSocketMessageService.sendBatch(deviceOpt.get().getWorkspaceId(), UserTypeEnum.WEB.getVal(), |
| | | BizCodeEnum.TAKE_OFF_TO_POINT_PROGRESS.getCode(), |
| New file |
| | |
| | | package com.dji.sample.geo.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Crs { |
| | | private String type; |
| | | |
| | | private Property properties; |
| | | } |
| New file |
| | |
| | | package com.dji.sample.geo.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Feature { |
| | | |
| | | private String type; |
| | | |
| | | private Integer id; |
| | | |
| | | private Geometry geometry; |
| | | |
| | | private Property properties; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dji.sample.geo.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class GeoJson { |
| | | |
| | | private String type; |
| | | |
| | | private Crs crs; |
| | | |
| | | private List<Feature> features; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dji.sample.geo.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class Geometry { |
| | | private String type; |
| | | |
| | | /** |
| | | * [ |
| | | * [ |
| | | * [ |
| | | * 115.81799999999998, |
| | | * 28.652296152000076 |
| | | * ], |
| | | * [ |
| | | * 115.81961010540385, |
| | | * 28.650053326558464 |
| | | * ], |
| | | * [ |
| | | * 115.82417867053516, |
| | | * 28.650434040319453 |
| | | * ], |
| | | * [ |
| | | * 115.82265581549132, |
| | | * 28.652908679765517 |
| | | * ], |
| | | * [ |
| | | * 115.81799999999998, |
| | | * 28.652296152000076 |
| | | * ] |
| | | * ] |
| | | * ] |
| | | */ |
| | | private List<List<List<Double>>> coordinates; |
| | | } |
| New file |
| | |
| | | package com.dji.sample.geo.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Property { |
| | | private String name; |
| | | |
| | | private String FID; |
| | | |
| | | private String Id; |
| | | } |
| New file |
| | |
| | | package com.dji.sample.geo.utils; |
| | | |
| | | import com.dji.sample.geo.entity.Feature; |
| | | import com.dji.sample.geo.entity.GeoJson; |
| | | import com.dji.sample.wayline.model.param.FlyAreaParam; |
| | | import com.dji.sample.wayline.model.param.PointPOJO; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 空间计算工具类 |
| | | */ |
| | | public class GeoUtils { |
| | | /** |
| | | * 默认地球半径 |
| | | */ |
| | | private static double EARTH_RADIUS = 6371000;//赤道半径(单位m) |
| | | |
| | | /** |
| | | * 转化为弧度(rad) |
| | | */ |
| | | private static double rad(double d) { |
| | | return d * Math.PI / 180.0; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算中心经纬度与目标经纬度的距离(米) |
| | | * |
| | | * @param centerLon 中心精度 |
| | | * @param centerLat 中心纬度 |
| | | * @param targetLon 需要计算的精度 |
| | | * @param targetLat 需要计算的纬度 |
| | | * @return 米 |
| | | */ |
| | | public static double distance(double centerLon, double centerLat, double targetLon, double targetLat) { |
| | | |
| | | double jl_jd = 102834.74258026089786013677476285;// 每经度单位米; |
| | | double jl_wd = 111712.69150641055729984301412873;// 每纬度单位米; |
| | | double b = Math.abs((centerLat - targetLat) * jl_jd); |
| | | double a = Math.abs((centerLon - targetLon) * jl_wd); |
| | | return Math.sqrt((a * a + b * b)); |
| | | } |
| | | |
| | | /** |
| | | * 根据多个点计算中心点 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public static PointPOJO getCenterPoint(List<PointPOJO> list) { |
| | | |
| | | int total = list.size(); |
| | | double X = 0, Y = 0, Z = 0; |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | PointPOJO point = list.get(i); |
| | | double lat, lon, x, y, z; |
| | | lon = point.getLon() * Math.PI / 180; |
| | | lat = point.getLat() * Math.PI / 180; |
| | | x = Math.cos(lat) * Math.cos(lon); |
| | | y = Math.cos(lat) * Math.sin(lon); |
| | | z = Math.sin(lat); |
| | | X += x; |
| | | Y += y; |
| | | Z += z; |
| | | } |
| | | |
| | | |
| | | X = X / total; |
| | | Y = Y / total; |
| | | Z = Z / total; |
| | | double Lon = Math.atan2(Y, X); |
| | | double Hyp = Math.sqrt(X * X + Y * Y); |
| | | double Lat = Math.atan2(Z, Hyp); |
| | | |
| | | PointPOJO centerPoint = new PointPOJO(); |
| | | centerPoint.setLon( Lon * 180 / Math.PI); |
| | | centerPoint.setLat(Lat * 180 / Math.PI); |
| | | return centerPoint; |
| | | } |
| | | |
| | | /** |
| | | * 获取点区域并按从近到远排序 |
| | | * @param flyAreaParam |
| | | * @return |
| | | */ |
| | | public static List<PointPOJO> caculatePointList(FlyAreaParam flyAreaParam){ |
| | | List<List<PointPOJO>> areaList = flyAreaParam.getAreaList(); |
| | | PointPOJO dockPoint = flyAreaParam.getDockPoint(); |
| | | Double radius = flyAreaParam.getRadius(); |
| | | |
| | | List<PointPOJO> centerPointList = new ArrayList<>(); |
| | | |
| | | //根据区域获取中心点 |
| | | areaList.forEach(area -> { |
| | | PointPOJO centerPoint = GeoUtils.getCenterPoint(area); |
| | | centerPointList.add(centerPoint); |
| | | }); |
| | | |
| | | //巡逻目标集合 |
| | | List<PointPOJO> targetList = new ArrayList<>(); |
| | | //获取所有中心点之后, |
| | | centerPointList.forEach(centerPoint -> { |
| | | //判断各个中心点和机场点的距离 |
| | | double distance = GeoUtils.distance(dockPoint.getLon(), dockPoint.getLat(), centerPoint.getLon(), centerPoint.getLat()); |
| | | |
| | | //当距离小于半径时,添加到目标集合中 |
| | | if (distance <= radius) { |
| | | centerPoint.setDistance(distance); |
| | | targetList.add(centerPoint); |
| | | } |
| | | }); |
| | | |
| | | //按距离从近到远排序 |
| | | targetList.sort(Comparator.comparing(PointPOJO::getDistance)); |
| | | return targetList; |
| | | } |
| | | |
| | | /** |
| | | * 根据geojson获取点区域并按从近到远排序 |
| | | * @param geoJson |
| | | * @return |
| | | */ |
| | | public static List<PointPOJO> caculatePointList(GeoJson geoJson,PointPOJO dockPoint,Double radius){ |
| | | List<Feature> features = geoJson.getFeatures(); |
| | | |
| | | List<List<PointPOJO>> areaList = new ArrayList<>(); |
| | | |
| | | features.forEach(feature -> { |
| | | List<PointPOJO> list = new ArrayList<>(); |
| | | List<List<Double>> coordinates = feature.getGeometry().getCoordinates().get(0); |
| | | |
| | | coordinates.forEach(coordinate ->{ |
| | | PointPOJO pointPOJO = new PointPOJO(); |
| | | |
| | | pointPOJO.setLon(coordinate.get(0)); |
| | | pointPOJO.setLat(coordinate.get(1)); |
| | | |
| | | list.add(pointPOJO); |
| | | }); |
| | | areaList.add(list); |
| | | }); |
| | | |
| | | FlyAreaParam flyAreaParam = new FlyAreaParam(); |
| | | |
| | | flyAreaParam.setDockPoint(dockPoint); |
| | | flyAreaParam.setRadius(radius); |
| | | flyAreaParam.setAreaList(areaList); |
| | | |
| | | List<PointPOJO> pointPOJOS = caculatePointList(flyAreaParam); |
| | | |
| | | return pointPOJOS; |
| | | } |
| | | |
| | | /** |
| | | * 读取json文件 |
| | | * @param path |
| | | * @return |
| | | */ |
| | | public static GeoJson readJsonFile(String path){ |
| | | |
| | | try { |
| | | File file = new File(path); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | |
| | | return objectMapper.readValue(file, GeoJson.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * Query the working status of the aircraft. |
| | | * 查询飞行器的工作状态 |
| | | * @param deviceSn |
| | | * @return |
| | | */ |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/{sn}/jobs/flyByArea") |
| | | @PostMapping("/{sn}/jobs/{device_sn}/flyByArea") |
| | | @SysLogAnnotation(operModul = "根据区域飞行", operType = "根据区域飞行", operDesc = "根据区域飞行") |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam) { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam); |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam,@PathVariable(name = "device_sn")String deviceSn) { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam,deviceSn); |
| | | } |
| | | } |
| | |
| | | private List<List<PointPOJO>> areaList; |
| | | //无人机巡逻半径 (m) |
| | | private Double radius; |
| | | @JsonProperty(value = "jsonPath") |
| | | private String jsonPath; |
| | | } |
| | |
| | | |
| | | void updateJobCollect(WaylineJobEntity waylineJob); |
| | | |
| | | ResponseResult flyByArea(String sn, FlyAreaParam flyAreaParam); |
| | | ResponseResult flyByArea(String sn, FlyAreaParam flyAreaParam,String deviceSn); |
| | | |
| | | /** |
| | | * 判断是否有下一次任务 |
| | |
| | | package com.dji.sample.wayline.service.impl; |
| | | |
| | | import com.alibaba.druid.stat.TableStat; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dji.sample.common.error.CommonErrorEnum; |
| | |
| | | import com.dji.sample.control.model.param.TakeoffToPointParam; |
| | | import com.dji.sample.control.service.IControlService; |
| | | import com.dji.sample.control.service.IDrcService; |
| | | import com.dji.sample.geo.entity.GeoJson; |
| | | import com.dji.sample.manage.model.dto.DeviceDTO; |
| | | import com.dji.sample.manage.model.enums.DeviceModeCodeEnum; |
| | | import com.dji.sample.manage.model.enums.DockModeCodeEnum; |
| | |
| | | import com.dji.sample.media.model.MediaFileCountDTO; |
| | | import com.dji.sample.media.model.MediaMethodEnum; |
| | | import com.dji.sample.media.service.IFileService; |
| | | import com.dji.sample.utils.GeoUtils; |
| | | import com.dji.sample.geo.utils.GeoUtils; |
| | | import com.dji.sample.wayline.dao.IWaylineJobMapper; |
| | | import com.dji.sample.wayline.model.dto.*; |
| | | import com.dji.sample.wayline.model.entity.WaylineJobEntity; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.File; |
| | | import java.net.URL; |
| | | import java.sql.SQLException; |
| | | import java.time.*; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult flyByArea(String sn, FlyAreaParam flyAreaParam) { |
| | | public ResponseResult flyByArea(String sn, FlyAreaParam flyAreaParam, String deviceSn) { |
| | | |
| | | List<List<PointPOJO>> areaList = flyAreaParam.getAreaList(); |
| | | //获取所有中心点 |
| | | // List<PointPOJO> targetList = GeoUtils.caculatePointList(flyAreaParam); |
| | | PointPOJO dockPoint = flyAreaParam.getDockPoint(); |
| | | Double radius = flyAreaParam.getRadius(); |
| | | GeoJson geoJson = GeoUtils.readJsonFile(flyAreaParam.getJsonPath()); |
| | | List<PointPOJO> targetList = GeoUtils.caculatePointList(geoJson, dockPoint, flyAreaParam.getRadius()); |
| | | |
| | | List<PointPOJO> centerPointList = new ArrayList<>(); |
| | | //一键起飞 |
| | | TakeoffToPointParam takeoffToPointParam = buildTakeoffToPointParam(dockPoint); |
| | | |
| | | //根据区域获取中心点 |
| | | areaList.forEach(area -> { |
| | | PointPOJO centerPoint = GeoUtils.getCenterPoint(area); |
| | | centerPointList.add(centerPoint); |
| | | }); |
| | | ResponseResult takeoffToPointRes = controlService.takeoffToPoint(sn, takeoffToPointParam); |
| | | |
| | | //巡逻目标集合 |
| | | List<PointPOJO> targetList = new ArrayList<>(); |
| | | //获取所有中心点之后, |
| | | centerPointList.forEach(centerPoint -> { |
| | | //判断各个中心点和机场点的距离 |
| | | double distance = GeoUtils.distance(dockPoint.getLon(), dockPoint.getLat(), centerPoint.getLon(), centerPoint.getLat()); |
| | | //设置飞向第一个点 |
| | | while (takeoffToPointRes.getCode() == ResponseResult.CODE_SUCCESS) { |
| | | //获取无人机状态 |
| | | DeviceModeCodeEnum deviceMode = deviceService.getDeviceMode(deviceSn); |
| | | |
| | | //当距离小于半径时,添加到目标集合中 |
| | | if (distance <= radius) { |
| | | centerPoint.setDistance(distance); |
| | | targetList.add(centerPoint); |
| | | //当无人机状态为手动飞行 |
| | | if (deviceMode == DeviceModeCodeEnum.MANUAL) { |
| | | //飞向目标点 |
| | | FlyToPointParam flyToPointParam = new FlyToPointParam(); |
| | | flyToPointParam.setMaxSpeed(14); |
| | | List<PointDTO> pointDTOS = new ArrayList<>(); |
| | | |
| | | PointDTO pointDTO = new PointDTO(); |
| | | pointDTO.setHeight(150.0); |
| | | pointDTO.setLongitude(targetList.get(0).getLon()); |
| | | pointDTO.setLatitude(targetList.get(0).getLat()); |
| | | pointDTOS.add(pointDTO); |
| | | flyToPointParam.setPoints(pointDTOS); |
| | | |
| | | |
| | | ResponseResult flyToRes = controlService.flyToPoint(sn, flyToPointParam); |
| | | |
| | | if (flyToRes.getCode() == ResponseResult.CODE_SUCCESS) { |
| | | //第一个点指令飞行成功后,把数组存到redis中 |
| | | /** |
| | | * { |
| | | * targetList:[], |
| | | * curIndex: |
| | | * } |
| | | */ |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("targetList",targetList); |
| | | jsonObject.put("curIndex",0); |
| | | |
| | | |
| | | RedisOpsUtils.set("tuban:"+sn,jsonObject); |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //按距离从近到远排序 |
| | | targetList.sort(Comparator.comparing(PointPOJO::getDistance)); |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | //后续为无人机操作逻辑 |
| | | //先飞到空中 |
| | | public TakeoffToPointParam buildTakeoffToPointParam(PointPOJO dockPoint) { |
| | | TakeoffToPointParam takeoffToPointParam = new TakeoffToPointParam(); |
| | | |
| | | takeoffToPointParam.setTargetLatitude(dockPoint.getLat()); |
| | |
| | | takeoffToPointParam.setMaxSpeed(10.0); |
| | | takeoffToPointParam.setExitWaylineWhenRcLost(WaylineRcLostActionEnum.EXECUTE_RC_LOST_ACTION); |
| | | |
| | | return ResponseResult.success(); |
| | | // //起飞 |
| | | // ResponseResult responseResult = controlService.takeoffToPoint(sn, takeoffToPointParam); |
| | | // |
| | | // if (responseResult.getCode() != ResponseResult.CODE_SUCCESS) { |
| | | // return responseResult; |
| | | // } |
| | | // //向目标点飞行 |
| | | // |
| | | // FlyToPointParam flyToPointParam = new FlyToPointParam(); |
| | | // flyToPointParam.setMaxSpeed(14); |
| | | // List<PointDTO> pointDTOS = new ArrayList<>(); |
| | | // targetList.forEach(pointPOJO -> { |
| | | // PointDTO pointDTO = new PointDTO(); |
| | | // pointDTO.setHeight(150.0); |
| | | // pointDTO.setLongitude(pointPOJO.getLon()); |
| | | // pointDTO.setLatitude(pointPOJO.getLat()); |
| | | // |
| | | // pointDTOS.add(pointDTO); |
| | | // }); |
| | | // flyToPointParam.setPoints(pointDTOS); |
| | | // ResponseResult responseResult1 = controlService.flyToPoint(sn, flyToPointParam); |
| | | // |
| | | // if (responseResult1.getCode() != ResponseResult.CODE_SUCCESS) { |
| | | // return responseResult1; |
| | | // } |
| | | // |
| | | // //返航 |
| | | // //return_home |
| | | // |
| | | // |
| | | // return ResponseResult.success(); |
| | | return takeoffToPointParam; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| New file |
| | |
| | | { |
| | | "type": "FeatureCollection", |
| | | "crs": { |
| | | "type": "name", |
| | | "properties": { |
| | | "name": "EPSG:4326" |
| | | } |
| | | }, |
| | | "features": [ |
| | | { |
| | | "type": "Feature", |
| | | "id": 0, |
| | | "geometry": { |
| | | "type": "Polygon", |
| | | "coordinates": [ |
| | | [ |
| | | [ |
| | | 115.86646556494736, |
| | | 28.634450296554235 |
| | | ], |
| | | [ |
| | | 115.86425430209033, |
| | | 28.635738328540754 |
| | | ], |
| | | [ |
| | | 115.86455173471609, |
| | | 28.633120921432976 |
| | | ], |
| | | [ |
| | | 115.86697714906381, |
| | | 28.633843533997606 |
| | | ], |
| | | [ |
| | | 115.86646556494736, |
| | | 28.634450296554235 |
| | | ] |
| | | ] |
| | | ] |
| | | }, |
| | | "properties": { |
| | | "FID": 0, |
| | | "Id": 0 |
| | | } |
| | | }, |
| | | { |
| | | "type": "Feature", |
| | | "id": 1, |
| | | "geometry": { |
| | | "type": "Polygon", |
| | | "coordinates": [ |
| | | [ |
| | | [ |
| | | 115.86400669060504, |
| | | 28.620271391369386 |
| | | ], |
| | | [ |
| | | 115.86002109341996, |
| | | 28.616202513049245 |
| | | ], |
| | | [ |
| | | 115.86637425430604, |
| | | 28.614203765804177 |
| | | ], |
| | | [ |
| | | 115.86591204400565, |
| | | 28.617200102075913 |
| | | ], |
| | | [ |
| | | 115.86400669060504, |
| | | 28.620271391369386 |
| | | ] |
| | | ] |
| | | ] |
| | | }, |
| | | "properties": { |
| | | "FID": 1, |
| | | "Id": 0 |
| | | } |
| | | }, |
| | | { |
| | | "type": "Feature", |
| | | "id": 2, |
| | | "geometry": { |
| | | "type": "Polygon", |
| | | "coordinates": [ |
| | | [ |
| | | [ |
| | | 115.83936693345481, |
| | | 28.616199931733206 |
| | | ], |
| | | [ |
| | | 115.84128848946852, |
| | | 28.616084360149614 |
| | | ], |
| | | [ |
| | | 115.84093157031771, |
| | | 28.618154491224743 |
| | | ], |
| | | [ |
| | | 115.83814760094094, |
| | | 28.618654178035968 |
| | | ], |
| | | [ |
| | | 115.83936693345481, |
| | | 28.616199931733206 |
| | | ] |
| | | ] |
| | | ] |
| | | }, |
| | | "properties": { |
| | | "FID": 2, |
| | | "Id": 0 |
| | | } |
| | | }, |
| | | { |
| | | "type": "Feature", |
| | | "id": 3, |
| | | "geometry": { |
| | | "type": "Polygon", |
| | | "coordinates": [ |
| | | [ |
| | | [ |
| | | 115.76493801956997, |
| | | 28.690367528093361 |
| | | ], |
| | | [ |
| | | 115.76654812497384, |
| | | 28.688124702651749 |
| | | ], |
| | | [ |
| | | 115.77111669010515, |
| | | 28.688505416412738 |
| | | ], |
| | | [ |
| | | 115.7695938350613, |
| | | 28.690980055858802 |
| | | ], |
| | | [ |
| | | 115.76493801956997, |
| | | 28.690367528093361 |
| | | ] |
| | | ] |
| | | ] |
| | | }, |
| | | "properties": { |
| | | "FID": 3, |
| | | "Id": 0 |
| | | } |
| | | } |
| | | ] |
| | | } |