Mobile-SDK-Android
Mobile-SDK-Android copied to clipboard
Laser measure information H20T
Hello everyone,
I am trying to show on screen the laser distance measurement of my H20T camera but something is not working. I use a M350RTK and the 4.17 version of the msdk. I have assumed that I should use the infrared lens of the camera but maybe I am wrong.
Below you can see the code where I deal with it. Do you know why is it not working? Thanks.
private lateinit var laserMeasureInformationCallback: LaserMeasureInformation.Callback
// ...
laserMeasureInformationCallback = LaserMeasureInformation.Callback {
val laserMeasureInformation = it.targetDistance
Log.d("LASER INFO", laserMeasureInformation.toString())
}
// ...
val camera = DJISDKManager.getInstance().product!!.camera!!
val lenses = camera.lenses
var lens = camera.getLens(0)
for (pos in lenses!!.indices) {
if (lenses[pos].type.toString() == "INFRARED_THERMAL") {
lens = lenses[pos]
}
}
camera.setLaserEnabled(true) {
if (it == null) {
Log.d("LaserEnabled", "True")
lens.setLaserMeasureInformationCallback { laserMeasureInformationCallback ->
Log.d("LaserInfo", "${laserMeasureInformationCallback.targetDistance}")
}
}
}
Laser measurement can be used with every lens. What does "not working" refer to? If you are indoors, you need to use a simulator or DA2 to provide the drone with simulated GPS signals, so that the laser measurement function can obtain data.