Waypoints

Overview

A waypoint mission is a predefined route for a drone to fly.  The location of a waypoint is an (x,y,z) point specified by a longitude, latitude, and altitude value.  At each waypoint, functions such as taking a photo/video and setting the pitch and/or yaw of the gimbal can be performed.  After uploading the waypoint mission to the drone, it can then automatically fly the route defined by the waypoint mission.

The Mission class in the SDK provides APIs to set waypoints, start the mission, subscribe to mission progress, and pause the mission.  A mission is defined by a list of MissionItem objects.  For each MissionItem object, we can set the position, altitude, camera action, camera angle, and other parameters.  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 shows how to create a Mission Item.


let missionItem = MissionItem(latitudeDeg, longitudeDeg, relativeAltitudeM, speedMPS, isFlyThrough, gimbalPitchDeg, gimbalYawDeg, loiterTimeS, cameraAction)

By creating a list of such mission items, you can upload the entire mission to the drone using the method below.


CoreManager.shared().mission.uploadMission(missionItems: missionExample.missionItems)
            .do(onError: { error in
                //mission uploaded failed
                
            }, onCompleted: {
                //mission uploaded success
            })
            .subscribe()
            .disposed(by: disposeBag)

Finally, execute/start the mission using the method below.


CoreManager.shared().mission.startMission()
            .do(onError: { error in
                //mission start failed
            }, onCompleted: {
                //mission start success
            })
            .subscribe()
            .disposed(by: disposeBag)

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