下发条件任务成功,但满足条件后任务并不执行

Completed

Comments

6 comments

  • Maoshencat
    flighttask_execute    要下发整个指令
    0
    Comment actions Permalink
  • DJI Developer Support
    尊敬的开发者, 您好,感谢您联系DJI 大疆创新。 固件版本是最新的吗?即使任务准备成功,也需要所有执行条件得到满足才能执行任务?检查一下是否下发flighttask_execute指令? 希望我们的解决方案能够帮到您,感谢您的邮件,祝您生活愉快! Best Regards, DJI 大疆创新SDK技术支持
    0
    Comment actions Permalink
  • Duan Leo

    flighttask_ready 事件触发后,后端demo的代码能正常进入 flighttaskReady 函数,里面有flighttask_execute执行的地方,如下:

    @Override
    public TopicEventsResponse<MqttReply> flighttaskReady(TopicEventsRequest<FlighttaskReady> response, MessageHeaders headers) {
            List<String> flightIds = response.getData().getFlightIds();

            log.info("ready task list:{}", Arrays.toString(flightIds.toArray()) );
            // Check conditional task blocking status.
            String blockedId = waylineRedisService.getBlockedWaylineJobId(response.getGateway());
            System.out.println(response.toString());
            System.out.println(blockedId);
            if (!StringUtils.hasText(blockedId)) {
                return null;
            }

            Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(response.getGateway());
            if (deviceOpt.isEmpty()) {
                return null;
            }
            DeviceDTO device = deviceOpt.get();

            try {
                for (String jobId : flightIds) {
                    boolean isExecute = this.executeFlightTask(device.getWorkspaceId(), jobId);
                    if (!isExecute) {
                        return null;
                    }
                    Optional<WaylineJobDTO> waylineJobOpt = waylineRedisService.getConditionalWaylineJob(jobId);
                    if (waylineJobOpt.isEmpty()) {
                        log.info("The conditional job has expired and will no longer be executed.");
                        return new TopicEventsResponse<>();
                    }
                    WaylineJobDTO waylineJob = waylineJobOpt.get();
                    this.retryPrepareJob(new ConditionalWaylineJobKey(device.getWorkspaceId(), response.getGateway(), jobId), waylineJob);
                    return new TopicEventsResponse<>();
                }
            } catch (Exception e) {
                log.error("Failed to execute conditional task.");
                e.printStackTrace();
            }
            return new TopicEventsResponse<>();
        }

    String blockedId = waylineRedisService.getBlockedWaylineJobId(response.getGateway());
    这一句获取的blockedId 始终为空,传进来的response是正常有值的,如下:

    TopicRequestsRequest{method='flighttask_ready', gateway='机场SN', from='机场SN', needReply=false, tid='ddd8627c-c2b5-4f06-a156-476ccf7718a3', bid='4aa56d27-0020-4d12-b645-f5322641ce82', timestamp=1729162622555, data=FlighttaskReady{flightIds=[3b875e12-b334-4f40-b70b-8e45c1f6134d]}}

    这个blockId是什么啊?我在redis里面查这个key:"wayline_job_block", 查出来也是null

    0
    Comment actions Permalink
  • Duan Leo

    另外,机场是二代机场,机场和飞机固件均为最新的 10.01.1607

    0
    Comment actions Permalink
  • Maoshencat

    飞机固件一直没问题 自己debug一下 demo是有bug

    0
    Comment actions Permalink
  • Duan Leo

    确实是bug,

    if (!StringUtils.hasText(blockedId))

    把这句的!去掉就好了。。。

    0
    Comment actions Permalink

Please sign in to leave a comment.