我正在尝试使用 Sdk 3.0.1 旋转我的 phantom 3 但没有成功,
我的代码:
DJIFlightController flightController = ((DJIAircraft) mProduct).getFlightController();
flightController.enableVirtualStickControlMode(new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("enableVirtualStickControlMode: success");
} else {
showToast(error.getDescription());
}
}
});
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
showToast("Set yaw control mode to angle");
flightController.setHorizontalCoordinateSystem(DJIFlightControllerDataType.DJIVirtualStickFlightCoordinateSystem.Body);
flightController.setRollPitchControlMode(DJIFlightControllerDataType.DJIVirtualStickRollPitchControlMode.Angle);
flightController.setVerticalControlMode(DJIFlightControllerDataType.DJIVirtualStickVerticalControlMode.Velocity);
flightController.setYawControlMode(DJIFlightControllerDataType.DJIVirtualStickYawControlMode.Angle);
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
DJIFlightControllerDataType.DJIVirtualStickFlightControlData flightControlData =
new DJIFlightControllerDataType.DJIVirtualStickFlightControlData(0, 0, 45, 0);
flightController.sendVirtualStickFlightControlData(flightControlData, new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("Rotation: success");
} else {
showToast(error.getDescription());
}
}
});
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
flightController.disableVirtualStickControlMode(new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("disableVirtualStickControlMode: success");
} else {
showToast(error.getDescription());
}
}
});
我收到消息“旋转:成功”,但飞机没有移动。难道我做错了什么?我真的很感激任何帮助。