简体   繁体   中英

Obstacle Avoidance Sensor Data Using the DJI SDK (V4.3.2)

I am currently working with the Inspire 2 & the M210 RTK. Can anyone help me in getting the Obstacle Avoidance sensor data output from the drone using the Mobile-SDK? I would like to get the exact distance reading from the object in front of the drone in an constantly updating value. Any code examples? I am relatively new to the DJI SDK so any help would be greatly appreciated. Thanks in advance!

Before getting into this, keep in mind that the distance you receive is not perfectly accurate.

There is a few ways you can access the sensors with the mobile SDK.

1/ Traditional interfaces using the obstacle avoidance part of the DJIFlightAssistant

2/ Using the keys, you can start listening to the Flight Controller key DJIFlightAssistantParamDetectionSectors . The block called will contain an array of DJIObstacleDetectionSector which have a obstacleDistanceInMeters :

guard let detectionSectorsKey = DJIFlightControllerKey(param: DJIFlightAssistantParamDetectionSectors) else {
    // failed to create the key
    return;
}

guard let keyManager = DJISDKManager.keyManager()? else {
    // failed to access the keyManager. You're most likely not registered yet.
    return;
}

keyManager.startListeningForChanges(on: detectionSectorsKey, withListener: self, andUpdate: { (oldValue, newValue) in
    let sectors = newValue?.value as! [DJIObstacleDetectionSector]

    //do stuff.
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM