DJI SDK如何不旋转移动飞机

时间:2018-11-14 15:11:57

标签: dji-sdk

有没有一种方法可以使飞机不向目的地旋转呢?我以为航点应该可以解决问题,但我无法实现。

private void flyToPointNoRotation(LatLng point) {

    LocationCoordinate3D current_location = flight_controller.getState().getAircraftLocation();

    MissionControl.getInstance().stopTimeline();

    List<TimelineElement> elements = new ArrayList<>();
    missionControl = MissionControl.getInstance();
    final TimelineEvent preEvent = null;
    MissionControl.Listener listener = new MissionControl.Listener() {
        @Override
        public void onEvent(@Nullable TimelineElement element, TimelineEvent event, DJIError error) {
            updateTimelineStatus(element, event, error);
        }
    };

    List<Waypoint> mission_points = new ArrayList<>();
    Waypoint wpt = new Waypoint(point.latitude, point.longitude, current_location.getAltitude());
    mission_points.add(wpt);
    WaypointMission mission = createMissionPath(mission_points);
    elements.add(Mission.elementFromWaypointMission(mission));

    if (missionControl.scheduledCount() > 0) {
        missionControl.unscheduleEverything();
        missionControl.removeAllListeners();
    }

    missionControl.scheduleElements(elements);
    missionControl.addListener(listener);

    MissionControl.getInstance().startTimeline();
}

这是createMissionPath方法。

private WaypointMission createMissionPath(List<Waypoint> waypoints) {

    /* Waypoint mission approach */
    WaypointMission.Builder builder = new WaypointMission.Builder();
    builder.autoFlightSpeed(5f);
    builder.maxFlightSpeed(10f);
    builder.setExitMissionOnRCSignalLostEnabled(false);
    builder.finishedAction(WaypointMissionFinishedAction.NO_ACTION);
    builder.flightPathMode(WaypointMissionFlightPathMode.NORMAL);
    builder.gotoFirstWaypointMode(WaypointMissionGotoWaypointMode.SAFELY);
    builder.headingMode(WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER);

    builder.waypointList(waypoints).waypointCount(waypoints.size());
    return builder.build();
}

P.S。我正在使用dji-sdk:4.3.0

0 个答案:

没有答案