首页 文章

DJI Phantom 3自定义任务应用程序,任务步骤之间的延迟:

提问于
浏览
1

我正在使用Android Studio开发应用程序,以某种模式驾驶DJI Phantom 3无人机,以某些方式拍摄照片 . 我将DJI示例代码上传到Android Studio,在Android Manifest.xml文件中输入了一个app键,并修改了"MissionManager"目录中的"CustomMissionView"代码,以便将无人机编程为以指定的模式飞行 . 但是,当我在DJI模拟器上运行这个项目时,每个自定义任务之间都有一个延迟,有时无人机处于空闲状态并且没有做任何事情就会徘徊几秒钟 . 我想知道是否有办法在不设定飞行速度的情况下最小化自定义任务的步骤之间的延迟 . 我怀疑它与 DJICommonCallbacks.DJICompletionCallback() 有关,但我不确定 . 我是Android Studio的新手,所以任何建议都会有所帮助 .

以下是“CustomMissionView”Java文件中受保护方法DJI Mission中的一些代码

LinkedList<DJIMissionStep> steps = new LinkedList<DJIMissionStep>();


    //Step 1: takeoff from the ground
    steps.add(new DJITakeoffStep(new DJICommonCallbacks.DJICompletionCallback() {

        public void onResult(DJIError error) {
            Utils.setResultToToast(mContext, "Takeoff step: " + (error == null ? "Success" : error.getDescription()));
        }
    }));

    //Step 2: reset the gimbal to desired angle
    steps.add(new DJIGimbalAttitudeStep(
            DJIGimbalRotateAngleMode.AbsoluteAngle,
            new DJIGimbalAngleRotation(true, -30f, DJIGimbalRotateDirection.Clockwise),
            null,
            null,
            new DJICommonCallbacks.DJICompletionCallback() {

                public void onResult(DJIError error) {
                    Utils.setResultToToast(mContext, "Set gimbal attitude step: " + (error == null ? "Success" : error.getDescription()));

                }
            }));

    //Step 3: Go 3 meters from home point
    steps.add(new DJIGoToStep(mHomeLatitude, mHomeLongitude, 3, new DJICommonCallbacks.DJICompletionCallback() {


        public void onResult(DJIError error) {
            Utils.setResultToToast(mContext, "Goto step: " + (error == null ? "Success" : error.getDescription()));
        }
    }));

1 回答

  • 0

    每个步骤之间的暂停是由于DJI如何设置自定义任务 . 当您准备自定义任务时,它不会向飞机本身发送任何任务信息 . 它确实在运行应用程序的设备上构建自定义任务 . 在执行任务期间,向飞机发送一个步骤 . 当该步骤成功完成后,下一步将发送到飞机 . 这导致每个步骤之间的暂停 . 如果从遥控器到飞机的信号变弱,任务可能会因超时而失败 .

    航点任务没有暂停,因为整个任务在准备好时都会加载到飞机上 .

相关问题