Code Monkey home page Code Monkey logo

Comments (6)

 avatar commented on July 17, 2024

Hi there, thanks for letting us know about this. Can you share what type of mission you're running when you get this error?

from mobile-sdk-ios.

str11ngfello avatar str11ngfello commented on July 17, 2024

Thanks for the quick response. Absolutely. This is code that is tied to a button press on an action sheet. It creates a simple waypoint mission, prepares it and starts it. The mission will be flown but during the start of the mission we get the callback with error saying user stopped the mission.

func actionMore() {
        let googleAnalyticsAction = "Action - More"
        GoogleAnalytics.sharedInstance.trackEvent(googleAnalyticsAction, label: "Open")
        let actionSheet = UIAlertController(title: Constants.App.About, message: nil, preferredStyle: .ActionSheet)
        actionSheet.addAction(UIAlertAction(title: "cancel".localized, style: .Cancel, handler: { (action) -> Void in
            GoogleAnalytics.sharedInstance.trackEvent(googleAnalyticsAction, label: "Cancel")
        }))
        actionSheet.addAction(UIAlertAction(title: "Test LCMC".localized, style: .Default, handler: { (action) -> Void in
            let missionManager = DJIMissionManager.sharedInstance()
            let waypointMission = DJIWaypointMission()
            if let aircraftLocation = FlightDirector.sharedInstance.telemetry.aircraftZLoc.value?.loc.coordinate {
                let height: Float = 30.0

                waypointMission.gotoFirstWaypointMode = .Safely
                waypointMission.exitMissionOnRCSignalLost = false

                waypointMission.removeAllWaypoints()
                waypointMission.maxFlightSpeed = 10.0
                waypointMission.autoFlightSpeed = 5.0
                waypointMission.finishedAction = DJIWaypointMissionFinishedAction.GoHome
                waypointMission.headingMode = DJIWaypointMissionHeadingMode.Auto
                waypointMission.flightPathMode = DJIWaypointMissionFlightPathMode.Normal
                //DJIWaypointMissionAirLineCurve
                var point1: CLLocationCoordinate2D
                var point2: CLLocationCoordinate2D
                var point3: CLLocationCoordinate2D
                var point4: CLLocationCoordinate2D
                let DEGREE_OF_THIRTY_METER:Double = (0.0000899322 * 3)
                point1 = CLLocationCoordinate2DMake(aircraftLocation.latitude + DEGREE_OF_THIRTY_METER, aircraftLocation.longitude)
                point2 = CLLocationCoordinate2DMake(aircraftLocation.latitude, aircraftLocation.longitude + DEGREE_OF_THIRTY_METER)
                point3 = CLLocationCoordinate2DMake(aircraftLocation.latitude - DEGREE_OF_THIRTY_METER, aircraftLocation.longitude)
                point4 = CLLocationCoordinate2DMake(aircraftLocation.latitude, aircraftLocation.longitude - DEGREE_OF_THIRTY_METER)
                let wp1: DJIWaypoint = DJIWaypoint(coordinate: point1)
                wp1.altitude = height
                let wp2: DJIWaypoint = DJIWaypoint(coordinate: point2)
                wp2.altitude = height
                let wp3: DJIWaypoint = DJIWaypoint(coordinate: point3)
                wp3.altitude = height
                let wp4: DJIWaypoint = DJIWaypoint(coordinate: point4)
                wp4.altitude = height
                waypointMission.addWaypoint(wp1)
                waypointMission.addWaypoint(wp2)
//                waypointMission.addWaypoint(wp3)
//                waypointMission.addWaypoint(wp4)
                missionManager?.delegate = self



                missionManager?.prepareMission(waypointMission, withProgress: {
                    [weak self] (progress: Float) -> Void in
                        print(progress)
                    }, withCompletion:{[weak self] (error: NSError?) -> Void in


                            print("starting mission")
                            missionManager?.startMissionExecutionWithCompletion { (startMissionExecutionError: NSError?) in
                                if let startMissionExecutionErrorValid = startMissionExecutionError {
                                    FlightDirector.sharedInstance.statusFlash.value = FlightDirectorStatus(disposition: .Danger, message: startMissionExecutionErrorValid.localizedDescription)
                                    FlightDirector.sharedInstance.disengage(.DJIMissionManagerError)
                                    return
                                }
                            }

                    })
            }}))

from mobile-sdk-ios.

 avatar commented on July 17, 2024

Hi there, thanks for that info. One more question, the SDK will sometimes return that error if the flight controller mode is manually changed while the mission is running, is it possible for you to check if this happens in your app?

One way to check this is via the flight controller delegate method, flightController:didUpdateSystemState:, which provides a DJIFlightControllerCurrentState that contains a property flightMode. If you're using the iOS simulator, you can print the mode: print(\(state.flightMode)), or if you're doing this on a live flight then compare the current mode to the previous mode and display an alert view in your app if it changes. Let us know if you have a chance to check this. We will also look into this further. Thanks again.

from mobile-sdk-ios.

str11ngfello avatar str11ngfello commented on July 17, 2024

Thanks for the tip. We did some logging to show the sequence of events.

DJIFlightControllerFlightModeGPSAtti = 6
DJIFlightControllerFlightModeAutoTakeOff = 11
DJIFlightControllerFlightModeGPSWaypoint = 14
DJIFlightControllerFlightModeGoHome = 15

We printed the flight mode enum as our mission uploaded, started, and encountered the error. Is it not strange that we are starting in 6, which is Atti mode? Although the error callback happens when we are in state 11 (auto take off), maybe the trigger is delayed from starting in 6. This test is done using the DJI simulator by the way.

Log:
State = 6
0 mission upload
State = 6
State = 6
0.333333 mission upload
State = 6
State = 6
0.666667 mission upload
State = 6
State = 6
1.0
starting mission
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 6
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
State = 11
didFinishMissionExecution triggered in ModesViewController - ERROR User did stop mission
State = 11
State = 11
State = 11
State = 11
...

from mobile-sdk-ios.

Brew-Fox avatar Brew-Fox commented on July 17, 2024

I too am seeing this behavior. After missionManager.startMissionExecution is successful, periodically we see missionManager(_ manager: DJIMissionManager, didFinishMissionExecution) delegate fire before the drone has lifted off. Can happen at start or in the middle of a waypoint mission.

from mobile-sdk-ios.

XietongLU avatar XietongLU commented on July 17, 2024

Mission has been refactored in 4.0.

from mobile-sdk-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.