DJI Android-SDK:updateFollowingTarget 超时

DJI Android-SDK: updateFollowingTarget Timeout

我正在尝试通过将每个 UDP 数据包的车辆 GPS 数据发送到平板电脑来创建自定义 FollowMe 任务。发送有效,但起初我没有从 updateFollowingTarget 方法获得任何反馈,然后出现超时错误。一般这个方法什么时候会出现超时?我做错了什么?

我正在使用 DJI SDK 4.4.1、Phantom 4 和三星 Galaxy Tab A1 (2016) 平板电脑。

 private AtomicBoolean isRunning = new AtomicBoolean(false);
 private Subscription timerSubscription;
 private Observable<Long> timer = Observable.interval(1500, TimeUnit.MILLISECONDS);
 private volatile Location mLastLocation = new Location("");

public void startFollowMeMission() {
        float height = (float) KeyManager.getInstance().getValue(FlightControllerKey.create(FlightControllerKey.ALTITUDE));

        try {
            udpSocket = new DatagramSocket(4445);
        } catch (SocketException e) {
            Log.e(TAG, "SocketException: " + e.getCause());
        }
        new Thread (new ReceiveLocationUDP()).start();

        if (getFollowMeMissionOperator().getCurrentState() == FollowMeMissionState.READY_TO_EXECUTE) {
            getFollowMeMissionOperator().startMission(FollowMeMission.getInstance().initUserData(mLastLocation.getLatitude(), mLastLocation.getLongitude(), height), new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError error) {
                    if (error == null) {
                        setResultToToast("Start mission: Success");
                        Log.e(TAG, "Start mission: Success");
                    } else {
                        setResultToToast("Start mission Error: " + error.getDescription());
                        Log.e(TAG, "Start mission Error: " + error.getDescription());
                    }
                }
            });
        } else {
            setResultToToast("Unable to start mission: Current State not READY_TO_EXECUTE");
            Log.e(TAG, "Unable to start mission: Current State not READY_TO_EXECUTE, but " + getFollowMeMissionOperator().getCurrentState());
        }

        if (!isRunning.get()) {
            isRunning.set(true);
            timerSubscription = timer.subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    Log.i(TAG, "Current device Latitude: " + mLastLocation.getLatitude() + ", Longitude: " + mLastLocation.getLongitude());
                    if (getFollowMeMissionOperator().getCurrentState() == FollowMeMissionState.EXECUTING) {
                        if (mLastLocation != null) {
                            getFollowMeMissionOperator().updateFollowingTarget(new LocationCoordinate2D(mLastLocation.getLatitude(), mLastLocation.getLongitude()), new CommonCallbacks.CompletionCallback() {
                                @Override
                                public void onResult(DJIError error) {
                                    if (error == null) {
                                        Log.i(TAG, "updateFollowingTarget: Success");
                                        isRunning.set(false);
                                    } else {
                                        Log.e(TAG, "updateFollowingTarget failed: " + error.getDescription());
                                        unsubscribeTimer();
                                    }
                                }
                            });
                        } else {
                            Log.e(TAG, "mLastLocation = null !");
                            unsubscribeTimer();
                        }
                    } else {
                        setResultToToast("FollowMeMission Error: Current State not EXECUTING!");
                        Log.e(TAG, "FollowMeMission Error: Current State not EXECUTING!");
                        unsubscribeTimer();
                    }
                }
            });
        }
    }

这是logcat:

02-19 19:23:52.593 27666-27666/com.dji.GSDemo.GoogleMap I/GSDemoActivity: drone lat: 48.0771599999998 lon: 11.639039999998538 mLastLocation lat: 48.07651 lon: 11.63564
02-19 19:23:52.711 27666-28211/com.dji.GSDemo.GoogleMap E/GSDemoActivity: Start mission: Success
02-19 19:23:52.735 2410-2410/? I/SurfaceFlinger: id=224 createSurf (1x1),1 flag=4, Toast
02-19 19:23:54.113 27666-28281/com.dji.GSDemo.GoogleMap I/GSDemoActivity: Current device Latitude: 48.07659, Longitude: 11.63569
02-19 19:23:55.252 2890-2952/? I/WindowManager_SurfaceController: Destroying surface Surface(name=Toast) called by com.android.server.wm.WindowStateAnimator.destroySurface:3070 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:1138 com.android.server.wm.WindowState.destroyOrSaveSurface:2799 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementInner:509 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:284 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:232 com.android.server.wm.WindowManagerService$H.handleMessage:9581 android.os.Handler.dispatchMessage:102 
02-19 19:23:55.252 2410-3074/? I/SurfaceFlinger: id=224 Removed Toast (5/5)
02-19 19:23:55.252 2410-2415/? I/SurfaceFlinger: id=224 Removed Toast (-2/5)
02-19 19:23:55.612 27666-28281/com.dji.GSDemo.GoogleMap I/GSDemoActivity: Current device Latitude: 48.07668, Longitude: 11.63576
02-19 19:23:56.495 2890-2890/? I/DeviceStorageMonitorService: Posting Message again
02-19 19:23:57.112 27666-28281/com.dji.GSDemo.GoogleMap I/GSDemoActivity: Current device Latitude: 48.07677, Longitude: 11.63582
02-19 19:23:57.117 27666-28206/com.dji.GSDemo.GoogleMap E/GSDemoActivity: updateFollowingTarget failed: Execution of this process has timed out
02-19 19:23:57.117 27666-28206/com.dji.GSDemo.GoogleMap I/GSDemoActivity: Unsubscribed Timer
02-19 19:23:58.614 27666-28211/com.dji.GSDemo.GoogleMap E/GSDemoActivity: updateFollowingTarget failed: Execution of this process has timed out
02-19 19:23:58.640 2890-3518/? E/Watchdog: !@Sync 476 [2018-02-19 19:23:58.639]
02-19 19:23:59.627 27666-27677/com.dji.GSDemo.GoogleMap I/art: Background partial concurrent mark sweep GC freed 133981(8MB) AllocSpace objects, 215(7MB) LOS objects, 31% free, 34MB/50MB, paused 2.631ms total 124.889ms
02-19 19:24:00.114 27666-28186/com.dji.GSDemo.GoogleMap E/GSDemoActivity: updateFollowingTarget failed: Execution of this process has timed out

我不能给你一个解决方案,因为我这里有同样的超时问题,大疆的SDK-reference说如果没有GPS-data更新更多,飞行器将开始悬停在位置比 sic 秒。

我尝试了很多,每秒更新位置 10 次,every-second,...没有像我预期的那样对我有用。

我想我通过将 updateFollowingTarget() 代码块打包到 startMission() 的 onResult() 回调中来修复它。