Waypoints

Overview

Waypoint task is a predefined set of tracks that a drone is about to pass through. The location of a waypoint should be described by longitude, latitude, and altitude. At each waypoint, functions such as taking photo/video and setting the pitch and yaw of the gimbal can be performed. Waypoint task will be uploaded to the drone and drone will take the path defined by the waypoint task.

Mission class in SDK provides APIs to set waypoints, start mission, subscribe to mission progress and pause mission. A mission is defined by a list of MissionItem objects. For each MissionItem object we can set the position, altitude, camera action and camera angle. We can also subscribe to listeners, so that we can get callbacks for mission progress updates or receive the result of a mission command.

The code snippet below defines a function that creates a Mission Item.


MissionItem makeMissionItem(double latitudeDeg, 
                            double longitude, 
                            float relativeAltitude, 
                            MissionItem.CameraAction cameraAction, 
                            float gimbalPitchDeg, float gimbalYawDeg) {
        MissionItem newItem = new MissionItem();
        newItem.setPosition(latitudeDeg, longitudeM);
        newItem.setRelativeAltitude(relativeAltitudeM);
        newItem.setCameraAction(cameraAction);
        newItem.setGimbalPitchAndYaw(gimbalPitchDeg, gimbalYawDeg);
        return newItem;
    }

By creating a list of such mission items, you can send the waypoint task to the drone using the method below


 sendMissionAsync(ArrayList missionItems, Mission.ResultListener listener)

Finally, execute the mission using the method below


 startMissionAsync(Mission.ResultListener listener)

Please refer the API documentation for more information about this feature.