KeyThermalTemperatureMeasureMode returns an error
CompletedHello,
I'm trying to get temperature for a spot on Mavik 3T, but I'm getting an error.
After CameraLensType is set to CameraLensType.CAMERA_LENS_THERMAL I'm setting CameraKey.KeyCameraVideoStreamSource to CameraVideoStreamSourceType.INFRARED_CAMERA. This calls back success.
In onSuccess() callback method I'm trying to set CameraKey.KeyThermalTemperatureMeasureMode to ThermalTemperatureMeasureMode.SPOT and here I'm receiving error "ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}"
I've tried to set KeyThermalTemperatureMeasureMode before and after KeyCameraVideoStreamSource is set, but anyway I'm geting the same error.
Therefore when I'm trying to set KeyThermalSpotMetersurePoint I receive the same error "ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}"
What am I doing wrong?
Thanks.
-
I'm using FPVInteractionWidget from the sample.
I've added this code to the method "void updateCameraSource(@NonNull ComponentIndexType cameraIndex, @NonNull CameraLensType lensType)"
KeyManager keyManager = KeyManager.getInstance();
DJIKey<CameraVideoStreamSourceType> keySteamSourceType = KeyTools
.createKey(CameraKey.KeyCameraVideoStreamSource);
DJIKey<ThermalTemperatureMeasureMode> keyMeasureMode = KeyTools
.createKey(CameraKey.KeyThermalTemperatureMeasureMode);
if (lensType == CameraLensType.CAMERA_LENS_THERMAL) {
chbxTemperature.setVisibility(VISIBLE);
keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.SPOT, new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
appentTxtLog("OK: KeyThermalTemperatureMeasureMode set to SPOT 1");
}
@Override
public void onFailure(@NonNull IDJIError idjiError) {
appentTxtLog("FAILED: KeyThermalTemperatureMeasureMode set to SPOT 1: " + idjiError);
}
});
keyManager.setValue(keySteamSourceType, CameraVideoStreamSourceType.INFRARED_CAMERA, new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
appentTxtLog("OK: KeyCameraVideoStreamSource set to INFRARED_CAMERA");
keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.SPOT, new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
appentTxtLog("OK: KeyThermalTemperatureMeasureMode set to SPOT 2");
}
@Override
public void onFailure(@NonNull IDJIError idjiError) {
appentTxtLog("FAILED: KeyThermalTemperatureMeasureMode set to SPOT 2: " + idjiError);
}
});
}
@Override
public void onFailure(@NonNull IDJIError idjiError) {
appentTxtLog("FAILED: KeyCameraVideoStreamSource set to INFRARED_CAMERA: " + idjiError);
}
});
} else {
chbxTemperature.setVisibility(GONE);
keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.DISABLED, null);
}And this code to the method "void updateTarget(ControlMode controlMode, boolean isAeLocked, float targetX, float targetY)"
if (touchTemperatureEnabled && getLensType() == CameraLensType.CAMERA_LENS_THERMAL) {
getSpotMetersureTemperature(targetX, targetY);
}And here is method getSpotMetersureTemperature
private void getSpotMetersureTemperature(float targetX, float targetY) {
CommonCallbacks.CompletionCallback pointCallback = new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
appentTxtLog("KeyThermalSpotMetersurePoint set " + targetX + ", " + targetY + " OK");
DJIKey<Double> keyTemperature = KeyTools.createKey(CameraKey.KeyThermalSpotMetersureTemperature);
KeyManager.getInstance().getValue(keyTemperature, new CommonCallbacks.CompletionCallbackWithParam<Double>() {
@Override
public void onSuccess(Double aDouble) {
appentTxtLog("OK: get KeyThermalSpotMetersureTemperature");
String tempString = aDouble == null ? "null" : aDouble.toString();
showTemp(tempString);
}
@Override
public void onFailure(@NonNull IDJIError idjiError) {
appentTxtLog("FAILED: get KeyThermalSpotMetersureTemperature: " + idjiError);
showTemp("errror");
}
});
}
@Override
public void onFailure(@NonNull IDJIError idjiError) {
appentTxtLog("FAILED: KeyThermalSpotMetersurePoint set " + targetX + ", " + targetY + " - " + idjiError);
Log.e(TAG, "onFailure: " + idjiError);
showTemp("error");
}
};
DJIKey<DoublePoint2D> keyPoint = KeyTools.createKey(CameraKey.KeyThermalSpotMetersurePoint);
DoublePoint2D dp3d = new DoublePoint2D((double) targetX, (double) targetY);
KeyManager.getInstance().setValue(keyPoint, dp3d, pointCallback);
}And here is the log
FAILED: KeyThermalTemperatureMeasureMode set to SPOT 1: ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}
OK: KeyCameraVideoStreamSource set to INFRARED_CAMERA
FAILED: KeyThermalTemperatureMeasureMode set to SPOT 2: ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}
FAILED: KeyThermalSpotMetersurePoint set 0.68541664, 0.734375 - ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'} -
The KEY_MISS_EXECUTION_FUNCTION refers to the current state being unable to perform this action. Based on your code, it seems that you did not specify the infrared lens when creating the Key for the infrared lens. I recommend adding ComponentIndex and LensType when creating the Key. Setting the temperature measurement mode can only be successful when the video source is an infrared camera. I suggest waiting for a short period after switching to the infrared lens before setting the temperature measurement mode. -
Thanks for your reply.
Could you please give an example of how to add ComponentIndex and LensType when creating the Key? I've tried to use "ComponentIndexType cameraIndex", but it didn’t work out.
DJIKey<CameraVideoStreamSourceType> keySteamSourceType = KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource, cameraIndex);
Please sign in to leave a comment.
Comments
5 comments