dji-sdk / Mobile-SDK-iOS

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

How to check if compass is calibrated using iOS SDK #548

Open douglaswsilva opened 1 year ago

douglaswsilva commented 1 year ago

Hi,

During preflight check we want to make sure that the compass is calibrated. We were previously using DJICompassCalibrationState to do this check but realized that this measurement is only working during the actual calibration process of the vehicle.

Now we're trying to use DJICompassSensorState, but from the documentation it is not clear which states are valid and which states are not (by "valid" I mean states in which the drone is calibrated and will be able to fly).

Could you provide clarification if this is the right way to check for compass calibration, and on which states we will get from the SDK if the vehicle compass is not calibrated, and which values we will get when the vehicle is calibrated?

Thank you in advance, any help is very appreciated.

Screenshot 2023-03-17 at 11 20 13 PM
DJI-William commented 1 year ago

If the compass is invalid and needs to calibrate, there will be a warning in DJIDiagnostics. Also, you can check the hasError property in DJICompass class to know if the current compass needs to be calibtrated.