Detect when drone powered down while RC is still powered on
CompletedIn the MSDK how can we tell when the drone has been powered down ( when the remote controller is still powered on )? For example a pilot may change the drone battery but does not power down the remote controller.
I have tried using keyManager to listen to the DJIParamConnection param of DJIProductKey, DJIFlightControllerKey and DJIAirLinkKey.
I also tried listening to the DJISDKManagerDelegate methods productConnected, productDisconnected, productChanged, componentConnectedWithKey, and componentDisconnectedWithKey.
But none of these key values or delegate methods are triggered when the drone is powered down. They only trigger when the Remote controller is also powered down.
Is there another way to detect this event?
Tested on M300 and Mavic Pro with iOS SDK 4.15.2
-
Sorry I do not understand your reply. Can you please clarify? Is it possible to detect when the drone has disconnected from the RC? Is there some SDK property or function I can call to see if the connection between the RC and Aircraft is active??
When I power off the aircraft and query the SDK the isConnected property of each of these returns true
airLink, camera, battery, flightController
The product is not null. Everything appears as if the drone is still connected.
The only behaviour I see is that most of the delegate methods, e.g flightControllerdidUpdateState, airLink didUpdateDownlinkSignalQuality/didUpdateUplinkSignalQuality stop sending updates.
Thank you
-
Also testing with the sample app. I added the DJISDKManager componentConnectedWithKey, componentDisconnectedWithKey, productChanged delegate functions. None of these functions are called when the drone is powered down (RC still powered on). These functions are only called when the drone is powered back on
-
It turns out componentDisconnectedWithKey and productChanged delegate functions were not firing for me because the instance running the DJISDKManagerDelegate protocol was not running on the main thread so bizarrely sometimes they would fire and sometimes not. By specifying that it runs on the main thread fixed my issue.
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
Please sign in to leave a comment.
Comments
4 comments