添加一键起飞和返航
This commit is contained in:
parent
2bab07ecdd
commit
24422d8e93
|
|
@ -454,17 +454,19 @@ public class AircraftFlyController extends BaseController
|
||||||
@PostMapping("/return-home")
|
@PostMapping("/return-home")
|
||||||
public R<String> returnHome(@RequestBody DroneReturnHomeRequest request)
|
public R<String> returnHome(@RequestBody DroneReturnHomeRequest request)
|
||||||
{
|
{
|
||||||
log.info("收到无人机返航请求: sn={}, messageID={}, taskId={}", request.getSn(), request.getMessageID(), request.getTaskId());
|
log.info("收到无人机返航请求: sn={} ", request.getSn());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
Long currentTaskId = flightService.currentRunningTask(request.getSn());
|
||||||
java.util.Map<String, Object> params = new java.util.HashMap<>();
|
java.util.Map<String, Object> params = new java.util.HashMap<>();
|
||||||
if(Objects.isNull(request.getMessageID())){
|
if(Objects.isNull(currentTaskId)){
|
||||||
params.put("messageID", UUID.randomUUID().toString());
|
params.put("messageID", UUID.randomUUID().toString());
|
||||||
}else {
|
}else {
|
||||||
params.put("messageID", request.getMessageID());
|
params.put("messageID",currentTaskId);
|
||||||
}
|
}
|
||||||
params.put("taskId", 9074);
|
params.put("taskId", 9074);
|
||||||
params.put("zhilin", request.getZhilin());
|
params.put("zhilin", "03");
|
||||||
CompletableFuture<CommandResult> future = machineCommandManager.executeCommand(request.getSn(), CommandType.RETURN_HOME, params);
|
CompletableFuture<CommandResult> future = machineCommandManager.executeCommand(request.getSn(), CommandType.RETURN_HOME, params);
|
||||||
CommandResult result = future.get();
|
CommandResult result = future.get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import java.util.Map;
|
||||||
public interface FlightService
|
public interface FlightService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public Long currentRunningTask(String sn);
|
||||||
|
|
||||||
public Long createClickTakeOffTask(String sn, String url);
|
public Long createClickTakeOffTask(String sn, String url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,12 @@ public class FlightServiceImpl implements FlightService
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteTaskService remoteTaskService;
|
private RemoteTaskService remoteTaskService;
|
||||||
|
|
||||||
|
|
||||||
|
public Long currentRunningTask(String sn){
|
||||||
|
R<TaskDTO> taskDTOR = remoteTaskService.getCurrentTaskByUavId(sn,SecurityConstants.INNER);
|
||||||
|
return taskDTOR.getData().getId();
|
||||||
|
}
|
||||||
|
|
||||||
public Long createClickTakeOffTask(String sn, String routeUrl){
|
public Long createClickTakeOffTask(String sn, String routeUrl){
|
||||||
TaskDTO taskDTO = new TaskDTO();
|
TaskDTO taskDTO = new TaskDTO();
|
||||||
taskDTO.setTaskName("一键起飞");
|
taskDTO.setTaskName("一键起飞");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue