Skip to content

Unable to execute DJIGoToStep mission using DJICustomMission in Simulator Mode #3

Open
@EonKid

Description

@EonKid

I am using DJI Phantom 3
-DJI SDK 3.5
-iPad
I am unable to start DJIGoToStep mission using Simulator mode is ON .I am using following code:-

    if let flightController = DroneUtility.fetchFlightController(){
        if CLLocationCoordinate2DIsValid(self.droneLocationCoordinate) {
         self.min_height = proxy.sharedProxy().getAltitudeDictionary(arrTemp: zoneCreateModal.zones).object(forKey: "minimum_height") as! Float
            self.takeOffCoordinates = self.droneLocationCoordinate
           
            let max_height = proxy.sharedProxy().getAltitudeDictionary(arrTemp: self.zoneCreateModal.zones).object(forKey: "maximum_height") as! Float
            let stepsToGo = DJIGoToStep.init(coordinate: self.droneLocationCoordinate, altitude: self.min_height)
            let customMission = DJICustomMission.init(steps: [stepsToGo!])
            DJIMissionManager.sharedInstance()!.prepare(customMission!, withProgress: { (value) in
            }, withCompletion: { (error) in
                if error?.localizedDescription.characters.count > 0{
                    proxy.sharedProxy().displayStatusCodeAlert("Error: \(error!.localizedDescription)")
                }else{
                    DJIMissionManager.sharedInstance()!.startMissionExecution(completion: { (error) in
                        if error?.localizedDescription.characters.count > 0{
                            proxy.sharedProxy().displayStatusCodeAlert("Error: \(error!.localizedDescription)")
                        }else{
                         proxy.sharedProxy().displayStatusCodeAlert("Take off succeeded...")
                            flightController.setFlightOrientationMode(.courseLock, withCompletion: { (error) in
                                if error?.localizedDescription.characters.count > 0{
                                }else{
                                    //Set maximum flight height
                                    proxy.sharedProxy().displayStatusCodeAlert("Maximum : \(max_height)")
                                    flightController.flightLimitation?.setMaxFlightHeight(max_height, withCompletion: nil)
                                    
                                    }
                            })
                        }
                    })
                }
            })
            
        }else{
            proxy.sharedProxy().displayStatusCodeAlert("Error: Unable to fetch current location")
        }
    }else{
        proxy.sharedProxy().displayStatusCodeAlert("Please connect drone")
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions