dji-sdk / Mobile-SDK-iOS

DJI Mobile SDK for iOS: http://developer.dji.com/mobile-sdk/
Other
581 stars 256 forks source link

Unable to activate `DJIWaypointReachedMissionTrigger` #319

Open india2sarthak opened 5 years ago

india2sarthak commented 5 years ago

I am trying to schedule the DJIWaypointReachedMissionTrigger trigger in a Waypoint Mission with flight mode set to curved and rotateGimbalPitch enabled.

Here is the code I am using to activate the trigger:

       let trigger: DJIWaypointReachedMissionTrigger = DJIWaypointReachedMissionTrigger()
        trigger.isActive = true
        DJISDKManager.missionControl()?.scheduleTriggers([trigger])
        trigger.addListener(self) { (trigger, event, error) in
            if error == nil {
                if event ==  .actionTriggered {
                    print("Waypoint Reached Trigger triggered \((trigger as? DJIWaypointReachedMissionTrigger)?.waypointIndex)")
                }
            }
        }

The progress listener for the trigger never gets triggered. Am I missing something? DJI SDK Version : 4.9.1

Thanks!

zoemcmac commented 5 years ago

Curved waypoints. If you dig around in the documentation you will find that because of the nature of the curve, the aircraft never passes the precise location.

india2sarthak commented 5 years ago

I disabled the curved flight mode and tried the triggers, it still doesn't work. Am I adding the triggers properly? @oliverou @zoemcmac Please help

zoemcmac commented 5 years ago

I havent looked at this in ages and the person I would ask out of town. Are you using a Timeline mission for the whole thing? You might want to send sample code to support because it sounds like your mission is with waypoint missions (firmware based) but you are using the advanced features like triggers that need to be run from Timeline missions. Timeline missions run on a layer of MSDK on top of mission manager which is on top of traditional waypoint missions that are more firmware based. I hope this helps

DSonesson commented 5 years ago

I have a simillar issue/problem. I can't figure out how to add a DJIWaypointReachedMissionTrigger to my WaypointMission. I want to add a trigger that triggers at the last waypoint. I schedule my waypoint mission in as a timeline element like this:

DJISDKManager.missionControl()?.scheduleElement(DJITakeOffAction()) DJISDKManager.missionControl()?.scheduleElement(gimbalAttitudeDownAction) DJISDKManager.missionControl()?.scheduleElement(waypointMission) DJISDKManager.missionControl()?.scheduleElement(gimbalAttitudeForwardAction) DJISDKManager.missionControl()?.scheduleElement(DJIGoHomeAction())

Where I have some actions/elements scheduled before and after my mission.

I can't figure out how to schedule or load the WaypointReachedTrigger in the correct way, so that it triggers on the last waypoint in the mission. (The mission will always have a different amount of waypoints)

Would appreciate some guildlines in this matter! Thanks